Skip to content

Commit 3eea1af

Browse files
committed
Remove unused registry version helpers
Remove resolveSiblingVersions(), siblingVersions, and depSpec() which were defined but never called. DEP_SPECS already uses installableDependencySpec() which performs the same workspace: version resolution.
1 parent 5fd1aec commit 3eea1af

1 file changed

Lines changed: 0 additions & 25 deletions

File tree

‎packages/shadcn/scripts/build-registry.mjs‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,6 @@ const SCHEMA = 'https://ui.shadcn.com/schema/registry-item.json';
1919

2020
const pkg = JSON.parse(await readFile(join(PKG_ROOT, 'package.json'), 'utf8'));
2121

22-
// Siblings are declared as `workspace:*`, a protocol that means nothing to a
23-
// consumer installing from npm, so resolve it to the sibling's current version:
24-
// the same substitution `pnpm pack` makes in the published manifest.
25-
async function resolveSiblingVersions() {
26-
const versions = new Map();
27-
for (const entry of await readdir(join(PKG_ROOT, '..'), { withFileTypes: true })) {
28-
if (!entry.isDirectory()) continue;
29-
const manifestPath = join(PKG_ROOT, '..', entry.name, 'package.json');
30-
if (!existsSync(manifestPath)) continue;
31-
const manifest = JSON.parse(await readFile(manifestPath, 'utf8'));
32-
if (manifest.name) versions.set(manifest.name, manifest.version);
33-
}
34-
return versions;
35-
}
36-
37-
const siblingVersions = await resolveSiblingVersions();
38-
39-
function depSpec(name, range) {
40-
if (!name.startsWith('@octanejs/')) return name;
41-
if (!range.startsWith('workspace:')) return `${name}@${range}`;
42-
const version = siblingVersions.get(name);
43-
if (!version) throw new Error(`registry: cannot resolve the workspace version of "${name}"`);
44-
return `${name}@${version}`;
45-
}
46-
4722
// Installable dependency spec per import, derived from package.json so a new
4823
// import can never silently ship without its dependency: @octanejs/* siblings
4924
// pinned to the exact tested version (maintainer pinning policy), public npm

0 commit comments

Comments
 (0)