mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-12-16 08:32:32 -05:00
Frontent dev env (#247)
* Added frontend development files/environment * More items-categories related removals * Improvements in pages templates (inc. static pages) * Improvements in video player * Added empty home page message + cta * Updates in media, playlist and management pages * Improvements in material icons font loading * Replaced media & playlists links in frontend dev-env * frontend package version update * chnaged frontend dev url port * static files update * Changed default position of theme switcher * enabled frontend docker container
This commit is contained in:
21
frontend/packages/scripts/scripts/utils/parseCliArgs.js
Normal file
21
frontend/packages/scripts/scripts/utils/parseCliArgs.js
Normal file
@@ -0,0 +1,21 @@
|
||||
function parseCliArgsFn(cliArgs) {
|
||||
const ret = {};
|
||||
|
||||
let arr;
|
||||
|
||||
for (let arg of cliArgs) {
|
||||
arr = arg.split('--');
|
||||
|
||||
if (2 === arr.length) {
|
||||
arr = arr[1].split('=');
|
||||
|
||||
if (2 === arr.length) {
|
||||
ret[arr[0]] = arr[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
module.exports = parseCliArgsFn;
|
||||
94
frontend/packages/scripts/scripts/utils/validateOptions.js
Normal file
94
frontend/packages/scripts/scripts/utils/validateOptions.js
Normal file
@@ -0,0 +1,94 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function validateDevOptions(options) {
|
||||
if (void 0 !== options.config) {
|
||||
if ('string' !== typeof options.config) {
|
||||
throw Error('Invalid configuration file: ' + options.config);
|
||||
}
|
||||
|
||||
options.config = path.resolve(options.config);
|
||||
|
||||
if (!fs.existsSync(options.config)) {
|
||||
throw Error('Invalid configuration file: ' + options.config);
|
||||
}
|
||||
|
||||
options.config = require(path.resolve(options.config));
|
||||
}
|
||||
|
||||
if (void 0 !== options.env) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
if (void 0 !== options.host) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
if (void 0 !== options.port) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function validateBuildOptions(options) {
|
||||
if (void 0 !== options.config) {
|
||||
if ('string' !== typeof options.config) {
|
||||
throw Error('Invalid configuration file: ' + options.config);
|
||||
}
|
||||
|
||||
options.config = path.resolve(options.config);
|
||||
|
||||
if (!fs.existsSync(options.config)) {
|
||||
throw Error('Invalid configuration file: ' + options.config);
|
||||
}
|
||||
|
||||
options.config = require(path.resolve(options.config));
|
||||
}
|
||||
|
||||
if (void 0 !== options.env) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function validateAnalyzerOptions(options) {
|
||||
if (void 0 !== options.config) {
|
||||
if ('string' !== typeof options.config) {
|
||||
throw Error('Invalid configuration file: ' + options.config);
|
||||
}
|
||||
|
||||
options.config = path.resolve(options.config);
|
||||
|
||||
if (!fs.existsSync(options.config)) {
|
||||
throw Error('Invalid configuration file: ' + options.config);
|
||||
}
|
||||
|
||||
options.config = require(path.resolve(options.config));
|
||||
}
|
||||
|
||||
if (void 0 !== options.env) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
if (void 0 !== options.host) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
if (void 0 !== options.port) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
if (void 0 !== options.mode) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
validateDevOptions,
|
||||
validateBuildOptions,
|
||||
validateAnalyzerOptions,
|
||||
};
|
||||
Reference in New Issue
Block a user