mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-13 02:55:56 -04:00
fix: clean pnpm workspace state during ci (#11368)
Co-authored-by: cyphercodes <cyphercodes@users.noreply.github.com>
This commit is contained in:
committed by
Zoltan Kochan
parent
bf4214eb55
commit
32eae3112f
5
pnpm/.changeset/clean-ci-workspace-state.md
Normal file
5
pnpm/.changeset/clean-ci-workspace-state.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Remove pnpm's workspace state file when cleaning node_modules so `pnpm ci` performs a fresh install after the clean step.
|
||||
@@ -103,7 +103,7 @@ async function cleanProjectDir (opts: { modulesDir: string, removeLockfile?: boo
|
||||
}
|
||||
}
|
||||
|
||||
const PNPM_HIDDEN_ENTRIES = new Set(['.bin', '.modules.yaml', '.pnpm'])
|
||||
const PNPM_HIDDEN_ENTRIES = new Set(['.bin', '.modules.yaml', '.pnpm', '.pnpm-workspace-state-v1.json'])
|
||||
|
||||
async function hasContentsToRemove (modulesDir: string): Promise<boolean> {
|
||||
let items: string[]
|
||||
|
||||
@@ -20,6 +20,7 @@ test('pnpm clean removes pnpm entries and packages but preserves non-pnpm hidden
|
||||
fs.mkdirSync('node_modules/.pnpm', { recursive: true })
|
||||
fs.mkdirSync('node_modules/.bin')
|
||||
fs.writeFileSync('node_modules/.modules.yaml', 'storeDir: /tmp/store')
|
||||
fs.writeFileSync('node_modules/.pnpm-workspace-state-v1.json', '{}')
|
||||
fs.mkdirSync('node_modules/.cache')
|
||||
fs.writeFileSync('node_modules/.cache/some-file', 'cached')
|
||||
fs.mkdirSync('node_modules/lodash')
|
||||
@@ -34,6 +35,7 @@ test('pnpm clean removes pnpm entries and packages but preserves non-pnpm hidden
|
||||
expect(fs.existsSync('node_modules/.pnpm')).toBe(false)
|
||||
expect(fs.existsSync('node_modules/.bin')).toBe(false)
|
||||
expect(fs.existsSync('node_modules/.modules.yaml')).toBe(false)
|
||||
expect(fs.existsSync('node_modules/.pnpm-workspace-state-v1.json')).toBe(false)
|
||||
|
||||
// Regular packages should be removed
|
||||
expect(fs.existsSync('node_modules/lodash')).toBe(false)
|
||||
|
||||
Reference in New Issue
Block a user