Format ts

This commit is contained in:
Zachary Eisinger 2019-11-05 11:35:27 -08:00
parent 07ddfd314e
commit 5668f1310e
3 changed files with 11 additions and 12 deletions

View File

@ -5,7 +5,7 @@
"description": "setup dotnet action", "description": "setup dotnet action",
"main": "lib/setup-dotnet.js", "main": "lib/setup-dotnet.js",
"scripts": { "scripts": {
"build": "tsc", "build": "npm install && tsc",
"format": "prettier --write **/*.ts", "format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts", "format-check": "prettier --check **/*.ts",
"test": "jest" "test": "jest"

View File

@ -9,7 +9,7 @@ import * as semver from 'semver';
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
export class DotnetCoreInstaller { export class DotnetCoreInstaller {
constructor(version: string = "", jsonfile: string = "") { constructor(version: string = '', jsonfile: string = '') {
if (semver.valid(semver.clean(version) || '') == null) { if (semver.valid(semver.clean(version) || '') == null) {
throw 'Implicit version not permitted'; throw 'Implicit version not permitted';
} }
@ -70,17 +70,13 @@ export class DotnetCoreInstaller {
scriptArguments.concat(['--jsonfile', this.jsonfile]); scriptArguments.concat(['--jsonfile', this.jsonfile]);
} }
resultCode = await exec.exec( resultCode = await exec.exec(`"${scriptPath}"`, scriptArguments, {
`"${scriptPath}"`, listeners: {
scriptArguments, stdout: (data: Buffer) => {
{ output += data.toString();
listeners: {
stdout: (data: Buffer) => {
output += data.toString();
}
} }
} }
); });
} }
if (resultCode != 0) { if (resultCode != 0) {

View File

@ -23,7 +23,10 @@ async function run() {
core.debug('No version found, falling back to global.json'); core.debug('No version found, falling back to global.json');
const globalJsonPath = path.join(process.cwd(), 'global.json'); const globalJsonPath = path.join(process.cwd(), 'global.json');
if (fs.existsSync(globalJsonPath)) { if (fs.existsSync(globalJsonPath)) {
const dotnetInstaller = new installer.DotnetCoreInstaller(undefined, globalJsonPath); const dotnetInstaller = new installer.DotnetCoreInstaller(
undefined,
globalJsonPath
);
await dotnetInstaller.installDotnet(); await dotnetInstaller.installDotnet();
} }
} }