Skip to content

Commit d14b5dd

Browse files
committed
chore: simplify Angular release script
1 parent 25f340f commit d14b5dd

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

frameworks/angular-slickgrid/scripts/replace-workspace.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { dirname as pDirname, join as pJoin, resolve as pResolve } from 'node:path';
1+
import { dirname, join, resolve } from 'node:path';
22
import { fileURLToPath } from 'node:url';
33

44
import { readJsonSync, writeJsonSync } from '@gc-utils/fs-extra';
55

66
const __filename = fileURLToPath(import.meta.url);
7-
const __dirname = pDirname(__filename);
8-
const projectRootPath = pJoin(__dirname, '../');
7+
const __dirname = dirname(__filename);
8+
const projectRootPath = join(__dirname, '../');
99

1010
/**
1111
* Main entry, this script will replace all workspace protocol
1212
* with current version from "package.json" root into "dist/package.json"
1313
*/
1414
(async function main() {
15-
const mainPkg = readJsonSync(pJoin(projectRootPath, 'package.json'));
16-
const distPkg = readJsonSync(pJoin(projectRootPath, 'dist', 'package.json'));
15+
const mainPkg = readJsonSync(join(projectRootPath, 'package.json'));
16+
const distPkg = readJsonSync(join(projectRootPath, 'dist', 'package.json'));
1717

1818
// replace all workspace protocol with current version from "package.json" root into "dist/package.json"
1919
console.log('-------------------------------------------------------------------------------------');
@@ -26,12 +26,12 @@ const projectRootPath = pJoin(__dirname, '../');
2626
if (depName.startsWith('@slickgrid-universal/') || depVersion.startsWith('workspace:')) {
2727
// we need to get each package version
2828
const depPkgName = depName.replace('@slickgrid-universal', '');
29-
const depPkg = readJsonSync(pJoin(projectRootPath, '../../packages/', depPkgName, 'package.json'));
29+
const depPkg = readJsonSync(join(projectRootPath, '../../packages/', depPkgName, 'package.json'));
3030
console.log(`update dependency { "${depName}": "${depPkg.version}" }`);
3131
distPkg.dependencies[depName] = depPkg.version;
3232
}
3333
}
34-
writeJsonSync(pResolve(projectRootPath, 'dist', 'package.json'), distPkg, { spaces: 2 });
34+
writeJsonSync(resolve(projectRootPath, 'dist', 'package.json'), distPkg, { spaces: 2 });
3535
console.log('-------------------------------------------------------------------------------------\n');
3636

3737
process.exit();

0 commit comments

Comments
 (0)