Skip to content

Commit

Permalink
chore: update release script
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Dec 26, 2024
1 parent fbe93b6 commit 7130fb8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import assert from 'assert';
import getGitRepoInfo from 'git-repo-info';
import path from 'path';
import { fileURLToPath } from 'url';
import 'zx/globals';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

(async () => {
const { branch } = getGitRepoInfo();

Expand All @@ -22,7 +27,7 @@ import 'zx/globals';
// const currentVersion = require('../package.json').version;
// console.log('current version', currentVersion);
// const version = await question('Enter the new version: ');
const pkg = require('../package.json');
const pkg = await import('../package.json');
const version = pkg.version;
// pkg.version = version;
// fs.writeFileSync(
Expand Down
10 changes: 9 additions & 1 deletion scripts/releasePackage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import assert from 'assert';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import 'zx/globals';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

(async () => {
const pkg = argv.pkg;
const bump = argv.bump;
Expand All @@ -20,7 +26,9 @@ import 'zx/globals';
console.log('Publishing package...');
await $`cd ${pkgDir} && npm publish`;

const newVersion = require(path.join(pkgDir, 'package.json')).version;
const newVersion = await import(path.join(pkgDir, 'package.json')).then(
(pkg) => pkg.version,
);

if (bump) {
console.log('Adding to git...');
Expand Down

0 comments on commit 7130fb8

Please sign in to comment.