Skip to content

Commit a0e38df

Browse files
Seungwoo321claude
andcommitted
fix: improve release script to prevent unwanted package updates
- Replace changesets publish with npm publish for independent package releases - Add version checking to prevent duplicate publishes - Fix working directory context for each package publish - Resolve issue where all packages were updated simultaneously due to changesets dependency management 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fc5e85f commit a0e38df

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

scripts/release-packages.cjs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ const packages = [
3030
name: 'vue3-pivottable',
3131
path: '.',
3232
buildCmd: 'pnpm clean && pnpm build',
33-
publishCmd: `pnpm changeset publish --tag ${releaseTag}`
33+
publishCmd: `npm publish --tag ${releaseTag}`
3434
},
3535
{
3636
name: '@vue-pivottable/plotly-renderer',
3737
path: './packages/plotly-renderer',
3838
buildCmd: 'pnpm --filter @vue-pivottable/plotly-renderer clean && pnpm --filter @vue-pivottable/plotly-renderer build',
39-
publishCmd: `pnpm changeset publish --filter @vue-pivottable/plotly-renderer --tag ${releaseTag}`,
39+
publishCmd: `npm publish --tag ${releaseTag}`,
4040
tokenEnv: 'NPM_TOKEN_SUMIN'
4141
},
4242
{
4343
name: '@vue-pivottable/lazy-table-renderer',
4444
path: './packages/lazy-table-renderer',
4545
buildCmd: 'pnpm --filter @vue-pivottable/lazy-table-renderer clean && pnpm --filter @vue-pivottable/lazy-table-renderer build',
46-
publishCmd: `pnpm changeset publish --filter @vue-pivottable/lazy-table-renderer --tag ${releaseTag}`,
46+
publishCmd: `npm publish --tag ${releaseTag}`,
4747
tokenEnv: 'NPM_TOKEN_SUMIN'
4848
}
4949
];
@@ -77,6 +77,17 @@ async function releasePackages() {
7777
continue;
7878
}
7979

80+
// Check if this version is already published
81+
try {
82+
const npmViewCmd = `npm view ${packageJson.name}@${currentVersion} version`;
83+
execSync(npmViewCmd, { stdio: 'pipe' });
84+
log.info(`Skipping ${pkg.name} - version ${currentVersion} already published`);
85+
continue;
86+
} catch (error) {
87+
// Version not published, continue with publishing
88+
log.info(`${pkg.name}@${currentVersion} not found on npm, proceeding with publish`);
89+
}
90+
8091
// Build package
8192
log.info(`Building ${pkg.name}...`);
8293
execSync(pkg.buildCmd, {
@@ -94,7 +105,7 @@ async function releasePackages() {
94105
log.info(`Publishing ${pkg.name}...`);
95106
execSync(pkg.publishCmd, {
96107
stdio: 'inherit',
97-
cwd: process.cwd(),
108+
cwd: pkg.path,
98109
env: process.env
99110
});
100111

0 commit comments

Comments
 (0)