This is a fix to pnpm deployment which needs testing as the final part of origin/master release No functional changes * fix(docs): remove stray tool-call tags breaking the MDX build platform/docs/docs/migration-guide/3p12-to-3p13/build-tooling.md ended with two orphan closing tags (leftover tool-call serialization artifacts): </content> </invoke> Docusaurus compiles Markdown as MDX (JSX-aware), so the orphan closing tag failed the docs build: MDX compilation failed ... Unexpected closing slash in tag, expected an open tag first (build-tooling.md line 402) This was the remaining blocker for build-and-deploy-docs once the --no-frozen-lockfile change let the install step succeed. A scan of the docs tree found no other such artifacts. Verified locally: docusaurus build now generates static files with no MDX errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Update lockfile and avoid freshness check on every command * fix(release): keep workspace:* in the repo, concretize only at publish The release flow rewrote internal @ohif/* dependency specifiers to the concrete version and committed them, so pnpm-lock.yaml (which records workspace links) drifted from the manifests on every version bump. The resulting ERR_PNPM_OUTDATED_LOCKFILE broke every frozen install: Netlify (viewer-dev), the docs deploy, pnpm's pre-run deps check, and post-merge installs. Keep workspace:* everywhere in the committed repo and move the concrete-version substitution to publish time only: - publish-version.mjs: bump each package's own `version` field only; stop rewriting @ohif/* dependency/peerDependency specifiers. - publish-package.mjs: publish with `pnpm publish --no-git-checks` instead of `npm publish`. pnpm rewrites workspace:* to the exact version in the published tarball; npm would publish the literal "workspace:*", which npm/yarn consumers cannot resolve. - One-time: revert the 25 workspace manifests' @ohif/* specifiers to workspace:* (version fields untouched) and regenerate pnpm-lock.yaml to match. Because internal deps are workspace:* (links, not versions in the lockfile), version bumps no longer change pnpm-lock.yaml, so it stays in sync and frozen installs keep working. Verified: `pnpm install --frozen-lockfile` passes, and `pnpm pack` of @ohif/core emits a tarball whose @ohif/ui dependency is the exact version (3.13.0-beta.92), not workspace:*. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(ci): correct build-docs install comment for workspace:* release flow publish-version.mjs no longer rewrites @ohif/* deps to concrete versions, so the old comment was stale. Internal deps stay workspace:* and the lockfile stays consistent; pnpm publish concretizes only the published tarball. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci(docs): use --frozen-lockfile now that the lockfile no longer drifts With internal deps as workspace:* the lockfile stays in sync across version bumps, so the docs deploy can install frozen -- failing fast on genuine lockfile drift instead of silently reconciling. The --no-frozen-lockfile workaround is no longer needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci: use --frozen-lockfile in CI install steps now that the lockfile is stable Internal @ohif/* deps are workspace:* so pnpm-lock.yaml no longer drifts; the UNIT_TESTS/BUILD/NPM_PUBLISH installs can run frozen and fail fast on genuine drift. Kept --no-frozen-lockfile only where it is still required: the Dockerfile (platform/docs is excluded from the build context) and the playwright CS3D-version step (mutates @cornerstonejs versions before installing). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test: stability of seg load mpr test * Better drag fix for crosshairs --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
90 lines
3.4 KiB
JavaScript
90 lines
3.4 KiB
JavaScript
import { execa } from 'execa';
|
|
import fs from 'fs/promises';
|
|
import glob from 'glob';
|
|
import path from 'path';
|
|
|
|
async function run() {
|
|
const { stdout: branchName } = await execa('git', ['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
console.log('Current branch:', branchName);
|
|
|
|
// read the current version from ./version.txt
|
|
const nextVersion = (await fs.readFile('./version.txt', 'utf-8')).trim();
|
|
const packages = ['extensions/*', 'platform/*', 'modes/*'];
|
|
|
|
// Track only the files this script writes, so the release commit stages
|
|
// exactly the version bump and never sweeps in unrelated local edits or
|
|
// generated artifacts via `git add -A`.
|
|
const updatedFiles = [];
|
|
|
|
// For each package's package.json file, update:
|
|
// 1. The package version
|
|
// 2. Any @ohif/* peerDependencies to the next version
|
|
// 3. Any @ohif/* dependencies to the next version
|
|
|
|
for (const packagePathPattern of packages) {
|
|
const matchingDirectories = glob.sync(packagePathPattern);
|
|
|
|
for (const packageDirectory of matchingDirectories) {
|
|
const packageJsonPath = path.join(packageDirectory, 'package.json');
|
|
|
|
try {
|
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
|
|
|
|
// Bump only the package's own version. Internal @ohif/* references stay
|
|
// as workspace:* in the committed manifests (and therefore the lockfile,
|
|
// which records them as links), so pnpm-lock.yaml never drifts on a
|
|
// version bump and frozen installs keep working. pnpm publish rewrites
|
|
// workspace:* to the exact version in the published tarball only.
|
|
packageJson.version = nextVersion;
|
|
|
|
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
|
|
updatedFiles.push(packageJsonPath);
|
|
|
|
console.log(`Updated ${packageJsonPath}`);
|
|
} catch (err) {
|
|
console.log("ERROR: Couldn't find package.json in", packageDirectory);
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Update root package.json version
|
|
const rootPackageJson = JSON.parse(await fs.readFile('package.json', 'utf-8'));
|
|
rootPackageJson.version = nextVersion;
|
|
await fs.writeFile('package.json', JSON.stringify(rootPackageJson, null, 2) + '\n');
|
|
updatedFiles.push('package.json');
|
|
console.log('Updated root package.json');
|
|
|
|
// NOTE: Do not delete .npmrc here. It is tracked and holds pnpm workspace
|
|
// config (node-linker, workspace linking) with no npm credentials, so
|
|
// removing it would commit the loss of needed install config. This script
|
|
// does not publish, so there is no accidental-publish risk to guard against.
|
|
|
|
console.log('Setting the version...');
|
|
|
|
// Stage only the package.json files this script updated, so the release
|
|
// commit is deterministic and doesn't pick up unrelated worktree changes.
|
|
await execa('git', ['add', '--', ...updatedFiles]);
|
|
|
|
// Create the version commit
|
|
const commitMessage = `chore(version): Update package versions to ${nextVersion} [skip ci]`;
|
|
await execa('git', ['commit', '-m', commitMessage]);
|
|
|
|
// Create the version tag
|
|
const tagName = `v${nextVersion}`;
|
|
await execa('git', ['tag', '-f', tagName]);
|
|
|
|
console.log('Pushing changes...');
|
|
await execa('git', ['push', 'origin', branchName]);
|
|
|
|
console.log('Pushing tag...');
|
|
await execa('git', ['push', 'origin', tagName]);
|
|
|
|
console.log('Version set successfully');
|
|
}
|
|
|
|
run().catch(err => {
|
|
console.error('Error encountered during version bump:', err);
|
|
process.exit(1);
|
|
});
|