UNPKG

generator-cloudcms

Version:

A generator for bootstrapping a new Cloud CMS project for a client engagement.

81 lines (72 loc) 2.29 kB
'use strict'; const Generator = require('yeoman-generator'); const chalk = require('chalk'); const yosay = require('yosay'); module.exports = class extends Generator { constructor(args, opts) { // Calling the super constructor is important so our generator is correctly set up super(args, opts) // This makes `project-name a required argument. this.argument("project-name", { type: String, required: true, desc: "The name of the folder where the project will go" }); } async prompting() { this.answers = await this.prompt([ { type: "input", name: "name", message: "Your project name", default: this.appname // Default to current folder name }, { type: "confirm", name: "content-model", message: "Include a Content Model template?" }, { type: "confirm", name: "field-module", message: "Include a custom form field UI Module template?" }, { type: "confirm", name: "ui-config", message: "Include a UI Config template?" }, { type: "confirm", name: "importer", message: "Include a 'cloudcms-packager' based importer application template?" }, { type: "confirm", name: "legacy-js", message: "Include a standalone API script template (legacy javascript driver)?" }, { type: "confirm", name: "new-js", message: "Include a standalone API script template (new javascript driver)?" } ]); } writing() { this.log("app name", this.answers.name); this.log("content model", this.answers["content-model"]); this.log("custom form field module", this.answers["field-module"]); this.log("ui config template", this.answers["ui-config-model"]); this.log("importer app template", this.answers["importer"]); this.log("standalone API script template legacy javascript driver", this.answers["legacy-js"]); this.log("standalone API script template new javascript driver", this.answers["new-js"]); this.fs.copy( this.templatePath('dummyfile.txt'), this.destinationPath('dummyfile.txt') ); } install() { this.installDependencies(); } };