Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return callback(true);
}
}else{
//if(!/^.*(\.({|{[a-zA-Z,]*,)|\.)(svg)(,[,a-zA-Z]*}|}|)$/gi.test(input)){
// console.log(colors.red(" You didn't turn on [enginesvg], but your input path includes the 'svg' extension; either delete the extension 'svg' from path, or turn on [enginesvg: ['svgo'] or other]. Alternatively, your input path may be malformed!: Examples: src/img/**/*.{jpg,JPG,jpeg,JPEG,svg} or src/img/**/*.svg or src/img/*.svg ..."));
// console.log(colors.red(' Input path: ')+colors.magenta(input));
// return callback(true);
//}
}
//GIF
if(false == enginegif.gif.engine){
if(/^.*(\.({|{[a-zA-Z,]*,)|\.)(gif)(,[,a-zA-Z]*}|}|)$/gi.test(input)){
console.log(colors.red(" You didn't turn on [enginegif], but your input path includes the 'gif' extension; either delete the extension 'gif' from the input path, or turn on [enginegif: ['gifsicle'] or other]. Alternatively, your input path may be malformed!: Examples: src/img/**/*.{jpg,JPG,jpeg,JPEG,gif} or src/img/**/*.gif or src/img/*.gif ..."));
console.log(colors.red(' Input path: ')+colors.magenta(input));
return callback(true);
}
}else{
//if(!/^.*(\.({|{[a-zA-Z,]*,)|\.)(gif)(,[,a-zA-Z]*}|}|)$/gi.test(input)){
// console.log(colors.red(" You didn't turn on [enginegif], but your input path includes the 'gif' extension; either delete the extension 'gif' from path, or turn on [enginegif: ['gifsicle'] or other]. Alternatively, your input path may be malformed!: Examples: src/img/**/*.{jpg,JPG,jpeg,JPEG,gif} or src/img/**/*.gif or src/img/*.gif ..."));
// console.log(colors.red(' Input path: ')+colors.magenta(input));
// return callback(true);
//}
}
if(returnMain === 'finished2') {
console.clear();
console.log();
console.log(colors.blue.bold('mStream Configuration Wizard'));
console.log(colors.magenta('Config Not Saved!'));
console.log();
process.exit();
}
// Save
fs.writeFileSync( filepath, JSON.stringify(loadJson, null, 2), 'utf8');
console.clear();
console.log();
console.log(colors.blue.bold('mStream Configuration Wizard'));
console.log(colors.magenta('Config Saved!'));
console.log();
console.log(colors.bold('You can start mStream by running the command:'));
console.log(`mstream -j ${filepath}`);
console.log();
}
return new Promise((resolve, reject) => {
// Set up NPM.
/* istanbul ignore next */
if (!process.env.TEST) {
console.info(colors.magenta('Installing ' + firmware.name + ' from npm'));
}
// first try to install the npm package
let command = 'npm install --no-save ';
// test to see if installing from a gh repo as an npm package.
if (firmware.npm.repo !== undefined) {
command = command + firmware.npm.repo;
} else {
if (typeof(firmware.npm.version) == 'undefined') {
// just use "latest" from npm
command = command + firmware.npm.package;
} else {
command = command + firmware.npm.package + '@' + firmware.npm.version;
}
}
async function toggleLogging(loadJson) {
console.clear();
console.log();
console.log(colors.blue.bold('mStream Configuration Wizard'));
console.log(colors.magenta('Logging'));
console.log();
console.log(`Logging is: ${loadJson.writeLogs ? colors.green('Enabled') : colors.red('Disabled') }`);
console.log(`Logs will be written to: ${loadJson.storage.logsDirectory ? loadJson.storage.logsDirectory : defaults.storage.logsDirectory}`);
console.log();
const shouldFlip = await confirmThis(`Do you want to ${loadJson.writeLogs ? colors.red('DISABLE') : colors.green('ENABLE') } logging?`);
if (shouldFlip) {
loadJson.writeLogs = !loadJson.writeLogs;
}
}
AVAILABLE OPTIONS:
${colors.magenta('--help')} ${colors.cyan('or')} ${colors.magenta('-h')} Print this help
${colors.magenta('--version')} ${colors.cyan('or')} ${colors.magenta('-v')} Print the current version
${colors.magenta('--quiet')} ${colors.cyan('or')} ${colors.magenta('-q')} Suppress output when executing commands ${colors.cyan('| default: false')}
${colors.magenta('--noclipboard')} ${colors.cyan('or')} ${colors.magenta('-n')} Do not copy the URL to clipboard ${colors.cyan('| default: false')}
${colors.magenta('--website')} ${colors.cyan('or')} ${colors.magenta('-w')} Set uploaded folder as a static website ${colors.cyan('| default: false')}
${colors.magenta('--spa')} Set uploaded folder as a single page app and redirect all non-existing pages to index.html ${colors.cyan('| default: false')}
${colors.magenta('--source')} ${colors.cyan('or')} ${colors.magenta('-s')} Source of the folder that will be uploaded ${colors.cyan('| default: current folder')}
${colors.magenta('--bucket')} ${colors.cyan('or')} ${colors.magenta('-b')} Name of the S3 bucket ${colors.cyan('| default: name of the current folder')}
${colors.magenta('--prefix')} ${colors.cyan('or')} ${colors.magenta('-p')} Prefix on the S3 bucket ${colors.cyan('| default: the root of the bucket')}
${colors.magenta('--region')} ${colors.cyan('or')} ${colors.magenta('-r')} AWS region where the files will be uploaded ${colors.cyan('| default: saved region if exists or a list to choose one if it is not saved yet')}
${colors.magenta('--force')} ${colors.cyan('or')} ${colors.magenta('-f')} Update the bucket without asking, region can be overridden with ${colors.magenta('-r')} ${colors.cyan('| default: false')}
${colors.magenta('--update')} ${colors.cyan('or')} ${colors.magenta('-u')} Update existing bucket ${colors.cyan('| default: false')}
${colors.magenta('--delete')} ${colors.cyan('or')} ${colors.magenta('-d')} Delete existing bucket ${colors.cyan('| default: false')}
${colors.magenta('--nocdn')} ${colors.cyan('or')} ${colors.magenta('-c')} Disable Cloudfront handling ${colors.cyan('| default: false')}
${colors.magenta('--urlonly')} ${colors.cyan('or')} ${colors.magenta('-o')} Only output the resulting URL, CDN or S3 according to options ${colors.cyan('| default: false')}
${colors.magenta('--expire')} ${colors.cyan('or')} ${colors.magenta('-e')} Delete objects on bucket older than n days ${colors.cyan('| default: no expiration')}
${colors.magenta('--profile')} ${colors.cyan('or')} ${colors.magenta('-a')} AWS profile to be used ${colors.cyan('| default: default')}
${colors.magenta('--empty')} ${colors.cyan('or')} ${colors.magenta('-y')} Empty the bucket (Delete all objects before upload files) ${colors.cyan('| default: false')}
✤ ✤ ✤
${colors.magenta('Beam me up, Scotty!')}
More info: ${colors.cyan('https://github.com/stojanovic/scottyjs')}
Changelog/release history: ${colors.cyan('https://github.com/stojanovic/scottyjs/releases')}
`)
}
✤ ✤ ✤
USAGE:
${colors.magenta('scotty {options}')} ${colors.cyan('or')} ${colors.magenta('beam-me-up {options}')}
AVAILABLE OPTIONS:
${colors.magenta('--help')} ${colors.cyan('or')} ${colors.magenta('-h')} Print this help
${colors.magenta('--version')} ${colors.cyan('or')} ${colors.magenta('-v')} Print the current version
${colors.magenta('--quiet')} ${colors.cyan('or')} ${colors.magenta('-q')} Suppress output when executing commands ${colors.cyan('| default: false')}
${colors.magenta('--noclipboard')} ${colors.cyan('or')} ${colors.magenta('-n')} Do not copy the URL to clipboard ${colors.cyan('| default: false')}
${colors.magenta('--website')} ${colors.cyan('or')} ${colors.magenta('-w')} Set uploaded folder as a static website ${colors.cyan('| default: false')}
${colors.magenta('--spa')} Set uploaded folder as a single page app and redirect all non-existing pages to index.html ${colors.cyan('| default: false')}
${colors.magenta('--source')} ${colors.cyan('or')} ${colors.magenta('-s')} Source of the folder that will be uploaded ${colors.cyan('| default: current folder')}
${colors.magenta('--bucket')} ${colors.cyan('or')} ${colors.magenta('-b')} Name of the S3 bucket ${colors.cyan('| default: name of the current folder')}
${colors.magenta('--prefix')} ${colors.cyan('or')} ${colors.magenta('-p')} Prefix on the S3 bucket ${colors.cyan('| default: the root of the bucket')}
${colors.magenta('--region')} ${colors.cyan('or')} ${colors.magenta('-r')} AWS region where the files will be uploaded ${colors.cyan('| default: saved region if exists or a list to choose one if it is not saved yet')}
${colors.magenta('--force')} ${colors.cyan('or')} ${colors.magenta('-f')} Update the bucket without asking, region can be overridden with ${colors.magenta('-r')} ${colors.cyan('| default: false')}
${colors.magenta('--update')} ${colors.cyan('or')} ${colors.magenta('-u')} Update existing bucket ${colors.cyan('| default: false')}
${colors.magenta('--delete')} ${colors.cyan('or')} ${colors.magenta('-d')} Delete existing bucket ${colors.cyan('| default: false')}
${colors.magenta('--nocdn')} ${colors.cyan('or')} ${colors.magenta('-c')} Disable Cloudfront handling ${colors.cyan('| default: false')}
${colors.magenta('--urlonly')} ${colors.cyan('or')} ${colors.magenta('-o')} Only output the resulting URL, CDN or S3 according to options ${colors.cyan('| default: false')}
${colors.magenta('--expire')} ${colors.cyan('or')} ${colors.magenta('-e')} Delete objects on bucket older than n days ${colors.cyan('| default: no expiration')}
${colors.magenta('--profile')} ${colors.cyan('or')} ${colors.magenta('-a')} AWS profile to be used ${colors.cyan('| default: default')}
${colors.magenta('--empty')} ${colors.cyan('or')} ${colors.magenta('-y')} Empty the bucket (Delete all objects before upload files) ${colors.cyan('| default: false')}
✤ ✤ ✤
${colors.magenta('Beam me up, Scotty!')}
More info: ${colors.cyan('https://github.com/stojanovic/scottyjs')}
${colors.magenta('--help')} ${colors.cyan('or')} ${colors.magenta('-h')} Print this help
${colors.magenta('--version')} ${colors.cyan('or')} ${colors.magenta('-v')} Print the current version
${colors.magenta('--quiet')} ${colors.cyan('or')} ${colors.magenta('-q')} Suppress output when executing commands ${colors.cyan('| default: false')}
${colors.magenta('--noclipboard')} ${colors.cyan('or')} ${colors.magenta('-n')} Do not copy the URL to clipboard ${colors.cyan('| default: false')}
${colors.magenta('--website')} ${colors.cyan('or')} ${colors.magenta('-w')} Set uploaded folder as a static website ${colors.cyan('| default: false')}
${colors.magenta('--spa')} Set uploaded folder as a single page app and redirect all non-existing pages to index.html ${colors.cyan('| default: false')}
${colors.magenta('--source')} ${colors.cyan('or')} ${colors.magenta('-s')} Source of the folder that will be uploaded ${colors.cyan('| default: current folder')}
${colors.magenta('--bucket')} ${colors.cyan('or')} ${colors.magenta('-b')} Name of the S3 bucket ${colors.cyan('| default: name of the current folder')}
${colors.magenta('--prefix')} ${colors.cyan('or')} ${colors.magenta('-p')} Prefix on the S3 bucket ${colors.cyan('| default: the root of the bucket')}
${colors.magenta('--region')} ${colors.cyan('or')} ${colors.magenta('-r')} AWS region where the files will be uploaded ${colors.cyan('| default: saved region if exists or a list to choose one if it is not saved yet')}
${colors.magenta('--force')} ${colors.cyan('or')} ${colors.magenta('-f')} Update the bucket without asking, region can be overridden with ${colors.magenta('-r')} ${colors.cyan('| default: false')}
${colors.magenta('--update')} ${colors.cyan('or')} ${colors.magenta('-u')} Update existing bucket ${colors.cyan('| default: false')}
${colors.magenta('--delete')} ${colors.cyan('or')} ${colors.magenta('-d')} Delete existing bucket ${colors.cyan('| default: false')}
${colors.magenta('--nocdn')} ${colors.cyan('or')} ${colors.magenta('-c')} Disable Cloudfront handling ${colors.cyan('| default: false')}
${colors.magenta('--urlonly')} ${colors.cyan('or')} ${colors.magenta('-o')} Only output the resulting URL, CDN or S3 according to options ${colors.cyan('| default: false')}
${colors.magenta('--expire')} ${colors.cyan('or')} ${colors.magenta('-e')} Delete objects on bucket older than n days ${colors.cyan('| default: no expiration')}
${colors.magenta('--profile')} ${colors.cyan('or')} ${colors.magenta('-a')} AWS profile to be used ${colors.cyan('| default: default')}
${colors.magenta('--empty')} ${colors.cyan('or')} ${colors.magenta('-y')} Empty the bucket (Delete all objects before upload files) ${colors.cyan('| default: false')}
✤ ✤ ✤
${colors.magenta('Beam me up, Scotty!')}
More info: ${colors.cyan('https://github.com/stojanovic/scottyjs')}
Changelog/release history: ${colors.cyan('https://github.com/stojanovic/scottyjs/releases')}
`)
}