Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async function() {
// Intro logging
console.log(`\n${figlet.textSync('CASTER')}\n`);
try {
// Collect user configuration
const config = sanitizeInput(await collectInput());
console.log('');
// Generate project structure
const generation = generateStructure(config);
ora.promise(generation, { text: 'Generating project structure' });
await generation;
// Install project dependencies
const installation = execute('npm install', config.name);
ora.promise(installation, { text: 'Installing project dependencies' });
await installation;
// Success outro logging
console.log(
`\n ${chalk.bold(chalk.green('Success!'))} Generated ${config.name} at ${path.resolve(config.name)}.`
);
console.log(' The following commands are available within that directory:\n');
config.tech.js && console.log(` ${chalk.cyan('npm run test')} Runs JavaScript unit tests`);
config.tech.js && console.log(` ${chalk.cyan('npm run eslint')} Lints JavaScript files`);
config.tech.css && console.log(` ${chalk.cyan('npm run stylelint')} Lints CSS files`);
console.log(` ${chalk.cyan('npm run prettier')} Format files`);
static async spinPromise(promise, text, spinner, stream = process.stdout) {
ora.promise(promise, {
text: text,
spinner: spinner,
stream: stream
// color: false,
// enabled: true
});
return promise;
}
}
emitter.on("create", (message, action) => {
if (action) ora.promise(action, message);
else console.log(message);
});
}
{
const promise = mergeFiles(path.join(dest, name, 'package.json'), {
name,
description,
author,
license
}, [ { value: pkg, pattern: '\\$packageManager' } ])
ora.promise(promise, messageLogger(4, 'gear', `Project configurations..`))
await promise
}
{
const promise = execShPromise(`cd ${name} && ${pkg} install `, true)
ora.promise(promise, messageLogger(5, 'truck', `Installing packages..`))
await promise
}
console.log('')
}
emitter.on("subscribe", (message, action) => {
if (action) ora.promise(action, message);
else console.log(message);
});
{
const promise = pEachSeries(files, async file => {
return module.exports.copyTemplateFile({
file,
source,
dest,
info
});
});
ora.promise(promise, `Copying ${template} template to ${dest}`);
await promise;
}
{
const promise = module.exports.initPackageManager({ dest, info });
ora.promise(promise, `Running ${manager} install and ${manager} link`);
await promise;
}
if (git) {
const promise = module.exports.initGitRepo({ dest });
ora.promise(promise, "Initializing git repo");
await promise;
}
return dest;
};
info
});
});
ora.promise(promise, `Copying ${template} template to ${dest}`);
await promise;
}
{
const promise = module.exports.initPackageManager({ dest, info });
ora.promise(promise, `Running ${manager} install and ${manager} link`);
await promise;
}
if (git) {
const promise = module.exports.initGitRepo({ dest });
ora.promise(promise, "Initializing git repo");
await promise;
}
return dest;
};
Promise.prototype.logging = function logging(opts) {
ora.promise(this, opts);
return this;
};
info
})
})
ora.promise(promise, `Copying ${template} template to ${dest}`)
await promise
}
{
const promise = module.exports.initPackageManager({ dest, info })
ora.promise(promise, `Running ${manager} install and ${manager} link`)
await promise
}
if (gitInit) {
const promise = module.exports.initGitRepo({ dest })
ora.promise(promise, 'Initializing git repo')
await promise
}
return dest
}