mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-25 09:44:32 +01:00
aa6520daac
* 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
48 lines
1.5 KiB
JavaScript
Executable File
48 lines
1.5 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
const spawn = require('cross-spawn');
|
|
|
|
('use strict');
|
|
|
|
// Makes the script crash on unhandled rejections instead of silently
|
|
// ignoring them. In the future, promise rejections that are not handled will
|
|
// terminate the Node.js process with a non-zero exit code.
|
|
process.on('unhandledRejection', (err) => {
|
|
throw err;
|
|
});
|
|
|
|
const args = process.argv.slice(2);
|
|
|
|
const scriptIndex = args.findIndex(
|
|
(x) => x === 'build' || x === 'development' || x === 'analyzer' || x === 'rimraf' // TODO
|
|
);
|
|
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
|
|
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
|
|
|
|
if (['build', 'development', 'analyzer', 'rimraf'].includes(script)) {
|
|
const result = spawn.sync(
|
|
process.execPath,
|
|
nodeArgs.concat(require.resolve('./scripts/' + script)).concat(args.slice(scriptIndex + 1)),
|
|
{ stdio: 'inherit' }
|
|
);
|
|
if (result.signal) {
|
|
if (result.signal === 'SIGKILL') {
|
|
console.log(
|
|
'The build failed because the process exited too early. ' +
|
|
'This probably means the system ran out of memory or someone called ' +
|
|
'`kill -9` on the process.'
|
|
);
|
|
} else if (result.signal === 'SIGTERM') {
|
|
console.log(
|
|
'The build failed because the process exited too early. ' +
|
|
'Someone might have called `kill` or `killall`, or the system could ' +
|
|
'be shutting down.'
|
|
);
|
|
}
|
|
process.exit(1);
|
|
}
|
|
process.exit(result.status);
|
|
} else {
|
|
console.log('Unknown script "' + script + '".');
|
|
}
|