Skip to content

Commit be967eb

Browse files
cnussclaude
andcommitted
fix: only read package.json for frameworks being published
- Modified renameTok8sWeb to conditionally read package.json files - Modified revertNames to conditionally read package.json files - Fixes ENOENT error when publishing single framework This allows the publish script to work when only one framework is built (e.g., FRAMEWORK=angular), without requiring both dist folders to exist. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 2a27de6 commit be967eb

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

scripts/publish.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,37 @@ function writePackage(pkgPath, pkg) {
1717
}
1818

1919
function renameTok8sWeb(publishAngular, publishReact) {
20-
const angularPkg = readPackage(angularPkgPath);
21-
const reactPkg = readPackage(reactPkgPath);
20+
let angularPkg, reactPkg;
2221

2322
if (publishAngular) {
23+
angularPkg = readPackage(angularPkgPath);
2424
angularPkg.name = 'k8s-web';
2525
writePackage(angularPkgPath, angularPkg);
2626
}
2727

2828
if (publishReact) {
29+
reactPkg = readPackage(reactPkgPath);
2930
reactPkg.name = 'k8s-web';
3031
writePackage(reactPkgPath, reactPkg);
3132
}
3233

3334
return {
34-
angularVersion: angularPkg.version,
35-
reactVersion: reactPkg.version,
35+
angularVersion: angularPkg?.version,
36+
reactVersion: reactPkg?.version,
3637
originalAngularName: 'k8s-web-angular',
3738
originalReactName: 'k8s-web-react',
3839
};
3940
}
4041

4142
function revertNames(publishAngular, publishReact) {
42-
const angularPkg = readPackage(angularPkgPath);
43-
const reactPkg = readPackage(reactPkgPath);
44-
4543
if (publishAngular) {
44+
const angularPkg = readPackage(angularPkgPath);
4645
angularPkg.name = 'k8s-web-angular';
4746
writePackage(angularPkgPath, angularPkg);
4847
}
4948

5049
if (publishReact) {
50+
const reactPkg = readPackage(reactPkgPath);
5151
reactPkg.name = 'k8s-web-react';
5252
writePackage(reactPkgPath, reactPkg);
5353
}

0 commit comments

Comments
 (0)