Skip to content

Commit

Permalink
Added npm init command
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanhatcher committed Oct 11, 2018
1 parent 16cc461 commit 08c8134
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion package.json
Expand Up @@ -31,7 +31,8 @@
"onCommand:npm-script.terminate-script",
"onCommand:npm-script.test",
"onCommand:npm-script.start",
"onCommand:npm-script.audit"
"onCommand:npm-script.audit",
"onCommand:npm-script.init"
],
"main": "./out/src/main",
"contributes": {
Expand Down Expand Up @@ -80,6 +81,11 @@
"command": "npm-script.audit",
"title": "Run Audit",
"category": "npm"
},
{
"command": "npm-script.init",
"title": "Run Init",
"category": "npm"
}
],
"menus": {
Expand Down
5 changes: 5 additions & 0 deletions src/main.ts
Expand Up @@ -297,6 +297,7 @@ function validateAllDocuments() {
function registerCommands(context: ExtensionContext) {
context.subscriptions.push(
commands.registerCommand('npm-script.install', runNpmInstall),
commands.registerCommand('npm-script.init', runNpmInit),
commands.registerCommand('npm-script.test', runNpmTest),
commands.registerCommand('npm-script.start', runNpmStart),
commands.registerCommand('npm-script.run', runNpmScript),
Expand Down Expand Up @@ -472,6 +473,10 @@ function runNpmAudit() {
runNpmCommandInPackages(['audit'], true);
}

function runNpmInit() {
runNpmCommandInPackages(['init'], true);
}

function runNpmScript(): void {
runNpmCommandInPackages(['run-script'], false);
}
Expand Down

0 comments on commit 08c8134

Please sign in to comment.