Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #510 from dotnet/nbgvNpmBinScripts
Add node.js bin scripts to nb-gv NPM package
- Loading branch information
Showing
6 changed files
with
84 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
const nbgvPath = 'nbgv.cli'; | ||
|
||
export function getNbgvCommand(dotnetCommand?: string): string { | ||
var command = dotnetCommand || 'dotnet'; | ||
const nbgvDll = path.join(__dirname, nbgvPath, "tools", "netcoreapp2.1", "any", "nbgv.dll"); | ||
return `${command} "${nbgvDll}"`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
'use string'; | ||
#!/usr/bin/env node | ||
|
||
import * as lib from './index' | ||
'use strict'; | ||
|
||
async function printGitVersion() { | ||
try { | ||
console.log(await lib.getVersion()); | ||
} catch (err) { | ||
console.log('Failed to get version:'); | ||
console.log(err); | ||
} | ||
} | ||
import { getNbgvCommand } from "./core"; | ||
|
||
printGitVersion(); | ||
const { spawn } = require('child_process'); | ||
const { argv, exit } = require('process'); | ||
|
||
const cp = spawn(`${getNbgvCommand()} ${argv.slice(2).join(' ')}`, { shell: true, stdio: "inherit" }) | ||
cp.once('exit', code => exit(code)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env node | ||
|
||
import * as lib from './index' | ||
|
||
(async () => { | ||
if (process.argv[2] === '--reset') { | ||
await lib.resetPackageVersionPlaceholder(); | ||
} else { | ||
await lib.setPackageVersion(); | ||
} | ||
})(); |