@nx-dotnet/dotnet
Version:
This library was generated with [Nx](https://nx.dev).
43 lines • 1.16 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.dotnetFactory = dotnetFactory;
exports.mockDotnetFactory = mockDotnetFactory;
const child_process_1 = require("child_process");
/**
* get CLI command line runner
*
* @export
* @returns {({
* command: string,
* info: {
* global: boolean,
* version: string | number
* }
* })}
*/
function dotnetFactory() {
// return the command line for local or global dotnet
// check if dotnet is installed
try {
const version = (0, child_process_1.execSync)('dotnet --version', { windowsHide: true })
.toString('utf-8')
.trim();
return {
command: 'dotnet',
info: {
global: true,
version,
},
};
}
catch (e) {
throw new Error('dotnet not installed. Local support not yet added https://github.com/AgentEnder/nx-dotnet/issues/3');
}
}
function mockDotnetFactory(version) {
return {
command: 'echo',
info: { global: true, version: version ?? '6.0.100' },
};
}
//# sourceMappingURL=dotnet.factory.js.map
;