mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-27 18:46:18 -04:00
* refactor: extract rebuild implementation into @pnpm/building.after-install Move the rebuild implementation (rebuildProjects, rebuildSelectedPkgs) from @pnpm/plugin-commands-rebuild into a new @pnpm/building.after-install package. This breaks the circular dependency chain: config/deps-installer → core → plugin-commands-rebuild → cli-utils → config/deps-installer The CLI command layer stays in plugin-commands-rebuild, while the core rebuild logic now lives in building/after-install with no dependency on cli-utils. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add README for @pnpm/building.after-install Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: rename @pnpm/builder.policy to @pnpm/building.policy Move builder/policy to building/policy, consolidating all build-related packages under the building/ domain. Update all consumers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add changeset * refactor: remove old implementation files from plugin-commands-rebuild These files were copied to @pnpm/building.after-install but not removed from the original location. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: remove unused deps from plugin-commands-rebuild Dependencies that were only needed by the implementation (now in @pnpm/building.after-install) are removed. Deps used only in tests are moved to devDependencies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { createAllowBuildFunction } from '@pnpm/building.policy'
|
|
|
|
it('should allowBuilds with true value', () => {
|
|
const allowBuild = createAllowBuildFunction({
|
|
allowBuilds: { foo: true, 'qar@1.0.0 || 2.0.0': true },
|
|
})
|
|
expect(typeof allowBuild).toBe('function')
|
|
expect(allowBuild!('foo', '1.0.0')).toBe(true)
|
|
expect(allowBuild!('bar', '1.0.0')).toBeUndefined()
|
|
expect(allowBuild!('qar', '1.1.0')).toBeUndefined()
|
|
expect(allowBuild!('qar', '1.0.0')).toBe(true)
|
|
expect(allowBuild!('qar', '2.0.0')).toBe(true)
|
|
})
|
|
|
|
it('should allowBuilds with false value', () => {
|
|
const allowBuild = createAllowBuildFunction({
|
|
allowBuilds: { foo: false, bar: true },
|
|
})
|
|
expect(typeof allowBuild).toBe('function')
|
|
expect(allowBuild!('foo', '1.0.0')).toBe(false)
|
|
expect(allowBuild!('bar', '1.0.0')).toBe(true)
|
|
expect(allowBuild!('baz', '1.0.0')).toBeUndefined()
|
|
})
|
|
|
|
it('should not allow patterns in allowBuilds', () => {
|
|
const allowBuild = createAllowBuildFunction({
|
|
allowBuilds: { 'is-*': true },
|
|
})
|
|
expect(typeof allowBuild).toBe('function')
|
|
expect(allowBuild!('is-odd', '1.0.0')).toBeUndefined()
|
|
})
|
|
|
|
it('should return undefined if no policy is set', () => {
|
|
expect(createAllowBuildFunction({})).toBeUndefined()
|
|
})
|
|
|
|
it('should allow everything when dangerouslyAllowAllBuilds is true', () => {
|
|
const allowBuild = createAllowBuildFunction({
|
|
dangerouslyAllowAllBuilds: true,
|
|
})
|
|
expect(typeof allowBuild).toBe('function')
|
|
expect(allowBuild!('foo', '1.0.0')).toBeTruthy()
|
|
})
|