refactor!: rename store to storeDir in .modules.yaml

This commit is contained in:
Zoltan Kochan
2020-05-09 23:32:06 +03:00
parent a2297f01e6
commit 3f73eaf0c7
9 changed files with 19 additions and 9 deletions

View File

@@ -0,0 +1,10 @@
---
"@pnpm/get-context": major
"@pnpm/headless": major
"@pnpm/modules-yaml": major
"@pnpm/plugin-commands-rebuild": major
"supi": minor
"@pnpm/assert-project": minor
---
Rename `store` to `storeDir` in `node_modules/.modules.yaml`.

View File

@@ -17,10 +17,10 @@ export default function checkCompatibility (
// is the only way to compare paths correctly on Windows
// as of Node.js 4-9
// See related issue: https://github.com/pnpm/pnpm/issues/996
if (path.relative(modules.store, opts.storeDir) !== '') {
if (path.relative(modules.storeDir, opts.storeDir) !== '') {
throw new UnexpectedStoreError({
actualStorePath: opts.storeDir,
expectedStorePath: modules.store,
expectedStorePath: modules.storeDir,
modulesDir: opts.modulesDir,
})
}

View File

@@ -345,7 +345,7 @@ export default async (opts: HeadlessOptions) => {
registries: opts.registries,
shamefullyHoist: opts.shamefullyHoist || false,
skipped: Array.from(skipped),
store: opts.storeDir,
storeDir: opts.storeDir,
virtualStoreDir,
})

View File

@@ -23,7 +23,7 @@ export interface Modules {
registries?: Registries, // nullable for backward compatibility
shamefullyHoist: boolean,
skipped: string[],
store: string,
storeDir: string,
virtualStoreDir: string,
}

View File

@@ -24,7 +24,7 @@ test('write() and read()', async (t) => {
},
shamefullyHoist: false,
skipped: [],
store: '/.pnpm-store',
storeDir: '/.pnpm-store',
virtualStoreDir: path.join(modulesDir, '.pnpm'),
}
await write(modulesDir, modulesYaml)

View File

@@ -182,7 +182,7 @@ export async function rebuild (
registries: ctx.registries,
shamefullyHoist: ctx.shamefullyHoist,
skipped: Array.from(ctx.skipped),
store: ctx.storeDir,
storeDir: ctx.storeDir,
virtualStoreDir: ctx.virtualStoreDir,
})
}

View File

@@ -842,7 +842,7 @@ async function installInContext (
registries: ctx.registries,
shamefullyHoist: ctx.shamefullyHoist,
skipped: Array.from(ctx.skipped),
store: ctx.storeDir,
storeDir: ctx.storeDir,
virtualStoreDir: ctx.virtualStoreDir,
})
})(),

View File

@@ -108,7 +108,7 @@ test('do not fail on non-compatible store when forced during named installation'
async function saveModulesYaml (pnpmVersion: string, storeDir: string) {
await fs.mkdir('node_modules')
await fs.writeFile('node_modules/.modules.yaml', `packageManager: pnpm@${pnpmVersion}\nstore: ${storeDir}\nindependentLeaves: false`)
await fs.writeFile('node_modules/.modules.yaml', `packageManager: pnpm@${pnpmVersion}\nstoreDir: ${storeDir}\nindependentLeaves: false`)
}
test(`fail on non-compatible ${WANTED_LOCKFILE}`, async (t: tape.Test) => {

View File

@@ -61,7 +61,7 @@ export default (t: Test, projectPath: string, encodedRegistryName?: string): Pro
if (!modulesYaml) {
throw new Error(`Cannot find module store. No .modules.yaml found at "${modules}"`)
}
const storePath = modulesYaml.store
const storePath = modulesYaml.storeDir
cachedStore = {
storePath,
...assertStore(t, storePath, ern),