Skip to content

Commit 4723327

Browse files
authored
fix(ci): Convert before-beta-release script to ESM (#512)
1 parent 4154d45 commit 4723327

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/scripts/before-beta-release.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable no-console */
2-
const { execSync } = require('node:child_process');
3-
const fs = require('node:fs');
4-
const path = require('node:path');
2+
import { execSync } from 'node:child_process';
3+
import { writeFileSync } from 'node:fs';
4+
import { dirname, join } from 'node:path';
5+
import { fileURLToPath } from 'node:url';
56

6-
const PKG_JSON_PATH = path.join(__dirname, '..', '..', 'package.json');
7+
const PKG_JSON_PATH = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'package.json');
78

89
// eslint-disable-next-line import/no-dynamic-require
910
const pkgJson = require(PKG_JSON_PATH);
@@ -15,7 +16,7 @@ const nextVersion = addBetaSuffixToVersion(VERSION);
1516
console.log(`before-deploy: Setting version to ${nextVersion}`);
1617
pkgJson.version = nextVersion;
1718

18-
fs.writeFileSync(PKG_JSON_PATH, `${JSON.stringify(pkgJson, null, 2)}\n`);
19+
writeFileSync(PKG_JSON_PATH, `${JSON.stringify(pkgJson, null, 2)}\n`);
1920

2021
function addBetaSuffixToVersion(version) {
2122
const versionString = execSync(`npm show ${PACKAGE_NAME} versions --json`, { encoding: 'utf8' });

0 commit comments

Comments
 (0)