How to use the prompts.override function in prompts

To help you get started, we’ve selected a few prompts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github open-wc / open-wc / packages / create / src / generators / app / index.js View on Github external
* npm init @open-wc --type scaffold --scaffoldType app --tagName foo-bar --installDependencies false
 * npm init @open-wc --type upgrade --features linting demoing --tagName foo-bar --scaffoldFilesFor demoing --installDependencies false
 */
const optionDefinitions = [
  { name: 'destinationPath', type: String }, // path
  { name: 'type', type: String }, // scaffold, upgrade
  { name: 'scaffoldType', type: String }, // wc, app
  { name: 'features', type: String, multiple: true }, // linting, testing, demoing, building
  { name: 'buildingType', type: String }, // rollup, webpack
  { name: 'scaffoldFilesFor', type: String, multiple: true }, // testing, demoing, building
  { name: 'tagName', type: String },
  { name: 'installDependencies', type: String }, // yarn, npm, false
  { name: 'writeToDisk', type: String }, // true, false
];
const overrides = commandLineArgs(optionDefinitions);
prompts.override(overrides);

export const AppMixin = subclass =>
  // eslint-disable-next-line no-shadow
  class AppMixin extends subclass {
    constructor() {
      super();
      this.wantsNpmInstall = false;
      this.wantsWriteToDisk = false;
      this.wantsRecreateInfo = false;
    }

    async execute() {
      console.log(header);
      const scaffoldOptions = [];
      const questions = [
        {