|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | | -import * as fs from 'fs'; |
4 | | -import * as path from 'path'; |
5 | 3 | import * as camelCase from 'camel-case'; |
6 | | -import {execAsync} from './asyncprocess'; |
7 | | - |
8 | | -const nbgvPath = 'nbgv.cli'; |
| 4 | +import { execAsync } from './asyncprocess'; |
| 5 | +import { getNbgvCommand } from './core'; |
9 | 6 |
|
10 | 7 | /** |
11 | 8 | * The various aspects of a version that can be calculated. |
@@ -43,9 +40,7 @@ export interface IGitVersion { |
43 | 40 | */ |
44 | 41 | export async function getVersion(projectDirectory?: string, dotnetCommand?: string): Promise<IGitVersion> { |
45 | 42 | projectDirectory = projectDirectory || '.'; |
46 | | - var command = dotnetCommand || 'dotnet'; |
47 | | - var getVersionScriptPath = path.join(__dirname, nbgvPath, "tools", "netcoreapp2.1", "any", "nbgv.dll"); |
48 | | - var versionText = await execAsync(`${command} "${getVersionScriptPath}" get-version --format json`, { cwd: projectDirectory }) |
| 43 | + var versionText = await execAsync(`${getNbgvCommand(dotnetCommand)} get-version --format json`, { cwd: projectDirectory }) |
49 | 44 | if (versionText.stderr) { |
50 | 45 | throw versionText.stderr; |
51 | 46 | } |
@@ -83,7 +78,7 @@ export async function setPackageVersion(packageDirectory?: string, srcDirectory? |
83 | 78 | */ |
84 | 79 | export async function resetPackageVersionPlaceholder(srcDirectory?: string) { |
85 | 80 | srcDirectory = srcDirectory || '.'; |
86 | | - var result = await execAsync(`npm version 0.0.0-placeholder`, { cwd: srcDirectory }); |
| 81 | + var result = await execAsync(`npm version 0.0.0-placeholder --no-git-tag-version --allow-same-version`, { cwd: srcDirectory }); |
87 | 82 | if (result.stderr) { |
88 | 83 | console.log(result.stderr); |
89 | 84 | } |
|
0 commit comments