Skip to content

Commit

Permalink
fix author
Browse files Browse the repository at this point in the history
  • Loading branch information
arvitaly committed Nov 29, 2016
1 parent cc0b67d commit fd49e16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 6 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = yeoman.Base.extend({
this.destinationPath(f)
)
);
const packageContent = this.fs.readJSON(this.destinationPath('package.json')) || {};
const packageContent = this.fs.readJSON(this.destinationPath('package.json')) || {homepage: ''};
packageContent.jest = {
automock: true,
unmockedModulePathPatterns: [
Expand All @@ -21,9 +21,13 @@ module.exports = yeoman.Base.extend({
packageContent.scripts.test = 'tsc && tslint --project=tsconfig.json && jest --verbose';
packageContent.scripts['watch:test'] = 'jest --watch';
packageContent.devDependencies = packageContent.devDependencies || {};
const author = packageContent.homepage.indexOf('github.com') > -1 ? packageContent.homepage.match(/^https:\/\/github.com\/([^/]+)/gi)[0].substr(19) : '';
this.fs.writeJSON(this.destinationPath('package.json'), packageContent);
const readmeContent = this.fs.read(this.templatePath('README.md'));
this.fs.write(this.destinationPath('README.md'), readmeContent.replace(/&name&/gi, packageContent.name).replace(/&description&/gi, packageContent.description));
this.fs.write(this.destinationPath('README.md'), readmeContent
.replace(/&author&/gi, author)
.replace(/&name&/gi, packageContent.name)
.replace(/&description&/gi, packageContent.description));
this.npmInstall(['coveralls', 'jest', 'typescript', 'tslint', '@types/jest'], {'save-dev': true});
},

Expand Down
11 changes: 10 additions & 1 deletion generators/app/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@
# Test

npm install
npm test
npm test

[npm-image]: https://badge.fury.io/js/&name&.svg
[npm-url]: https://npmjs.org/package/&name&
[travis-image]: https://travis-ci.org/&author&/&name&.svg?branch=master
[travis-url]: https://travis-ci.org/&author&/&name&
[daviddm-image]: https://david-dm.org/&author&/&name&.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/&author&/&name&
[coveralls-image]: https://coveralls.io/repos/&author&/&name&/badge.svg
[coveralls-url]: https://coveralls.io/r/&author&/&name&

0 comments on commit fd49e16

Please sign in to comment.