polymerx-cli
Version:
Unlock the power of Polymer 3, Web Components and modern web tools.
33 lines (28 loc) • 1.01 kB
JavaScript
;
exports.__esModule = true;
exports.default = isMissing;
var _phunctional = require("phunctional");
const KEYS = ['template', 'dest', 'force', 'yarn', 'git', 'install'];
const ask = (name, message, val) => {
const type = val === undefined ? 'input' : 'confirm';
return {
name,
message,
type,
default: val
};
};
function isMissing(argv) {
const missingKeys = KEYS.filter(key => !new Set(Object.keys(argv)).has(key));
const out = missingKeys.reduce((acc, key) => {
return acc.concat((0, _phunctional.switchcase)({
template: ask('template', 'Remote template to clone (user/repo#tag)'),
dest: ask('dest', 'Directory to create the app'),
force: ask('force', 'Enforce `dest` directory; will overwrite!', false),
yarn: ask('yarn', 'Install with `yarn` instead of `npm`', false),
git: ask('git', 'Initialize a `git` repository', false),
install: ask('install', 'Install dependencies', true)
})({})(key));
}, []);
return out;
}