Skip to content

Commit

Permalink
Rmove asking for projectUri
Browse files Browse the repository at this point in the history
As now package.json is static and don't need that info
  • Loading branch information
unional committed Mar 5, 2016
1 parent e4ed709 commit fcf1860
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 59 deletions.
42 changes: 6 additions & 36 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -181,21 +163,9 @@ module.exports = yeoman.Base.extend({
createTestFile() {
this.fs.write('test/test.ts',
['/// <reference path="../bundle.d.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`;
Expand Down Expand Up @@ -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 <source>')} to download the file`);
this.log(` you can run ${chalk.green('tsd install <source>') } 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!`);
}
}
Expand Down
25 changes: 2 additions & 23 deletions generators/app/templates/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit fcf1860

Please sign in to comment.