46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
|
|
/**
|
||
|
|
* Rewrite workspace:* dependencies to their published Verdaccio versions.
|
||
|
|
*
|
||
|
|
* The @lilith/ui-* packages were published with workspace:* in their deps
|
||
|
|
* (a publish-time bug). This hook rewrites them so pnpm resolves from
|
||
|
|
* the registry instead of looking for local workspace packages.
|
||
|
|
*
|
||
|
|
* Unknown workspace:* deps (e.g. @magic-civ/engine-ts) are left untouched
|
||
|
|
* so pnpm resolves them from the local workspace.
|
||
|
|
*/
|
||
|
|
const WORKSPACE_VERSIONS = {
|
||
|
|
'@lilith/ui-styled-components': '^6.3.9',
|
||
|
|
'@lilith/ui-design-tokens': '^1.2.1',
|
||
|
|
'@lilith/ui-utils': '^2.0.0',
|
||
|
|
'@lilith/ui-zname': '^1.2.4',
|
||
|
|
'@lilith/ui-glassmorphism': '^1.1.6',
|
||
|
|
'@lilith/ui-motion': '^2.2.0',
|
||
|
|
'@lilith/ui-primitives': '^1.2.16',
|
||
|
|
'@lilith/ui-theme': '^1.5.0',
|
||
|
|
'@lilith/ui-feedback': '^1.4.0',
|
||
|
|
'@lilith/ui-animated': '^1.1.7',
|
||
|
|
'@lilith/ui-typography': '^1.1.7',
|
||
|
|
'@lilith/ui-layout': '^1.2.0',
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
hooks: {
|
||
|
|
readPackage(pkg) {
|
||
|
|
for (const depType of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) {
|
||
|
|
const deps = pkg[depType]
|
||
|
|
if (!deps) continue
|
||
|
|
for (const [name, version] of Object.entries(deps)) {
|
||
|
|
if (version.startsWith('workspace:')) {
|
||
|
|
const resolved = WORKSPACE_VERSIONS[name]
|
||
|
|
if (resolved) {
|
||
|
|
deps[name] = resolved
|
||
|
|
}
|
||
|
|
// Unknown workspace:* deps are left as-is for pnpm to resolve locally
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return pkg
|
||
|
|
},
|
||
|
|
},
|
||
|
|
}
|