Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yeoman upgrade to v1.x #46

Merged
merged 3 commits into from
Mar 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 86 additions & 91 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
var underscoreString = require('underscore.string');
var Generator = require('yeoman-generator');

module.exports = yeoman.Base.extend({
prompting: function () {
var done = this.async();
module.exports = class extends Generator {

constructor(args, opts) {
super(args, opts);
}

initializing() {
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the ' + chalk.red('Angular Library') + ' generator!'
));
}

prompting() {
var prompts = [
{
type: 'input',
Expand Down Expand Up @@ -56,7 +62,7 @@ module.exports = yeoman.Base.extend({
}
];

this.prompt(prompts, function (props) {
return this.prompt(prompts).then(props => {

this.props = {

Expand All @@ -73,93 +79,82 @@ module.exports = yeoman.Base.extend({
gitRepositoryUrl: props.gitRepositoryUrl
};

done();
}.bind(this));

},

writing: {

copyGitIgnore: function copyGitIgnore() {
this.fs.copy(
this.templatePath('gitignore'),
this.destinationPath('.gitignore')
);
},

copyNpmIgnore: function copyNpmIgnore() {
this.fs.copy(
this.templatePath('npmignore'),
this.destinationPath('.npmignore')
);
},

copyTravisYml: function copyTravisYml() {
this.fs.copy(
this.templatePath('travis.yml'),
this.destinationPath('.travis.yml')
);
},

copySrc: function copySrc() {
this.fs.copy(
this.templatePath('src/**/*'),
this.destinationPath('src')
);
},

copyTypeScriptConfig: function copyTypeScriptConfig() {
this.fs.copyTpl(
this.templatePath('_tsconfig.json'),
this.destinationPath('tsconfig.json'),
{
props: this.props
}
);
},

copyTypeScriptLintConfig: function copyTypeScriptLintConfig() {
this.fs.copyTpl(
this.templatePath('_tslint.json'),
this.destinationPath('tslint.json'),
{
props: this.props
}
);
},

copyPackageJson: function copyPackageJson() {
this.fs.copyTpl(
this.templatePath('_package.json'),
this.destinationPath('package.json'),
{
props: this.props
}
);
},

copyREADME: function copyREADME() {
this.fs.copyTpl(
this.templatePath('README.MD'),
this.destinationPath('README.MD'),
{
props: this.props
}
);
},

copyIndex: function copyIndex() {
this.fs.copyTpl(
this.templatePath('index.ts'),
this.destinationPath('index.ts'),
{
props: this.props
}
);
}
},
});
}

writing() {

// Copy .gitignore
this.fs.copy(
this.templatePath('gitignore'),
this.destinationPath('.gitignore')
);

// Copy .npmignore
this.fs.copy(
this.templatePath('npmignore'),
this.destinationPath('.npmignore')
);

// Copy .travis.yml
this.fs.copy(
this.templatePath('travis.yml'),
this.destinationPath('.travis.yml')
);

// Copy src folder
this.fs.copy(
this.templatePath('src/**/*'),
this.destinationPath('src')
);

// Copy tsconfig.json
this.fs.copyTpl(
this.templatePath('_tsconfig.json'),
this.destinationPath('tsconfig.json'),
{
props: this.props
}
);

// Copy tslint.json
this.fs.copyTpl(
this.templatePath('_tslint.json'),
this.destinationPath('tslint.json'),
{
props: this.props
}
);

// Copy package.json
this.fs.copyTpl(
this.templatePath('_package.json'),
this.destinationPath('package.json'),
{
props: this.props
}
);

// Copy README
this.fs.copyTpl(
this.templatePath('README.MD'),
this.destinationPath('README.MD'),
{
props: this.props
}
);

// Copy index.ts
this.fs.copyTpl(
this.templatePath('index.ts'),
this.destinationPath('index.ts'),
{
props: this.props
}
);
}

install: function () {
install() {
this.installDependencies({bower: false});
}
});
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"dependencies": {
"chalk": "^1.1.3",
"underscore.string": "^3.3.4",
"yeoman-generator": "^0.22.0",
"yosay": "^1.1.1"
"yeoman-generator": "^1.0.0",
"yosay": "^2.0.0"
},
"devDependencies": {
"yeoman-assert": "^2.2.1",
Expand Down