@ms-cloudpack/config 0.27.2 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/getCachePath.d.ts +8 -2
- package/lib/getCachePath.d.ts.map +1 -1
- package/lib/getCachePath.js +10 -3
- package/lib/getCachePath.js.map +1 -1
- package/package.json +1 -1
package/lib/getCachePath.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Get the cache path from user preferences if set.
|
|
3
|
+
* Falls back to the default cache path `~/.cloudpack`.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: If a session object is available, you should use `session.cachePath` instead.
|
|
6
|
+
*
|
|
7
|
+
* @param overridePath If set, this path (probably from a CLI option) will be used instead
|
|
8
|
+
* of the path from preferences.
|
|
3
9
|
*/
|
|
4
|
-
export declare function getCachePath(): string
|
|
10
|
+
export declare function getCachePath(overridePath?: string): Promise<string>;
|
|
5
11
|
/**
|
|
6
12
|
* Gets the path to the app's local cache directory.
|
|
7
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCachePath.d.ts","sourceRoot":"","sources":["../src/getCachePath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCachePath.d.ts","sourceRoot":"","sources":["../src/getCachePath.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,YAAY,CAAC,EAAE,MAAM,mBAEvD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,UAEhD"}
|
package/lib/getCachePath.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { readUserPreferences } from './readUserPreferences.js';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Get the cache path from user preferences if set.
|
|
6
|
+
* Falls back to the default cache path `~/.cloudpack`.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: If a session object is available, you should use `session.cachePath` instead.
|
|
9
|
+
*
|
|
10
|
+
* @param overridePath If set, this path (probably from a CLI option) will be used instead
|
|
11
|
+
* of the path from preferences.
|
|
5
12
|
*/
|
|
6
|
-
export function getCachePath() {
|
|
7
|
-
return path.join(os.homedir(), '.cloudpack');
|
|
13
|
+
export async function getCachePath(overridePath) {
|
|
14
|
+
return overridePath || (await readUserPreferences())?.cachePath || path.join(os.homedir(), '.cloudpack');
|
|
8
15
|
}
|
|
9
16
|
/**
|
|
10
17
|
* Gets the path to the app's local cache directory.
|
package/lib/getCachePath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCachePath.js","sourceRoot":"","sources":["../src/getCachePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"getCachePath.js","sourceRoot":"","sources":["../src/getCachePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,YAAqB;IACtD,OAAO,YAAY,IAAI,CAAC,MAAM,mBAAmB,EAAE,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AAC3G,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import os from 'os';\nimport path from 'path';\nimport { readUserPreferences } from './readUserPreferences.js';\n\n/**\n * Get the cache path from user preferences if set.\n * Falls back to the default cache path `~/.cloudpack`.\n *\n * NOTE: If a session object is available, you should use `session.cachePath` instead.\n *\n * @param overridePath If set, this path (probably from a CLI option) will be used instead\n * of the path from preferences.\n */\nexport async function getCachePath(overridePath?: string) {\n return overridePath || (await readUserPreferences())?.cachePath || path.join(os.homedir(), '.cloudpack');\n}\n\n/**\n * Gets the path to the app's local cache directory.\n */\nexport function getLocalCachePath(appPath: string) {\n return path.join(appPath, 'node_modules', '.cache', 'cloudpack');\n}\n"]}
|