本文整理汇总了TypeScript中yeoman-generator.Base类的典型用法代码示例。如果您正苦于以下问题:TypeScript Base类的具体用法?TypeScript Base怎么用?TypeScript Base使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Base类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
constructor: function (): void {
YG.Base.apply(this, arguments);
let self: GeneratorDrupal.Typed.IGenerator = this;
self.option('use-npm-cache', {
type: 'Boolean',
desc: 'Adds "--cache-min 999999" option to `npm install`.',
alias: null,
'default': true,
hide: false
});
self.config = {};
self.appName2ModuleName = function (appName: string): string {
return appName
.replace(/^typed drupal /, '')
.replace(' ', '_');
};
/**
* @todo DRY - There is a same function in "project" generator.
*/
self.destinationFileName = function (tplFileName: string): string {
return tplFileName
.replace(/\.ejs$/, '')
.replace('moduleNameSnake', self.config.moduleNameSnake);
};
self.preProcessConfig = function (): void {
self.config.moduleNameDash = self.config.moduleNameSnake.replace('_', '-');
self.config.moduleNameLowerCamel = _.camelCase(self.config.moduleNameSnake);
self.config.moduleNameUpperCamel = Utils.upperFirst(self.config.moduleNameLowerCamel);
};
},
示例2: function
constructor: function() {
generators.Base.apply(this,arguments);
this.option
}
示例3: require
///<reference path="typings/main.d.ts" />
var generators = require('yeoman-generator');
module.exports = generators.Base.extend({
constructor: function() {
generators.Base.apply(this,arguments);
this.option
}
});
示例4: require
/* tslint:disable:no-var-requires */
const generators = require("yeoman-generator");
module.exports = generators.Base.extend({
install: {
npm: function () {
this.npmInstall();
},
},
writing: function () {
this.fs.copy(
this.templatePath("**/*"),
this.destinationPath(".")
);
this.fs.move(
this.destinationPath("_gitignore"),
this.destinationPath(".gitignore")
);
this.fs.move(
this.destinationPath("_npmignore"),
this.destinationPath(".npmignore")
);
},
});