From 3f73eaf0c7dd66bc9b67e79a2f7f46ddf69673c3 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Sat, 9 May 2020 23:32:06 +0300 Subject: [PATCH] refactor!: rename store to storeDir in `.modules.yaml` --- .changeset/heavy-ghosts-doubt.md | 10 ++++++++++ packages/get-context/src/checkCompatibility/index.ts | 4 ++-- packages/headless/src/index.ts | 2 +- packages/modules-yaml/src/index.ts | 2 +- packages/modules-yaml/test/index.ts | 2 +- .../src/implementation/index.ts | 2 +- packages/supi/src/install/index.ts | 2 +- packages/supi/test/breakingChanges.ts | 2 +- privatePackages/assert-project/src/index.ts | 2 +- 9 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .changeset/heavy-ghosts-doubt.md diff --git a/.changeset/heavy-ghosts-doubt.md b/.changeset/heavy-ghosts-doubt.md new file mode 100644 index 0000000000..eda722f826 --- /dev/null +++ b/.changeset/heavy-ghosts-doubt.md @@ -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`. diff --git a/packages/get-context/src/checkCompatibility/index.ts b/packages/get-context/src/checkCompatibility/index.ts index b23f97e38c..05417305d8 100644 --- a/packages/get-context/src/checkCompatibility/index.ts +++ b/packages/get-context/src/checkCompatibility/index.ts @@ -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, }) } diff --git a/packages/headless/src/index.ts b/packages/headless/src/index.ts index 9d961bee67..8e71c0982a 100644 --- a/packages/headless/src/index.ts +++ b/packages/headless/src/index.ts @@ -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, }) diff --git a/packages/modules-yaml/src/index.ts b/packages/modules-yaml/src/index.ts index 2655c9c83e..41c618a6f9 100644 --- a/packages/modules-yaml/src/index.ts +++ b/packages/modules-yaml/src/index.ts @@ -23,7 +23,7 @@ export interface Modules { registries?: Registries, // nullable for backward compatibility shamefullyHoist: boolean, skipped: string[], - store: string, + storeDir: string, virtualStoreDir: string, } diff --git a/packages/modules-yaml/test/index.ts b/packages/modules-yaml/test/index.ts index f00199df0d..20a42293cc 100644 --- a/packages/modules-yaml/test/index.ts +++ b/packages/modules-yaml/test/index.ts @@ -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) diff --git a/packages/plugin-commands-rebuild/src/implementation/index.ts b/packages/plugin-commands-rebuild/src/implementation/index.ts index a73dcf3cef..1396e123ac 100644 --- a/packages/plugin-commands-rebuild/src/implementation/index.ts +++ b/packages/plugin-commands-rebuild/src/implementation/index.ts @@ -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, }) } diff --git a/packages/supi/src/install/index.ts b/packages/supi/src/install/index.ts index 965dedd7b1..ab8d711ba4 100644 --- a/packages/supi/src/install/index.ts +++ b/packages/supi/src/install/index.ts @@ -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, }) })(), diff --git a/packages/supi/test/breakingChanges.ts b/packages/supi/test/breakingChanges.ts index 4ae4e382a2..d26db72414 100644 --- a/packages/supi/test/breakingChanges.ts +++ b/packages/supi/test/breakingChanges.ts @@ -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) => { diff --git a/privatePackages/assert-project/src/index.ts b/privatePackages/assert-project/src/index.ts index c2890b6984..881e6f3287 100644 --- a/privatePackages/assert-project/src/index.ts +++ b/privatePackages/assert-project/src/index.ts @@ -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),