registry-sync 6.0.0 → 6.1.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/README.md +3 -3
- package/package.json +1 -1
- package/src/download.js +13 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The local copy can then be used as a simple private NPM registry without publish
|
|
|
8
8
|
|
|
9
9
|
## Pre-requisites
|
|
10
10
|
|
|
11
|
-
- Node.js
|
|
11
|
+
- Node.js v18.20.0 or newer
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -25,8 +25,8 @@ The local copy can then be used as a simple private NPM registry without publish
|
|
|
25
25
|
--root <path> Path to save NPM package tarballs and metadata to
|
|
26
26
|
--manifest <file> Path to a package-lock.json or yarn.lock file to use as catalog for mirrored NPM packages
|
|
27
27
|
--localUrl <url> URL to use as root in stored package metadata (i.e. where folder defined as --root will be exposed at)
|
|
28
|
-
--binaryAbi <list> Optional comma-separated list of node C++ ABI numbers to download pre-built binaries for.
|
|
29
|
-
|
|
28
|
+
--binaryAbi <list> Optional comma-separated list of node C++ ABI numbers (NODE_MODULE_VERSION) to download pre-built binaries for.
|
|
29
|
+
Look for NODE_MODULE_VERSION in release ChangeLogs via https://nodejs.org/en/download/releases/.
|
|
30
30
|
Default value is from the current Node.js process.
|
|
31
31
|
--binaryArch <list> Optional comma-separated list of CPU architectures to download pre-built binaries for.
|
|
32
32
|
Valid values: arm, arm64, ia32, and x64.
|
package/package.json
CHANGED
package/src/download.js
CHANGED
|
@@ -48,9 +48,21 @@ async function updateMetadata(versionMetadata, defaultMetadata, registryUrl, loc
|
|
|
48
48
|
const localMetadata = await loadMetadata(localMetadataPath, defaultMetadata);
|
|
49
49
|
localMetadata.versions[version] = versionMetadata;
|
|
50
50
|
localMetadata.time[version] = defaultMetadata.time[version];
|
|
51
|
-
localMetadata['dist-tags']
|
|
51
|
+
localMetadata['dist-tags'] = collectDistTags(localMetadata, defaultMetadata);
|
|
52
52
|
await saveMetadata(localMetadataPath, localMetadata);
|
|
53
53
|
}
|
|
54
|
+
// Collect thise dist-tags entries (name -> version) from registry metadata,
|
|
55
|
+
// which point to versions we have locally available.
|
|
56
|
+
// Override 'latest' tag to ensure its validity as we might not have the version
|
|
57
|
+
// that is tagged latest in registry
|
|
58
|
+
function collectDistTags(localMetadata, defaultMetadata) {
|
|
59
|
+
const availableVersions = Object.keys(localMetadata.versions);
|
|
60
|
+
const validDistTags = Object.entries(defaultMetadata['dist-tags']).filter(([, version]) => availableVersions.includes(version));
|
|
61
|
+
return {
|
|
62
|
+
...Object.fromEntries(validDistTags),
|
|
63
|
+
latest: availableVersions.sort(semver.compare).pop()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
54
66
|
async function loadMetadata(path, defaultMetadata) {
|
|
55
67
|
try {
|
|
56
68
|
const json = await fs.promises.readFile(path, 'utf8');
|