From fcf1860a733dbbc4ee7f5b75c8559733220dfce6 Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Fri, 4 Mar 2016 22:54:55 -0800 Subject: [PATCH] Rmove asking for projectUri As now package.json is static and don't need that info --- generators/app/index.js | 42 ++++----------------------- generators/app/templates/package.json | 25 ++-------------- 2 files changed, 8 insertions(+), 59 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index ff7444b..2858841 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -18,25 +18,7 @@ var licenses = [ module.exports = yeoman.Base.extend({ prompting: { greeting() { - this.log(yosay('Welcome to the sensational ' + chalk.red('typings') + ' generator!')); - }, - projectUri() { - var done = this.async(); - var folder = path.basename(this.env.cwd); - var parentFolder = path.basename(path.dirname(this.env.cwd)); - - this.prompt({ - type: 'input', - name: 'projectUri', - message: `What will be the ${chalk.green('author/module') } for ${chalk.red('this typing') }?`, - default: () => `${parentFolder}/${folder}`, - validate: (value) => value.length > 0 && value.split('/').length === 2 - }, (props) => { - var parts = props.projectUri.split('/'); - this.organization = parts[0]; - this.packageName = parts[1]; - done(); - }); + this.log(yosay(`Welcome to the sensational ${chalk.red('typings')} generator!`)); }, sourceUri() { var done = this.async(); @@ -181,21 +163,9 @@ module.exports = yeoman.Base.extend({ createTestFile() { this.fs.write('test/test.ts', ['/// ', - '', - `import * as ${this.sourcePackageName} from '${this.sourcePackageName}';`, - ''].join('\n')); - }, - updatePackageJson() { - this.fs.copyTpl( - this.templatePath('template/package.json'), - this.destinationPath('package.json'), - { - username: this.username, - packageName: this.packageName, - sourcePackageName: this.sourcePackageName, - sourcePackageUrl: this.sourcePackageUrl, - organization: this.organization - }); + '', + `import * as ${this.sourcePackageName} from '${this.sourcePackageName}';`, + ''].join('\n')); }, createLICENSE() { var filename = `template/${this.license}.txt`; @@ -242,12 +212,12 @@ module.exports = yeoman.Base.extend({ tsdHint() { this.log(''); this.log('If there are DefinitelyType support for the source,'); - this.log(` you can run ${chalk.green('tsd install ')} to download the file`); + this.log(` you can run ${chalk.green('tsd install ') } to download the file`); this.log(' so you can easily access those code.'); }, readyToTest() { this.log(''); - this.log(`Run ${chalk.green('npm run build')} to update the definition for the test, and`); + this.log(`Run ${chalk.green('npm run build') } to update the definition for the test, and`); this.log(`Run ${chalk.green('npm test') } test your definition!`); } } diff --git a/generators/app/templates/package.json b/generators/app/templates/package.json index 2778ddb..3130ced 100644 --- a/generators/app/templates/package.json +++ b/generators/app/templates/package.json @@ -1,33 +1,12 @@ { - "name": "<%- packageName %>", - "description": "The type definition for <%- sourcePackageUrl %>", - "version": "0.0.1", - "author": "<%- username %>", - "license": "MIT", "scripts": { "build": "typings bundle . -o bundle.d.ts", "test": "ts-node test/test.ts" }, - "directories": { - "test": "test" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/<%- organization %>/<%- packageName %>.git" - }, - "homepage": "https://github.com/<%- organization %>/<%- packageName %>#readme", - "keywords": [ - "typings", - "typed", - "<%- sourcePackageName %>" - ], - "bugs": { - "url": "https://github.com/<%- organization %>/<%- packageName %>/issues" - }, - "dependencies": {}, + "private": true, "devDependencies": { "ts-node": "^0.5.5", "tslint": "^3.5.0", - "typescript": "^1.8.2" + "typescript": "^1.8.7" } } \ No newline at end of file