Skip to content

Commit e6befd2

Browse files
committed
refactor: 💡 extract log logic to main
1 parent bfe0276 commit e6befd2

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ async function run(): Promise<void> {
1313
const filePath: string = core.getInput('file_path');
1414
core.debug(`merging found dependencies with file ${filePath}`);
1515

16-
await overrideAngularVersions(versions, filePath);
16+
const modified = overrideAngularVersions(versions, filePath);
17+
18+
core.debug(
19+
`Depedencies merge in package.json: \n ${JSON.stringify(
20+
modified,
21+
null,
22+
2
23+
)}`
24+
);
1725

1826
core.debug(new Date().toTimeString());
1927
} catch (error) {

src/override-angular-versions.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
import {PackageJsonVersion} from './types/package-json-version';
22
import * as fs from 'fs';
3-
import * as core from '@actions/core';
43

5-
export async function overrideAngularVersions(
4+
export function overrideAngularVersions(
65
angularVersions: PackageJsonVersion,
76
path: string
8-
): Promise<void> {
7+
): PackageJsonVersion {
98
const rawData = fs.readFileSync(path);
109
let packageJson: PackageJsonVersion = JSON.parse(rawData.toString());
1110
packageJson = {...packageJson, ...angularVersions};
12-
core.debug(
13-
`Depedencies merge in package.json: \n ${JSON.stringify(
14-
packageJson,
15-
null,
16-
2
17-
)}`
18-
);
11+
1912
fs.writeFileSync(path, JSON.stringify(packageJson));
13+
14+
return packageJson;
2015
}

0 commit comments

Comments
 (0)