Skip to content

Commit 5925f9c

Browse files
fix: package version command read json
1 parent da37c2a commit 5925f9c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/commands/package-version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { program } from '../command.js';
99
* Get package version from package.json
1010
* NOTE: used in CI/CD
1111
*/
12-
const runOutputPackageVersion = (workDir = '.') => {
12+
const runOutputPackageVersion = async (workDir = '.') => {
1313
const packageJson = path.resolve(`${workDir}/package.json`);
1414

1515
if (!fs.existsSync(packageJson)) {
@@ -20,7 +20,7 @@ const runOutputPackageVersion = (workDir = '.') => {
2020
return github.setFailed(`Action failed with error ${error}`);
2121
}
2222

23-
const version = require(packageJson).version;
23+
const { version } = (await import(packageJson, { assert: { type: 'json' } })).default;
2424

2525
console.log(`Version package: ${chalk.green(version)}`);
2626
github.setOutput('version', version);

0 commit comments

Comments
 (0)