Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save the metadata separately from the CAFS (#3578)
ref #2574
- Loading branch information
Showing
44 changed files
with
320 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@pnpm/client": minor | ||
--- | ||
|
||
New config setting added: cacheDir. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
"@pnpm/client": major | ||
"@pnpm/default-resolver": major | ||
"@pnpm/npm-resolver": major | ||
"@pnpm/outdated": major | ||
"@pnpm/plugin-commands-audit": major | ||
"@pnpm/plugin-commands-import": major | ||
"@pnpm/plugin-commands-installation": major | ||
"@pnpm/plugin-commands-listing": major | ||
"@pnpm/plugin-commands-outdated": major | ||
"@pnpm/plugin-commands-publishing": major | ||
"@pnpm/plugin-commands-rebuild": major | ||
"@pnpm/plugin-commands-script-runners": major | ||
"@pnpm/plugin-commands-store": major | ||
"@pnpm/store-connection-manager": major | ||
"supi": minor | ||
--- | ||
|
||
New required option added: cacheDir. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os from 'os' | ||
import path from 'path' | ||
|
||
export default function getCacheDir ( | ||
opts: { | ||
env: NodeJS.ProcessEnv | ||
platform: string | ||
} | ||
) { | ||
if (opts.env.XDG_CACHE_HOME) { | ||
return path.join(opts.env.XDG_CACHE_HOME, 'pnpm') | ||
} | ||
if (opts.platform !== 'win32') { | ||
return path.join(os.homedir(), '.cache/pnpm') | ||
} | ||
if (opts.env.LOCALAPPDATA) { | ||
return path.join(opts.env.LOCALAPPDATA, 'pnpm-cache') | ||
} | ||
return path.join(os.homedir(), '.pnpm-cache') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os from 'os' | ||
import path from 'path' | ||
import getCacheDir from '../lib/getCacheDir' | ||
|
||
test('getCacheDir()', () => { | ||
expect(getCacheDir({ | ||
env: { | ||
XDG_CACHE_HOME: '/home/foo/cache', | ||
}, | ||
platform: 'linux', | ||
})).toBe(path.join('/home/foo/cache', 'pnpm')) | ||
expect(getCacheDir({ | ||
env: {}, | ||
platform: 'linux', | ||
})).toBe(path.join(os.homedir(), '.cache/pnpm')) | ||
expect(getCacheDir({ | ||
env: { | ||
LOCALAPPDATA: '/localappdata', | ||
}, | ||
platform: 'win32', | ||
})).toBe(path.join('/localappdata', 'pnpm-cache')) | ||
expect(getCacheDir({ | ||
env: {}, | ||
platform: 'win32', | ||
})).toBe(path.join(os.homedir(), '.pnpm-cache')) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.