@pnpm/assert-store 1000.0.13 → 1100.0.1
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/index.js +27 -21
- package/lib/index.js.map +1 -1
- package/package.json +10 -8
package/lib/index.js
CHANGED
|
@@ -1,46 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.assertStore = assertStore;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const store_cafs_1 = require("@pnpm/store.cafs");
|
|
10
|
-
const registry_mock_1 = require("@pnpm/registry-mock");
|
|
11
|
-
function assertStore(storePath, encodedRegistryName) {
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock';
|
|
4
|
+
import { StoreIndex, storeIndexKey } from '@pnpm/store.index';
|
|
5
|
+
export function assertStore(storePath, encodedRegistryName) {
|
|
12
6
|
// eslint-disable-next-line
|
|
13
7
|
const ok = (value) => expect(value).toBeTruthy();
|
|
14
8
|
// eslint-disable-next-line
|
|
15
9
|
const notOk = (value) => expect(value).toBeFalsy();
|
|
16
|
-
const ern = encodedRegistryName ?? `localhost+${
|
|
10
|
+
const ern = encodedRegistryName ?? `localhost+${REGISTRY_MOCK_PORT}`;
|
|
17
11
|
const store = {
|
|
18
12
|
getPkgIndexFilePath(pkgName, version) {
|
|
19
|
-
const integrity =
|
|
20
|
-
return (
|
|
13
|
+
const integrity = getIntegrity(pkgName, version);
|
|
14
|
+
return storeIndexKey(integrity, `${pkgName}@${version}`);
|
|
21
15
|
},
|
|
22
16
|
cafsHas(pkgName, version) {
|
|
23
17
|
const pathToCheck = store.getPkgIndexFilePath(pkgName, version);
|
|
24
|
-
|
|
18
|
+
const storeIndex = new StoreIndex(storePath);
|
|
19
|
+
try {
|
|
20
|
+
ok(storeIndex.get(pathToCheck) != null);
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
storeIndex.close();
|
|
24
|
+
}
|
|
25
25
|
},
|
|
26
26
|
cafsHasNot(pkgName, version) {
|
|
27
27
|
const pathToCheck = store.getPkgIndexFilePath(pkgName, version);
|
|
28
|
-
|
|
28
|
+
const storeIndex = new StoreIndex(storePath);
|
|
29
|
+
try {
|
|
30
|
+
notOk(storeIndex.get(pathToCheck) != null);
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
storeIndex.close();
|
|
34
|
+
}
|
|
29
35
|
},
|
|
30
36
|
storeHas(pkgName, version) {
|
|
31
37
|
const pathToCheck = store.resolve(pkgName, version);
|
|
32
|
-
ok(
|
|
38
|
+
ok(fs.existsSync(pathToCheck));
|
|
33
39
|
},
|
|
34
40
|
storeHasNot(pkgName, version) {
|
|
35
41
|
const pathToCheck = store.resolve(pkgName, version);
|
|
36
|
-
notOk(
|
|
42
|
+
notOk(fs.existsSync(pathToCheck));
|
|
37
43
|
},
|
|
38
44
|
resolve(pkgName, version, relativePath) {
|
|
39
|
-
const pkgFolder = version ?
|
|
45
|
+
const pkgFolder = version ? path.join(ern, pkgName, version) : pkgName;
|
|
40
46
|
if (relativePath) {
|
|
41
|
-
return
|
|
47
|
+
return path.join(storePath, pkgFolder, relativePath);
|
|
42
48
|
}
|
|
43
|
-
return
|
|
49
|
+
return path.join(storePath, pkgFolder);
|
|
44
50
|
},
|
|
45
51
|
};
|
|
46
52
|
return store;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OA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AC5C,IAAI,CAAC;gBACH,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,CAAA;YAC5C,CAAC;oBAAS,CAAC;gBACT,UAAU,CAAC,KAAK,EAAE,CAAA;YACpB,CAAC;QACH,CAAC;QACD,QAAQ,CAAE,OAAe,EAAE,OAAgB;YACzC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACnD,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAA;QAChC,CAAC;QACD,WAAW,CAAE,OAAe,EAAE,OAAgB;YAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACnD,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAA;QACnC,CAAC;QACD,OAAO,CAAE,OAAe,EAAE,OAAgB,EAAE,YAAqB;YAC/D,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;YACtE,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;YACtD,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QACxC,CAAC;KACF,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/assert-store",
|
|
3
3
|
"description": "Utils for testing pnpm store",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1100.0.1",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
7
7
|
},
|
|
8
8
|
"main": "lib/index.js",
|
|
9
|
+
"type": "module",
|
|
9
10
|
"types": "lib/index.d.ts",
|
|
10
11
|
"files": [
|
|
11
12
|
"lib/"
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
"homepage": "https://github.com/pnpm/pnpm/blob/master/privatePackages/assert-store#readme",
|
|
17
18
|
"keywords": [
|
|
18
19
|
"pnpm",
|
|
19
|
-
"
|
|
20
|
+
"pnpm11"
|
|
20
21
|
],
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"engines": {
|
|
@@ -24,17 +25,18 @@
|
|
|
24
25
|
},
|
|
25
26
|
"repository": "https://github.com/pnpm/pnpm/tree/main/__utils__/assert-store",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@pnpm/registry-mock": "
|
|
28
|
-
"@pnpm/store.cafs": "
|
|
28
|
+
"@pnpm/registry-mock": "6.0.0",
|
|
29
|
+
"@pnpm/store.cafs": "1100.0.1",
|
|
30
|
+
"@pnpm/store.index": "1100.0.0"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
|
-
"@pnpm/
|
|
32
|
-
"@pnpm/
|
|
33
|
+
"@pnpm/assert-store": "1100.0.1",
|
|
34
|
+
"@pnpm/constants": "1100.0.0"
|
|
33
35
|
},
|
|
34
36
|
"scripts": {
|
|
35
37
|
"compile": "tsc --build",
|
|
36
38
|
"lint": "eslint src/**/*.ts test/**/*.ts",
|
|
37
|
-
"pretest": "
|
|
38
|
-
"test": "
|
|
39
|
+
"pretest": "pn install -C test/fixture/project --force --no-shared-workspace-lockfile",
|
|
40
|
+
"test": "pn pretest && pn compile && jest"
|
|
39
41
|
}
|
|
40
42
|
}
|