UNPKG

@jorgeucanorg/init

Version:

Add scully to your angular app

36 lines 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const schematics_1 = require("@angular-devkit/schematics"); // for now we dont have any option for use // @ts-ignore function scully(options) { return (tree, context) => { // project workspace data const workspaceConfigBuffer = tree.read('angular.json'); if (!workspaceConfigBuffer) { throw new schematics_1.SchematicsException('Not an angular CLI workspace'); } // modify package json for support npm commands const content = tree.read(`/package.json`); let jsonContent; if (content) { jsonContent = JSON.parse(content.toString()); } /* tslint:disable:no-string-literal */ jsonContent.scripts['scully'] = 'scully'; /* tslint:enable:no-string-literal */ jsonContent.scripts['scully:serve'] = 'scully serve'; tree.overwrite(`/package.json`, JSON.stringify(jsonContent, undefined, 2)); context.logger.info('✅️ Update package.json'); // add config file if (!tree.exists('./scully.config.js')) { tree.create('./scully.config.js', `exports.config = { routes: { } };`); } // end return }; } exports.scully = scully; //# sourceMappingURL=index.js.map