Skip to content

Commit

Permalink
Merge pull request #10 from Polymer/init
Browse files Browse the repository at this point in the history
Add init command
  • Loading branch information
justinfagnani committed Mar 3, 2016
2 parents 95cd391 + 23305ac commit 5578e46
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"command-line-commands": "^0.1.2",
"polylint": "^2.10.0",
"polyserve": "^0.7.1",
"web-component-tester": "^4.2.0"
"web-component-tester": "^4.2.0",
"yeoman-environment": "^1.5.2",
},
"devDependencies": {
"typescript": "^1.8.0"
Expand Down
19 changes: 19 additions & 0 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {Command} from './command';
import * as YeomanEnvironment from 'yeoman-environment';
import * as PolymerInit from 'generator-polymer-init/generators/app';

export class InitCommand implements Command {
name = 'init';

description = 'Initializes a Polymer project';

args = [];

run(options): Promise<any> {
return new Promise((resolve, reject) => {
let env = new YeomanEnvironment();
env.register(require.resolve('generator-polymer-init'), 'polymer-init:app');
env.run('polymer-init', {}, () => resolve());
});
}
}
2 changes: 2 additions & 0 deletions src/polytool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import * as commandLineCommands from 'command-line-commands';
import {HelpCommand} from './commands/help';
import {InitCommand} from './commands/init';
import {LintCommand} from './commands/lint';
import {ServeCommand} from './commands/serve';
import {TestCommand} from './commands/test';
Expand All @@ -15,6 +16,7 @@ export class Polytool {

constructor() {
this.addCommand(new HelpCommand(this.commands));
this.addCommand(new InitCommand());
this.addCommand(new LintCommand());
this.addCommand(new ServeCommand());
this.addCommand(new TestCommand());
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"files": [
"src/commands/command.ts",
"src/commands/help.ts",
"src/commands/init.ts",
"src/commands/lint.ts",
"src/commands/serve.ts",
"src/commands/test.ts",
Expand Down

0 comments on commit 5578e46

Please sign in to comment.