Skip to content

Commit

Permalink
[FIX] pacote: Use npm cache within UI5 data dir
Browse files Browse the repository at this point in the history
Fixes regression from #618
  • Loading branch information
matz3 committed Sep 1, 2023
1 parent b62f860 commit f1e2178
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/ui5Framework/npm/Registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class Registry {
await configuration.load(); // Reads through the configurations
const config = configuration.flat; // JSON. Formatted via "flatten"

// Always use our cache dir instead of the configured one
config.cache = this._cacheDir;

if (!config.proxy && !config.httpsProxy) {
// Disable usage of shared keep-alive agents unless a proxy is configured
// which only works with agents.
Expand Down
1 change: 0 additions & 1 deletion test/lib/graph/helpers/ui5Framework.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ test.beforeEach(async (t) => {
}
sinon.stub(Config.prototype, "flat").value({
registry: "https://registry.fake",
cache: path.join(ui5FrameworkBaseDir, "cacache"),
proxy: ""
});

Expand Down
9 changes: 6 additions & 3 deletions test/lib/ui5framework/npm/Registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ test.serial("_getPacoteOptions", async (t) => {

const expectedPacoteOptions = {
fake: "config",
agent: false
agent: false,
cache: "cacheDir"
};
npmConfigFlat.value(npmConfig);

Expand Down Expand Up @@ -109,7 +110,8 @@ test.serial("_getPacoteOptions (proxy config set)", async (t) => {
};

const expectedPacoteOptions = {
proxy: "http://localhost:9999"
proxy: "http://localhost:9999",
cache: "cacheDir"
};

npmConfigFlat.value(npmConfig);
Expand All @@ -134,7 +136,8 @@ test.serial("_getPacoteOptions (https-proxy config set)", async (t) => {
};

const expectedPacoteOptions = {
httpsProxy: "http://localhost:9999"
httpsProxy: "http://localhost:9999",
cache: "cacheDir"
};

npmConfigFlat.value(npmConfig);
Expand Down

0 comments on commit f1e2178

Please sign in to comment.