Skip to content

Commit

Permalink
chore: update release package script
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Dec 25, 2024
1 parent 9b4179c commit d76fcfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Release create-tnf package:
```bash
$ pnpm release:create-tnf
# or if you want to bump the version without changeset
$ pnpm release:create-tnf --bump
```
## Code Style
Expand Down
19 changes: 12 additions & 7 deletions scripts/releasePackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,31 @@ import 'zx/globals';

(async () => {
const pkg = argv.pkg;
const bump = argv.bump;
assert(pkg, 'pkg is required, specify with --pkg <pkg-name>');
const pkgDir = path.join(__dirname, '../', pkg);
assert(fs.existsSync(pkgDir), `pkg ${pkg} not found: ${pkgDir}`);

console.log('Building package...');
await $`cd ${pkgDir} && npm run build`;

// console.log('Bumping version...');
// const npmVersion = argv.minor ? 'minor' : 'patch';
// await $`cd ${pkgDir} && npm version ${npmVersion}`;
if (bump) {
console.log('Bumping version...');
const npmVersion = argv.minor ? 'minor' : 'patch';
await $`cd ${pkgDir} && npm version ${npmVersion}`;
}

console.log('Publishing package...');
await $`cd ${pkgDir} && npm publish`;

const newVersion = require(path.join(pkgDir, 'package.json')).version;

// console.log('Adding to git...');
// await $`pnpm install`;
// await $`git add ${pkgDir}`;
// await $`git commit -m "release: ${pkg}@${newVersion}" -n`;
if (bump) {
console.log('Adding to git...');
await $`pnpm install`;
await $`git add ${pkgDir}`;
await $`git commit -m "release: ${pkg}@${newVersion}" -n`;
}

console.log('Pushing to git...');
await $`git push`;
Expand Down

0 comments on commit d76fcfd

Please sign in to comment.