UNPKG

generator-luna

Version:

generate specific EHR application,it's built beyond the jhipster

73 lines (66 loc) 2.46 kB
/** * Copyright 2013-2019 the original author or authors from the JHipster project. * * This file is part of the JHipster project, see https://www.jhipster.tech/ * for more information. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* eslint-disable consistent-return */ const chalk = require('chalk'); const writeFiles = require('./files').writeFiles; const utils = require('../utils'); const BaseBlueprintGenerator = require('../generator-base-blueprint'); let useBlueprint; module.exports = class extends BaseBlueprintGenerator { constructor(args, opts) { super(args, opts); utils.copyObjectProps(this, this.options.context); const blueprint = this.config.get('blueprint'); if (!opts.fromBlueprint) { // use global variable since getters dont have access to instance property useBlueprint = this.composeBlueprint(blueprint, 'entity-client', { context: opts.context, force: opts.force, debug: opts.context.isDebugEnabled, 'skip-install': opts.context.options['skip-install'], 'from-cli': opts.context.options['from-cli'] }); } else { useBlueprint = false; } } // Public API method used by the getter and also by Blueprints _writing() { return writeFiles(); } get writing() { if (useBlueprint) return; return this._writing(); } // Public API method used by the getter and also by Blueprints _end() { return { end() { if (!this.options['skip-install'] && !this.skipClient) { this.rebuildClient(); } this.log(chalk.bold.green(`Entity ${this.entityNameCapitalized} generated successfully.`)); } }; } get end() { if (useBlueprint) return; return this._end(); } };