Skip to content

Commit 64ddb58

Browse files
feat: use utils
1 parent 4b0e635 commit 64ddb58

File tree

5 files changed

+12
-37
lines changed

5 files changed

+12
-37
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@dfinity/identity": "^2.3.0",
3232
"@dfinity/principal": "^2.3.0",
3333
"@junobuild/admin": "^0.1.6",
34-
"@junobuild/cli-tools": "^0.1.6",
34+
"@junobuild/cli-tools": "^0.1.7",
3535
"@junobuild/config-loader": "^0.2.0",
3636
"@junobuild/core": "^0.1.9",
3737
"@junobuild/did-tools": "^0.2.0",

src/services/build/build.javascript.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {isEmptyString, isNullish, notEmptyString} from '@dfinity/utils';
2-
import {buildEsm, execute} from '@junobuild/cli-tools';
2+
import {buildEsm, execute, type PackageJson} from '@junobuild/cli-tools';
33
import type {Metafile} from 'esbuild';
44
import {green, magenta, red, yellow} from 'kleur';
55
import {existsSync} from 'node:fs';
@@ -15,7 +15,6 @@ import {
1515
PACKAGE_JSON_SPUTNIK_PATH
1616
} from '../../constants/dev.constants';
1717
import type {BuildArgs, BuildLang} from '../../types/build';
18-
import type {PackageJson} from '../../types/pkg';
1918
import {formatBytes, formatTime} from '../../utils/format.utils';
2019
import {readPackageJson} from '../../utils/pkg.utils';
2120
import {detectPackageManager} from '../../utils/pm.utils';

src/types/pkg.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/utils/pkg.utils.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
import {readFile} from 'node:fs/promises';
1+
import {type PackageJson, readPackageJson as readPackageJsonUtils} from '@junobuild/cli-tools';
22
import {PACKAGE_JSON_PATH} from '../constants/dev.constants';
3-
import type {PackageJson} from '../types/pkg';
43

5-
export const readPackageJson = async (): Promise<PackageJson> => {
6-
const packageJson = await readFile(PACKAGE_JSON_PATH, 'utf-8');
7-
8-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
9-
const {dependencies, version, juno} = JSON.parse(packageJson) as PackageJson;
10-
11-
return {
12-
dependencies,
13-
version,
14-
juno
15-
};
16-
};
4+
export const readPackageJson = async (): Promise<PackageJson> =>
5+
await readPackageJsonUtils({packageJsonPath: PACKAGE_JSON_PATH});

0 commit comments

Comments
 (0)