node-install-release 1.9.6 → 1.10.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 +4 -4
- package/dist/cjs/cli.cjs +0 -2
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/constants.cjs +33 -15
- package/dist/cjs/constants.cjs.map +1 -1
- package/dist/cjs/createResult.cjs +5 -3
- package/dist/cjs/createResult.cjs.map +1 -1
- package/dist/cjs/installNPM/installBin.cjs +5 -8
- package/dist/cjs/installNPM/installBin.cjs.map +1 -1
- package/dist/cjs/installNPM/installLib.cjs +1 -1
- package/dist/cjs/installNPM/installLib.cjs.map +1 -1
- package/dist/cjs/installNode/index.cjs +33 -34
- package/dist/cjs/installNode/index.cjs.map +1 -1
- package/dist/cjs/installNode/installCompressed.cjs +5 -33
- package/dist/cjs/installNode/installCompressed.cjs.map +1 -1
- package/dist/cjs/installNode/installExe.cjs +6 -4
- package/dist/cjs/installNode/installExe.cjs.map +1 -1
- package/dist/cjs/installNode/installFilename.cjs +6 -2
- package/dist/cjs/installNode/installFilename.cjs.map +1 -1
- package/dist/cjs/installNode/installSource/buildPosix.cjs +2 -2
- package/dist/cjs/installNode/installSource/buildPosix.cjs.map +1 -1
- package/dist/cjs/installNode/installSource/buildWin32.cjs +4 -4
- package/dist/cjs/installNode/installSource/buildWin32.cjs.map +1 -1
- package/dist/cjs/installNode/installSource/index.cjs +1 -1
- package/dist/cjs/installNode/installSource/index.cjs.map +1 -1
- package/dist/cjs/lib/checkMissing.cjs +21 -46
- package/dist/cjs/lib/checkMissing.cjs.map +1 -1
- package/dist/cjs/lib/conditionalCache.cjs +4 -32
- package/dist/cjs/lib/conditionalCache.cjs.map +1 -1
- package/dist/cjs/lib/conditionalCopy.cjs +3 -3
- package/dist/cjs/lib/conditionalCopy.cjs.map +1 -1
- package/dist/cjs/lib/conditionalExtract.cjs +4 -32
- package/dist/cjs/lib/conditionalExtract.cjs.map +1 -1
- package/dist/cjs/lib/getTarget.cjs +37 -0
- package/dist/cjs/lib/getTarget.cjs.map +1 -0
- package/dist/cjs/workers/install.cjs +3 -2
- package/dist/cjs/workers/install.cjs.map +1 -1
- package/dist/esm/cli.mjs +0 -2
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/constants.mjs +20 -7
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/createResult.mjs +6 -4
- package/dist/esm/createResult.mjs.map +1 -1
- package/dist/esm/installNPM/installBin.mjs +4 -9
- package/dist/esm/installNPM/installBin.mjs.map +1 -1
- package/dist/esm/installNPM/installLib.mjs +1 -1
- package/dist/esm/installNPM/installLib.mjs.map +1 -1
- package/dist/esm/installNode/index.mjs +28 -29
- package/dist/esm/installNode/index.mjs.map +1 -1
- package/dist/esm/installNode/installCompressed.mjs +4 -5
- package/dist/esm/installNode/installCompressed.mjs.map +1 -1
- package/dist/esm/installNode/installExe.mjs +7 -5
- package/dist/esm/installNode/installExe.mjs.map +1 -1
- package/dist/esm/installNode/installFilename.mjs +6 -2
- package/dist/esm/installNode/installFilename.mjs.map +1 -1
- package/dist/esm/installNode/installSource/buildPosix.mjs +2 -2
- package/dist/esm/installNode/installSource/buildPosix.mjs.map +1 -1
- package/dist/esm/installNode/installSource/buildWin32.mjs +4 -4
- package/dist/esm/installNode/installSource/buildWin32.mjs.map +1 -1
- package/dist/esm/installNode/installSource/index.mjs +1 -1
- package/dist/esm/installNode/installSource/index.mjs.map +1 -1
- package/dist/esm/lib/checkMissing.mjs +18 -37
- package/dist/esm/lib/checkMissing.mjs.map +1 -1
- package/dist/esm/lib/conditionalCache.mjs +3 -4
- package/dist/esm/lib/conditionalCache.mjs.map +1 -1
- package/dist/esm/lib/conditionalCopy.mjs +3 -3
- package/dist/esm/lib/conditionalCopy.mjs.map +1 -1
- package/dist/esm/lib/conditionalExtract.mjs +3 -4
- package/dist/esm/lib/conditionalExtract.mjs.map +1 -1
- package/dist/esm/lib/getTarget.mjs +21 -0
- package/dist/esm/lib/getTarget.mjs.map +1 -0
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/workers/install.mjs +4 -2
- package/dist/esm/workers/install.mjs.map +1 -1
- package/dist/types/constants.d.ts +14 -5
- package/dist/types/lib/checkMissing.d.ts +0 -10
- package/dist/types/lib/getTarget.d.ts +4 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +3 -4
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import Queue from 'queue-cb';
|
|
3
3
|
import conditionalCopy from '../lib/conditionalCopy.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { NPM_FILE_PATHS } from '../constants.mjs';
|
|
5
5
|
export default function installBin(_version, dest, options, callback) {
|
|
6
|
-
const platform = options.platform
|
|
7
|
-
const
|
|
8
|
-
const binPath = platform === 'win32' ? dest : path.join(dest, 'bin');
|
|
6
|
+
const platform = options.platform;
|
|
7
|
+
const files = NPM_FILE_PATHS[platform] || NPM_FILE_PATHS.posix;
|
|
9
8
|
const queue = new Queue();
|
|
10
|
-
|
|
11
|
-
for(let index = 0; index < files.length; index++){
|
|
12
|
-
const file = files[index];
|
|
13
|
-
queue.defer(conditionalCopy.bind(null, path.join(libPath, file.src), path.join(binPath, file.dest), file));
|
|
14
|
-
}
|
|
9
|
+
files.forEach((file)=>queue.defer(conditionalCopy.bind(null, path.join(dest, file.src), path.join(dest, file.dest), file.optional)));
|
|
15
10
|
queue.await(callback);
|
|
16
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installBin.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\nimport conditionalCopy from '../lib/conditionalCopy';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installBin.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\nimport conditionalCopy from '../lib/conditionalCopy';\n\nimport { NPM_FILE_PATHS } from '../constants';\n\nexport default function installBin(_version, dest, options, callback) {\n const platform = options.platform;\n const files = NPM_FILE_PATHS[platform] || NPM_FILE_PATHS.posix;\n\n const queue = new Queue();\n files.forEach((file) => queue.defer(conditionalCopy.bind(null, path.join(dest, file.src), path.join(dest, file.dest), file.optional)));\n queue.await(callback);\n}\n"],"names":["path","Queue","conditionalCopy","NPM_FILE_PATHS","installBin","_version","dest","options","callback","platform","files","posix","queue","forEach","file","defer","bind","join","src","optional","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,qBAAqB,yBAAyB;AAErD,SAASC,cAAc,QAAQ,eAAe;AAE9C,eAAe,SAASC,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,QAAQP,cAAc,CAACM,SAAS,IAAIN,eAAeQ,KAAK;IAE9D,MAAMC,QAAQ,IAAIX;IAClBS,MAAMG,OAAO,CAAC,CAACC,OAASF,MAAMG,KAAK,CAACb,gBAAgBc,IAAI,CAAC,MAAMhB,KAAKiB,IAAI,CAACX,MAAMQ,KAAKI,GAAG,GAAGlB,KAAKiB,IAAI,CAACX,MAAMQ,KAAKR,IAAI,GAAGQ,KAAKK,QAAQ;IACnIP,MAAMQ,KAAK,CAACZ;AACd"}
|
|
@@ -6,7 +6,7 @@ import conditionalCache from '../lib/conditionalCache.mjs';
|
|
|
6
6
|
import conditionalExtract from '../lib/conditionalExtract.mjs';
|
|
7
7
|
import { NPM_DIST_TAGS_URL, NPM_DIST_URL, NPM_MIN_VERSION } from '../constants.mjs';
|
|
8
8
|
export default function installLib(version, dest, options, callback) {
|
|
9
|
-
const platform = options.platform
|
|
9
|
+
const platform = options.platform;
|
|
10
10
|
const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
|
|
11
11
|
const installPath = path.join(libPath, 'node_modules', 'npm');
|
|
12
12
|
const dist = getDist(version);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installLib.ts"],"sourcesContent":["import path from 'path';\nimport get from 'get-remote';\nimport { getDist } from 'node-filename-to-dist-paths';\nimport Queue from 'queue-cb';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\n\nimport { NPM_DIST_TAGS_URL, NPM_DIST_URL, NPM_MIN_VERSION } from '../constants';\n\ninterface DistRecord {\n latest: string;\n}\n\nexport default function installLib(version, dest, options, callback) {\n const platform = options.platform
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installLib.ts"],"sourcesContent":["import path from 'path';\nimport get from 'get-remote';\nimport { getDist } from 'node-filename-to-dist-paths';\nimport Queue from 'queue-cb';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\n\nimport { NPM_DIST_TAGS_URL, NPM_DIST_URL, NPM_MIN_VERSION } from '../constants';\n\ninterface DistRecord {\n latest: string;\n}\n\nexport default function installLib(version, dest, options, callback) {\n const platform = options.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n\n const dist = getDist(version);\n const npmMajorPair = dist && dist.npm ? +dist.npm.split('.')[0] : NPM_MIN_VERSION;\n const npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);\n\n get(NPM_DIST_TAGS_URL).json((err, res) => {\n if (err) return callback(err);\n const distTags = res.body as DistRecord;\n const npmVersion = distTags[`latest-${npmMajor}`] || distTags[`next-${npmMajor}`] || distTags.latest;\n const downloadPath = `${NPM_DIST_URL}/-/npm-${npmVersion}.tgz`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, installPath));\n queue.await((err) => {\n err ? callback(err) : callback(null, npmVersion);\n });\n });\n}\n"],"names":["path","get","getDist","Queue","conditionalCache","conditionalExtract","NPM_DIST_TAGS_URL","NPM_DIST_URL","NPM_MIN_VERSION","installLib","version","dest","options","callback","platform","libPath","join","installPath","dist","npmMajorPair","npm","split","npmMajor","Math","max","json","err","res","distTags","body","npmVersion","latest","downloadPath","cachePath","basename","queue","defer","bind","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,aAAa;AAC7B,SAASC,OAAO,QAAQ,8BAA8B;AACtD,OAAOC,WAAW,WAAW;AAE7B,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,wBAAwB,4BAA4B;AAE3D,SAASC,iBAAiB,EAAEC,YAAY,EAAEC,eAAe,QAAQ,eAAe;AAMhF,eAAe,SAASC,WAAWC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,UAAUD,aAAa,UAAUH,OAAOX,KAAKgB,IAAI,CAACL,MAAM;IAC9D,MAAMM,cAAcjB,KAAKgB,IAAI,CAACD,SAAS,gBAAgB;IAEvD,MAAMG,OAAOhB,QAAQQ;IACrB,MAAMS,eAAeD,QAAQA,KAAKE,GAAG,GAAG,CAACF,KAAKE,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAGb;IAClE,MAAMc,WAAWC,KAAKC,GAAG,CAACL,cAAcX;IAExCP,IAAIK,mBAAmBmB,IAAI,CAAC,CAACC,KAAKC;QAChC,IAAID,KAAK,OAAOb,SAASa;QACzB,MAAME,WAAWD,IAAIE,IAAI;QACzB,MAAMC,aAAaF,QAAQ,CAAC,CAAC,OAAO,EAAEN,UAAU,CAAC,IAAIM,QAAQ,CAAC,CAAC,KAAK,EAAEN,UAAU,CAAC,IAAIM,SAASG,MAAM;QACpG,MAAMC,eAAe,GAAGzB,aAAa,OAAO,EAAEuB,WAAW,IAAI,CAAC;QAC9D,MAAMG,YAAYjC,KAAKgB,IAAI,CAACJ,QAAQqB,SAAS,EAAEjC,KAAKkC,QAAQ,CAACF;QAE7D,MAAMG,QAAQ,IAAIhC,MAAM;QACxBgC,MAAMC,KAAK,CAAChC,iBAAiBiC,IAAI,CAAC,MAAML,cAAcC;QACtDE,MAAMC,KAAK,CAAC/B,mBAAmBgC,IAAI,CAAC,MAAMJ,WAAWhB;QACrDkB,MAAMG,KAAK,CAAC,CAACZ;YACXA,MAAMb,SAASa,OAAOb,SAAS,MAAMiB;QACvC;IACF;AACF"}
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import sll from 'single-line-log2';
|
|
2
|
-
import realArch from '../machine/arch.cjs';
|
|
3
2
|
import installFilename from './installFilename.mjs';
|
|
4
|
-
import { FILES } from '../constants.mjs';
|
|
5
|
-
const PLATFORM_MAP = {
|
|
6
|
-
win32: 'win',
|
|
7
|
-
darwin: 'osx'
|
|
8
|
-
};
|
|
9
|
-
let archMachine;
|
|
3
|
+
import { FILES, FILE_PLATFORM_MAP } from '../constants.mjs';
|
|
10
4
|
export default function install(version, dest, options, callback) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const parts = [
|
|
16
|
-
platform,
|
|
17
|
-
arch
|
|
5
|
+
let filenames = null;
|
|
6
|
+
// a specific filename
|
|
7
|
+
if (options.filename) filenames = [
|
|
8
|
+
options.filename
|
|
18
9
|
];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
else {
|
|
11
|
+
const { platform, arch } = options;
|
|
12
|
+
const filePlatform = FILE_PLATFORM_MAP[platform] || platform;
|
|
13
|
+
const parts = [
|
|
14
|
+
filePlatform,
|
|
15
|
+
arch
|
|
16
|
+
];
|
|
17
|
+
if (options.type) parts.push(options.type);
|
|
18
|
+
if (options.compression) parts.push(options.compression);
|
|
19
|
+
// generate the files in search order
|
|
20
|
+
const archs = [
|
|
21
|
+
arch,
|
|
22
|
+
process.arch
|
|
23
|
+
];
|
|
24
|
+
filenames = archs.map((a)=>[
|
|
25
|
+
filePlatform,
|
|
26
|
+
a
|
|
27
|
+
].concat(parts.slice(2)).join('-'));
|
|
28
|
+
(FILES[filePlatform] || []).forEach((x)=>filenames.push(x.filename));
|
|
29
|
+
filenames.push('src');
|
|
30
|
+
filenames = filenames.filter((filename, i)=>filenames.indexOf(filename) === i);
|
|
31
|
+
}
|
|
33
32
|
const tryNext = (cb)=>{
|
|
34
|
-
if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}`));
|
|
33
|
+
if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}${options.filename ? ` Filename: ${options.filename}` : ''}`));
|
|
35
34
|
installFilename(filenames.shift(), version, dest, options, (err)=>err ? tryNext(cb) : cb());
|
|
36
35
|
};
|
|
37
36
|
tryNext((err)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import sll from 'single-line-log2';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import sll from 'single-line-log2';\nimport installFilename from './installFilename';\n\nimport { FILES, FILE_PLATFORM_MAP } from '../constants';\n\nexport default function install(version, dest, options, callback) {\n let filenames = null;\n\n // a specific filename\n if (options.filename) filenames = [options.filename];\n // infer with fallbacks\n else {\n const { platform, arch } = options;\n const filePlatform = FILE_PLATFORM_MAP[platform] || platform;\n const parts = [filePlatform, arch];\n if (options.type) parts.push(options.type);\n if (options.compression) parts.push(options.compression);\n\n // generate the files in search order\n const archs = [arch, process.arch];\n filenames = archs.map((a) => [filePlatform, a].concat(parts.slice(2)).join('-'));\n (FILES[filePlatform] || []).forEach((x) => filenames.push(x.filename));\n filenames.push('src');\n filenames = filenames.filter((filename, i) => filenames.indexOf(filename) === i);\n }\n\n const tryNext = (cb) => {\n if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}${options.filename ? ` Filename: ${options.filename}` : ''}`));\n installFilename(filenames.shift(), version, dest, options, (err) => (err ? tryNext(cb) : cb()));\n };\n tryNext((err) => {\n sll.stdout('');\n console.log(`node ${version.slice(1)} ${!err ? 'installed' : `install failed. Error: ${err.message}`}`);\n callback(err);\n });\n}\n"],"names":["sll","installFilename","FILES","FILE_PLATFORM_MAP","install","version","dest","options","callback","filenames","filename","platform","arch","filePlatform","parts","type","push","compression","archs","process","map","a","concat","slice","join","forEach","x","filter","i","indexOf","tryNext","cb","length","Error","shift","err","stdout","console","log","message"],"mappings":"AAAA,OAAOA,SAAS,mBAAmB;AACnC,OAAOC,qBAAqB,oBAAoB;AAEhD,SAASC,KAAK,EAAEC,iBAAiB,QAAQ,eAAe;AAExD,eAAe,SAASC,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAIC,YAAY;IAEhB,sBAAsB;IACtB,IAAIF,QAAQG,QAAQ,EAAED,YAAY;QAACF,QAAQG,QAAQ;KAAC;SAE/C;QACH,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGL;QAC3B,MAAMM,eAAeV,iBAAiB,CAACQ,SAAS,IAAIA;QACpD,MAAMG,QAAQ;YAACD;YAAcD;SAAK;QAClC,IAAIL,QAAQQ,IAAI,EAAED,MAAME,IAAI,CAACT,QAAQQ,IAAI;QACzC,IAAIR,QAAQU,WAAW,EAAEH,MAAME,IAAI,CAACT,QAAQU,WAAW;QAEvD,qCAAqC;QACrC,MAAMC,QAAQ;YAACN;YAAMO,QAAQP,IAAI;SAAC;QAClCH,YAAYS,MAAME,GAAG,CAAC,CAACC,IAAM;gBAACR;gBAAcQ;aAAE,CAACC,MAAM,CAACR,MAAMS,KAAK,CAAC,IAAIC,IAAI,CAAC;QAC1EtB,CAAAA,KAAK,CAACW,aAAa,IAAI,EAAE,AAAD,EAAGY,OAAO,CAAC,CAACC,IAAMjB,UAAUO,IAAI,CAACU,EAAEhB,QAAQ;QACpED,UAAUO,IAAI,CAAC;QACfP,YAAYA,UAAUkB,MAAM,CAAC,CAACjB,UAAUkB,IAAMnB,UAAUoB,OAAO,CAACnB,cAAckB;IAChF;IAEA,MAAME,UAAU,CAACC;QACf,IAAItB,UAAUuB,MAAM,KAAK,GAAG,OAAOD,GAAG,IAAIE,MAAM,CAAC,+BAA+B,EAAE5B,UAAUE,QAAQG,QAAQ,GAAG,CAAC,WAAW,EAAEH,QAAQG,QAAQ,EAAE,GAAG,IAAI;QACtJT,gBAAgBQ,UAAUyB,KAAK,IAAI7B,SAASC,MAAMC,SAAS,CAAC4B,MAASA,MAAML,QAAQC,MAAMA;IAC3F;IACAD,QAAQ,CAACK;QACPnC,IAAIoC,MAAM,CAAC;QACXC,QAAQC,GAAG,CAAC,CAAC,KAAK,EAAEjC,QAAQkB,KAAK,CAAC,GAAG,CAAC,EAAE,CAACY,MAAM,cAAc,CAAC,uBAAuB,EAAEA,IAAII,OAAO,EAAE,EAAE;QACtG/B,SAAS2B;IACX;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
|
-
import access from 'fs-access-compat';
|
|
3
3
|
import Queue from 'queue-cb';
|
|
4
4
|
import rimraf2 from 'rimraf2';
|
|
5
5
|
import { NODE_DIST_BASE_URL } from '../constants.mjs';
|
|
@@ -7,21 +7,20 @@ import conditionalCache from '../lib/conditionalCache.mjs';
|
|
|
7
7
|
import conditionalExtract from '../lib/conditionalExtract.mjs';
|
|
8
8
|
import validateDownload from './validateDownload.mjs';
|
|
9
9
|
export default function installCompressed(distPath, dest, options, callback) {
|
|
10
|
+
const platform = options.platform;
|
|
10
11
|
const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;
|
|
11
12
|
const cachePath = path.join(options.cachePath, path.basename(downloadPath));
|
|
12
|
-
|
|
13
|
+
fs.stat(dest, (err)=>{
|
|
13
14
|
if (!err) return callback(); // already exists
|
|
14
15
|
const queue = new Queue(1);
|
|
15
16
|
queue.defer(conditionalCache.bind(null, downloadPath, cachePath));
|
|
16
17
|
queue.defer(validateDownload.bind(null, distPath, cachePath));
|
|
17
18
|
queue.defer(conditionalExtract.bind(null, cachePath, dest, {
|
|
18
19
|
strip: 1,
|
|
19
|
-
time: 1000
|
|
20
|
-
...options
|
|
20
|
+
time: 1000
|
|
21
21
|
}));
|
|
22
22
|
queue.await((err)=>{
|
|
23
23
|
// some compressed versions of node come with npm pre-installed, but we want to override with a specific version
|
|
24
|
-
const platform = options.platform || process.platform;
|
|
25
24
|
const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
|
|
26
25
|
const installPath = path.join(libPath, 'node_modules', 'npm');
|
|
27
26
|
rimraf2(installPath, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\nimport validateDownload from './validateDownload';\n\nexport default function installCompressed(distPath, dest, options, callback) {\n const platform = options.platform;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, dest, { strip: 1, time: 1000 }));\n queue.await((err) => {\n // some compressed versions of node come with npm pre-installed, but we want to override with a specific version\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n rimraf2(installPath, { disableGlob: true }, () => callback(err));\n });\n });\n}\n"],"names":["fs","path","Queue","rimraf2","NODE_DIST_BASE_URL","conditionalCache","conditionalExtract","validateDownload","installCompressed","distPath","dest","options","callback","platform","downloadPath","cachePath","join","basename","stat","err","queue","defer","bind","strip","time","await","libPath","installPath","disableGlob"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,aAAa,UAAU;AAE9B,SAASC,kBAAkB,QAAQ,eAAe;AAClD,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,wBAAwB,4BAA4B;AAC3D,OAAOC,sBAAsB,qBAAqB;AAElD,eAAe,SAASC,kBAAkBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACzE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,eAAe,GAAGV,mBAAmB,CAAC,EAAEK,UAAU;IACxD,MAAMM,YAAYd,KAAKe,IAAI,CAACL,QAAQI,SAAS,EAAEd,KAAKgB,QAAQ,CAACH;IAE7Dd,GAAGkB,IAAI,CAACR,MAAM,CAACS;QACb,IAAI,CAACA,KAAK,OAAOP,YAAY,iBAAiB;QAE9C,MAAMQ,QAAQ,IAAIlB,MAAM;QACxBkB,MAAMC,KAAK,CAAChB,iBAAiBiB,IAAI,CAAC,MAAMR,cAAcC;QACtDK,MAAMC,KAAK,CAACd,iBAAiBe,IAAI,CAAC,MAAMb,UAAUM;QAClDK,MAAMC,KAAK,CAACf,mBAAmBgB,IAAI,CAAC,MAAMP,WAAWL,MAAM;YAAEa,OAAO;YAAGC,MAAM;QAAK;QAClFJ,MAAMK,KAAK,CAAC,CAACN;YACX,gHAAgH;YAChH,MAAMO,UAAUb,aAAa,UAAUH,OAAOT,KAAKe,IAAI,CAACN,MAAM;YAC9D,MAAMiB,cAAc1B,KAAKe,IAAI,CAACU,SAAS,gBAAgB;YACvDvB,QAAQwB,aAAa;gBAAEC,aAAa;YAAK,GAAG,IAAMhB,SAASO;QAC7D;IACF;AACF"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
|
-
import access from 'fs-access-compat';
|
|
3
3
|
import Queue from 'queue-cb';
|
|
4
|
-
import { NODE_DIST_BASE_URL } from '../constants.mjs';
|
|
4
|
+
import { NODE_DIST_BASE_URL, NODE_FILE_PATHS } from '../constants.mjs';
|
|
5
5
|
import conditionalCache from '../lib/conditionalCache.mjs';
|
|
6
6
|
import copyFile from '../lib/copyFile.mjs';
|
|
7
7
|
import validateDownload from './validateDownload.mjs';
|
|
8
8
|
export default function installExe(distPath, dest, options, callback) {
|
|
9
|
+
const platform = options.platform;
|
|
9
10
|
const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;
|
|
10
11
|
const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);
|
|
11
|
-
const
|
|
12
|
-
|
|
12
|
+
const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;
|
|
13
|
+
const execPath = path.join(dest, nodePath);
|
|
14
|
+
fs.stat(execPath, (err)=>{
|
|
13
15
|
if (!err) return callback(); // already exists
|
|
14
16
|
const queue = new Queue(1);
|
|
15
17
|
queue.defer(conditionalCache.bind(null, downloadPath, cachePath));
|
|
16
18
|
queue.defer(validateDownload.bind(null, distPath, cachePath));
|
|
17
|
-
queue.defer(copyFile.bind(null, cachePath,
|
|
19
|
+
queue.defer(copyFile.bind(null, cachePath, execPath));
|
|
18
20
|
queue.await(callback);
|
|
19
21
|
});
|
|
20
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL, NODE_FILE_PATHS } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\nimport validateDownload from './validateDownload';\n\nexport default function installExe(distPath, dest, options, callback) {\n const platform = options.platform;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);\n const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;\n const execPath = path.join(dest, nodePath);\n\n fs.stat(execPath, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(copyFile.bind(null, cachePath, execPath));\n queue.await(callback);\n });\n}\n"],"names":["fs","path","Queue","NODE_DIST_BASE_URL","NODE_FILE_PATHS","conditionalCache","copyFile","validateDownload","installExe","distPath","dest","options","callback","platform","downloadPath","cachePath","join","nodePath","posix","execPath","stat","err","queue","defer","bind","await"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAE7B,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,eAAe;AACnE,OAAOC,sBAAsB,0BAA0B;AACvD,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,sBAAsB,qBAAqB;AAElD,eAAe,SAASC,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,eAAe,GAAGX,mBAAmB,CAAC,EAAEM,UAAU;IACxD,MAAMM,YAAYd,KAAKe,IAAI,CAACL,QAAQI,SAAS,EAAE,CAAC,KAAK,EAAEN,SAAS,IAAI,CAAC;IACrE,MAAMQ,WAAWb,eAAe,CAACS,SAAS,IAAIT,gBAAgBc,KAAK;IACnE,MAAMC,WAAWlB,KAAKe,IAAI,CAACN,MAAMO;IAEjCjB,GAAGoB,IAAI,CAACD,UAAU,CAACE;QACjB,IAAI,CAACA,KAAK,OAAOT,YAAY,iBAAiB;QAE9C,MAAMU,QAAQ,IAAIpB,MAAM;QACxBoB,MAAMC,KAAK,CAAClB,iBAAiBmB,IAAI,CAAC,MAAMV,cAAcC;QACtDO,MAAMC,KAAK,CAAChB,iBAAiBiB,IAAI,CAAC,MAAMf,UAAUM;QAClDO,MAAMC,KAAK,CAACjB,SAASkB,IAAI,CAAC,MAAMT,WAAWI;QAC3CG,MAAMG,KAAK,CAACb;IACd;AACF"}
|
|
@@ -8,8 +8,12 @@ export default function installFilename(filename, version, dest, options, callba
|
|
|
8
8
|
const distPath = fromFilename(filename, version);
|
|
9
9
|
if (!distPath) return callback(new Error('Not found'));
|
|
10
10
|
const ext = path.extname(distPath);
|
|
11
|
-
if (ext === '.exe') return installExe(distPath, dest, options, callback);
|
|
12
|
-
if (EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) return installCompressed(distPath, dest, options, callback);
|
|
13
11
|
if (filename === 'src') return installSource(distPath, dest, options, callback);
|
|
12
|
+
if (ext === '.exe') return installExe(distPath, dest, options, callback);
|
|
13
|
+
if (EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) {
|
|
14
|
+
// 7z is not supported by fast extract
|
|
15
|
+
if (ext === '.7z') return callback(new Error('7z not supported. Make a request feature request: https://github.com/kmalakoff/node-install-release/pulls'));
|
|
16
|
+
return installCompressed(distPath, dest, options, callback);
|
|
17
|
+
}
|
|
14
18
|
callback(new Error(`Unable to install ${version} distPath: ${distPath}`));
|
|
15
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installFilename.ts"],"sourcesContent":["import path from 'path';\nimport fromFilename from 'node-filename-to-dist-paths';\nimport { EXTENSIONS_COMPRESSED } from '../constants';\n\nimport installCompressed from './installCompressed';\nimport installExe from './installExe';\nimport installSource from './installSource/index';\n\nexport default function installFilename(filename, version, dest, options, callback) {\n const distPath = fromFilename(filename, version);\n if (!distPath) return callback(new Error('Not found'));\n const ext = path.extname(distPath);\n\n if (
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installFilename.ts"],"sourcesContent":["import path from 'path';\nimport fromFilename from 'node-filename-to-dist-paths';\nimport { EXTENSIONS_COMPRESSED, FILE_PLATFORM_MAP } from '../constants';\n\nimport installCompressed from './installCompressed';\nimport installExe from './installExe';\nimport installSource from './installSource/index';\n\nexport default function installFilename(filename, version, dest, options, callback) {\n const distPath = fromFilename(filename, version);\n if (!distPath) return callback(new Error('Not found'));\n const ext = path.extname(distPath);\n\n if (filename === 'src') return installSource(distPath, dest, options, callback);\n if (ext === '.exe') return installExe(distPath, dest, options, callback);\n if (EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) {\n // 7z is not supported by fast extract\n if (ext === '.7z') return callback(new Error('7z not supported. Make a request feature request: https://github.com/kmalakoff/node-install-release/pulls'));\n return installCompressed(distPath, dest, options, callback);\n }\n callback(new Error(`Unable to install ${version} distPath: ${distPath}`));\n}\n"],"names":["path","fromFilename","EXTENSIONS_COMPRESSED","installCompressed","installExe","installSource","installFilename","filename","version","dest","options","callback","distPath","Error","ext","extname","indexOf"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,kBAAkB,8BAA8B;AACvD,SAASC,qBAAqB,QAA2B,eAAe;AAExE,OAAOC,uBAAuB,sBAAsB;AACpD,OAAOC,gBAAgB,eAAe;AACtC,OAAOC,mBAAmB,wBAAwB;AAElD,eAAe,SAASC,gBAAgBC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAChF,MAAMC,WAAWX,aAAaM,UAAUC;IACxC,IAAI,CAACI,UAAU,OAAOD,SAAS,IAAIE,MAAM;IACzC,MAAMC,MAAMd,KAAKe,OAAO,CAACH;IAEzB,IAAIL,aAAa,OAAO,OAAOF,cAAcO,UAAUH,MAAMC,SAASC;IACtE,IAAIG,QAAQ,QAAQ,OAAOV,WAAWQ,UAAUH,MAAMC,SAASC;IAC/D,IAAIT,sBAAsBc,OAAO,CAACF,QAAQ,GAAG;QAC3C,sCAAsC;QACtC,IAAIA,QAAQ,OAAO,OAAOH,SAAS,IAAIE,MAAM;QAC7C,OAAOV,kBAAkBS,UAAUH,MAAMC,SAASC;IACpD;IACAA,SAAS,IAAIE,MAAM,CAAC,kBAAkB,EAAEL,QAAQ,WAAW,EAAEI,UAAU;AACzE"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
3
|
import spawn from 'cross-spawn-cb';
|
|
3
|
-
import access from 'fs-access-compat';
|
|
4
4
|
import Queue from 'queue-cb';
|
|
5
5
|
export default function installPosix(buildPath, dest, _options, callback) {
|
|
6
6
|
const buildTarget = path.join(dest, 'node');
|
|
7
|
-
|
|
7
|
+
fs.stat(buildTarget, (err)=>{
|
|
8
8
|
if (!err) return callback(); // already exists
|
|
9
9
|
const queue = new Queue(1);
|
|
10
10
|
queue.defer(spawn.bind(null, './configure', [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildPosix.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildPosix.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport Queue from 'queue-cb';\n\nexport default function installPosix(buildPath, dest, _options, callback) {\n const buildTarget = path.join(dest, 'node');\n\n fs.stat(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(spawn.bind(null, './configure', [`--prefix=${dest}`], { stdio: 'inherit', cwd: buildPath }));\n queue.defer(spawn.bind(null, 'make', ['install'], { stdio: 'inherit', cwd: buildPath }, callback));\n queue.await(callback);\n });\n}\n"],"names":["fs","path","spawn","Queue","installPosix","buildPath","dest","_options","callback","buildTarget","join","stat","err","queue","defer","bind","stdio","cwd","await"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,iBAAiB;AACnC,OAAOC,WAAW,WAAW;AAE7B,eAAe,SAASC,aAAaC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACtE,MAAMC,cAAcR,KAAKS,IAAI,CAACJ,MAAM;IAEpCN,GAAGW,IAAI,CAACF,aAAa,CAACG;QACpB,IAAI,CAACA,KAAK,OAAOJ,YAAY,iBAAiB;QAE9C,MAAMK,QAAQ,IAAIV,MAAM;QACxBU,MAAMC,KAAK,CAACZ,MAAMa,IAAI,CAAC,MAAM,eAAe;YAAC,CAAC,SAAS,EAAET,MAAM;SAAC,EAAE;YAAEU,OAAO;YAAWC,KAAKZ;QAAU;QACrGQ,MAAMC,KAAK,CAACZ,MAAMa,IAAI,CAAC,MAAM,QAAQ;YAAC;SAAU,EAAE;YAAEC,OAAO;YAAWC,KAAKZ;QAAU,GAAGG;QACxFK,MAAMK,KAAK,CAACV;IACd;AACF"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import spawn from 'cross-spawn-cb';
|
|
3
3
|
import Queue from 'queue-cb';
|
|
4
|
-
import
|
|
4
|
+
import fs from 'fs';
|
|
5
5
|
import conditionalCopy from '../../lib/conditionalCopy.mjs';
|
|
6
6
|
export default function installWin32(buildPath, dest, _options, callback) {
|
|
7
7
|
const buildSource = path.join(buildPath, 'out', 'Release', 'node.exe');
|
|
8
8
|
const buildTarget = path.join(dest, 'node.exe');
|
|
9
|
-
|
|
9
|
+
fs.stat(buildTarget, (err)=>{
|
|
10
10
|
if (!err) return callback(); // already exists
|
|
11
11
|
const queue = new Queue(1);
|
|
12
|
-
queue.defer(
|
|
12
|
+
queue.defer(fs.stat.bind(null, buildSource, (err)=>!err ? callback() : spawn('./vcbuild', [], {
|
|
13
13
|
stdio: 'inherit',
|
|
14
14
|
cwd: buildPath
|
|
15
15
|
})));
|
|
16
|
-
queue.defer(conditionalCopy.bind(null, buildSource, buildTarget,
|
|
16
|
+
queue.defer(conditionalCopy.bind(null, buildSource, buildTarget, false));
|
|
17
17
|
queue.await(callback);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildWin32.ts"],"sourcesContent":["import path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport Queue from 'queue-cb';\n\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildWin32.ts"],"sourcesContent":["import path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport Queue from 'queue-cb';\n\nimport fs from 'fs';\nimport conditionalCopy from '../../lib/conditionalCopy';\n\nexport default function installWin32(buildPath, dest, _options, callback) {\n const buildSource = path.join(buildPath, 'out', 'Release', 'node.exe');\n const buildTarget = path.join(dest, 'node.exe');\n\n fs.stat(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(fs.stat.bind(null, buildSource, (err) => (!err ? callback() : spawn('./vcbuild', [], { stdio: 'inherit', cwd: buildPath }))));\n queue.defer(conditionalCopy.bind(null, buildSource, buildTarget, false));\n queue.await(callback);\n });\n}\n"],"names":["path","spawn","Queue","fs","conditionalCopy","installWin32","buildPath","dest","_options","callback","buildSource","join","buildTarget","stat","err","queue","defer","bind","stdio","cwd","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,WAAW,iBAAiB;AACnC,OAAOC,WAAW,WAAW;AAE7B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,qBAAqB,4BAA4B;AAExD,eAAe,SAASC,aAAaC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACtE,MAAMC,cAAcV,KAAKW,IAAI,CAACL,WAAW,OAAO,WAAW;IAC3D,MAAMM,cAAcZ,KAAKW,IAAI,CAACJ,MAAM;IAEpCJ,GAAGU,IAAI,CAACD,aAAa,CAACE;QACpB,IAAI,CAACA,KAAK,OAAOL,YAAY,iBAAiB;QAE9C,MAAMM,QAAQ,IAAIb,MAAM;QACxBa,MAAMC,KAAK,CAACb,GAAGU,IAAI,CAACI,IAAI,CAAC,MAAMP,aAAa,CAACI,MAAS,CAACA,MAAML,aAAaR,MAAM,aAAa,EAAE,EAAE;gBAAEiB,OAAO;gBAAWC,KAAKb;YAAU;QACpIS,MAAMC,KAAK,CAACZ,gBAAgBa,IAAI,CAAC,MAAMP,aAAaE,aAAa;QACjEG,MAAMK,KAAK,CAACX;IACd;AACF"}
|
|
@@ -7,7 +7,7 @@ import validateDownload from '../validateDownload.mjs';
|
|
|
7
7
|
import buildPosix from './buildPosix.mjs';
|
|
8
8
|
import buildWin32 from './buildWin32.mjs';
|
|
9
9
|
export default function InstallSource(distPath, dest, options, callback) {
|
|
10
|
-
const platform = options.platform
|
|
10
|
+
const platform = options.platform;
|
|
11
11
|
const build = platform === 'win32' ? buildWin32 : buildPosix;
|
|
12
12
|
const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;
|
|
13
13
|
const buildPath = path.join(options.buildPath, path.basename(distPath));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/index.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../../constants';\nimport conditionalCache from '../../lib/conditionalCache';\nimport conditionalExtract from '../../lib/conditionalExtract';\nimport validateDownload from '../validateDownload';\nimport buildPosix from './buildPosix';\nimport buildWin32 from './buildWin32';\n\nexport default function InstallSource(distPath, dest, options, callback) {\n const platform = options.platform
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/index.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../../constants';\nimport conditionalCache from '../../lib/conditionalCache';\nimport conditionalExtract from '../../lib/conditionalExtract';\nimport validateDownload from '../validateDownload';\nimport buildPosix from './buildPosix';\nimport buildWin32 from './buildWin32';\n\nexport default function InstallSource(distPath, dest, options, callback) {\n const platform = options.platform;\n const build = platform === 'win32' ? buildWin32 : buildPosix;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const buildPath = path.join(options.buildPath, path.basename(distPath));\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, buildPath, { strip: 1 }));\n queue.defer(build.bind(null, buildPath, dest, options));\n queue.await(callback);\n}\n"],"names":["path","Queue","NODE_DIST_BASE_URL","conditionalCache","conditionalExtract","validateDownload","buildPosix","buildWin32","InstallSource","distPath","dest","options","callback","platform","build","downloadPath","buildPath","join","basename","cachePath","queue","defer","bind","strip","await"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAE7B,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,OAAOC,sBAAsB,6BAA6B;AAC1D,OAAOC,wBAAwB,+BAA+B;AAC9D,OAAOC,sBAAsB,sBAAsB;AACnD,OAAOC,gBAAgB,eAAe;AACtC,OAAOC,gBAAgB,eAAe;AAEtC,eAAe,SAASC,cAAcC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACrE,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,QAAQD,aAAa,UAAUN,aAAaD;IAClD,MAAMS,eAAe,GAAGb,mBAAmB,CAAC,EAAEO,UAAU;IACxD,MAAMO,YAAYhB,KAAKiB,IAAI,CAACN,QAAQK,SAAS,EAAEhB,KAAKkB,QAAQ,CAACT;IAC7D,MAAMU,YAAYnB,KAAKiB,IAAI,CAACN,QAAQQ,SAAS,EAAEnB,KAAKkB,QAAQ,CAACH;IAE7D,MAAMK,QAAQ,IAAInB,MAAM;IACxBmB,MAAMC,KAAK,CAAClB,iBAAiBmB,IAAI,CAAC,MAAMP,cAAcI;IACtDC,MAAMC,KAAK,CAAChB,iBAAiBiB,IAAI,CAAC,MAAMb,UAAUU;IAClDC,MAAMC,KAAK,CAACjB,mBAAmBkB,IAAI,CAAC,MAAMH,WAAWH,WAAW;QAAEO,OAAO;IAAE;IAC3EH,MAAMC,KAAK,CAACP,MAAMQ,IAAI,CAAC,MAAMN,WAAWN,MAAMC;IAC9CS,MAAMI,KAAK,CAACZ;AACd"}
|
|
@@ -1,41 +1,22 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
win32: {
|
|
6
|
-
node: [
|
|
7
|
-
'node.exe'
|
|
8
|
-
],
|
|
9
|
-
npm: [
|
|
10
|
-
'npm',
|
|
11
|
-
'npm.cmd'
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
posix: {
|
|
15
|
-
node: [
|
|
16
|
-
'node'
|
|
17
|
-
],
|
|
18
|
-
npm: [
|
|
19
|
-
'npm'
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
};
|
|
3
|
+
import Queue from 'queue-cb';
|
|
4
|
+
import { NODE_FILE_PATHS, NPM_FILE_PATHS } from '../constants.mjs';
|
|
23
5
|
export default function checkMissing(dest, options, callback) {
|
|
24
|
-
const platform = options.platform
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
6
|
+
const platform = options.platform;
|
|
7
|
+
const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;
|
|
8
|
+
const npmPaths = NPM_FILE_PATHS[platform] || NPM_FILE_PATHS.posix;
|
|
9
|
+
const missing = [];
|
|
10
|
+
function check(filePath, key, cb) {
|
|
11
|
+
fs.stat(path.join(dest, filePath), (err)=>{
|
|
12
|
+
if (err && missing.indexOf(key) < 0) missing.push(key);
|
|
13
|
+
cb();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const queue = new Queue();
|
|
17
|
+
queue.defer(check.bind(null, nodePath, 'node'));
|
|
18
|
+
for(const key in npmPaths){
|
|
19
|
+
if (!npmPaths[key].optional) queue.defer(check.bind(null, npmPaths[key].dest, 'npm'));
|
|
20
|
+
}
|
|
21
|
+
queue.await(()=>callback(null, missing));
|
|
41
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/checkMissing.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/checkMissing.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_FILE_PATHS, NPM_FILE_PATHS } from '../constants';\n\nexport default function checkMissing(dest, options, callback) {\n const platform = options.platform;\n const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;\n const npmPaths = NPM_FILE_PATHS[platform] || NPM_FILE_PATHS.posix;\n\n const missing = [];\n function check(filePath, key, cb) {\n fs.stat(path.join(dest, filePath), (err) => {\n if (err && missing.indexOf(key) < 0) missing.push(key);\n cb();\n });\n }\n\n const queue = new Queue();\n queue.defer(check.bind(null, nodePath, 'node'));\n for (const key in npmPaths) {\n if (!npmPaths[key].optional) queue.defer(check.bind(null, npmPaths[key].dest, 'npm'));\n }\n queue.await(() => callback(null, missing));\n}\n"],"names":["fs","path","Queue","NODE_FILE_PATHS","NPM_FILE_PATHS","checkMissing","dest","options","callback","platform","nodePath","posix","npmPaths","missing","check","filePath","key","cb","stat","join","err","indexOf","push","queue","defer","bind","optional","await"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAE7B,SAASC,eAAe,EAAEC,cAAc,QAAQ,eAAe;AAE/D,eAAe,SAASC,aAAaC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC1D,MAAMC,WAAWF,QAAQE,QAAQ;IACjC,MAAMC,WAAWP,eAAe,CAACM,SAAS,IAAIN,gBAAgBQ,KAAK;IACnE,MAAMC,WAAWR,cAAc,CAACK,SAAS,IAAIL,eAAeO,KAAK;IAEjE,MAAME,UAAU,EAAE;IAClB,SAASC,MAAMC,QAAQ,EAAEC,GAAG,EAAEC,EAAE;QAC9BjB,GAAGkB,IAAI,CAACjB,KAAKkB,IAAI,CAACb,MAAMS,WAAW,CAACK;YAClC,IAAIA,OAAOP,QAAQQ,OAAO,CAACL,OAAO,GAAGH,QAAQS,IAAI,CAACN;YAClDC;QACF;IACF;IAEA,MAAMM,QAAQ,IAAIrB;IAClBqB,MAAMC,KAAK,CAACV,MAAMW,IAAI,CAAC,MAAMf,UAAU;IACvC,IAAK,MAAMM,OAAOJ,SAAU;QAC1B,IAAI,CAACA,QAAQ,CAACI,IAAI,CAACU,QAAQ,EAAEH,MAAMC,KAAK,CAACV,MAAMW,IAAI,CAAC,MAAMb,QAAQ,CAACI,IAAI,CAACV,IAAI,EAAE;IAChF;IACAiB,MAAMI,KAAK,CAAC,IAAMnB,SAAS,MAAMK;AACnC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
|
-
import access from 'fs-access-compat';
|
|
3
3
|
import get from 'get-remote';
|
|
4
4
|
import ensureDestinationParent from './ensureDestinationParent.mjs';
|
|
5
5
|
export default function conditionalCache(endpoint, dest, options, callback) {
|
|
@@ -8,14 +8,13 @@ export default function conditionalCache(endpoint, dest, options, callback) {
|
|
|
8
8
|
options = null;
|
|
9
9
|
}
|
|
10
10
|
options = options || {};
|
|
11
|
-
|
|
11
|
+
fs.stat(dest, (err)=>{
|
|
12
12
|
if (!err) return callback(); // already exists
|
|
13
13
|
ensureDestinationParent(dest, (err)=>{
|
|
14
14
|
if (err) return callback(err);
|
|
15
15
|
get(endpoint, {
|
|
16
16
|
filename: path.basename(dest),
|
|
17
|
-
time: 1000
|
|
18
|
-
...options
|
|
17
|
+
time: 1000
|
|
19
18
|
}).file(path.dirname(dest), callback);
|
|
20
19
|
});
|
|
21
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCache.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCache.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport get from 'get-remote';\n\nimport ensureDestinationParent from './ensureDestinationParent';\n\nexport default function conditionalCache(endpoint, dest, options, callback?) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n ensureDestinationParent(dest, (err) => {\n if (err) return callback(err);\n get(endpoint, { filename: path.basename(dest), time: 1000 }).file(path.dirname(dest), callback);\n });\n });\n}\n"],"names":["fs","path","get","ensureDestinationParent","conditionalCache","endpoint","dest","options","callback","stat","err","filename","basename","time","file","dirname"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,aAAa;AAE7B,OAAOC,6BAA6B,4BAA4B;AAEhE,eAAe,SAASC,iBAAiBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAS;IACzE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBP,GAAGS,IAAI,CAACH,MAAM,CAACI;QACb,IAAI,CAACA,KAAK,OAAOF,YAAY,iBAAiB;QAE9CL,wBAAwBG,MAAM,CAACI;YAC7B,IAAIA,KAAK,OAAOF,SAASE;YACzBR,IAAIG,UAAU;gBAAEM,UAAUV,KAAKW,QAAQ,CAACN;gBAAOO,MAAM;YAAK,GAAGC,IAAI,CAACb,KAAKc,OAAO,CAACT,OAAOE;QACxF;IACF;AACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from 'fs';
|
|
2
2
|
import copyFile from './copyFile.mjs';
|
|
3
3
|
export default function conditionalCopy(src, dest, optional, callback) {
|
|
4
4
|
if (typeof optional === 'function') return callback(new Error('conditionalCopy missing options'));
|
|
5
|
-
|
|
5
|
+
fs.stat(dest, (err)=>{
|
|
6
6
|
if (!err) return callback(); // already exists
|
|
7
|
-
|
|
7
|
+
fs.stat(src, (err)=>{
|
|
8
8
|
err && optional ? callback() : copyFile(src, dest, callback); // optional file missing
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCopy.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalCopy.ts"],"sourcesContent":["import fs from 'fs';\nimport copyFile from './copyFile';\n\nexport default function conditionalCopy(src, dest, optional, callback) {\n if (typeof optional === 'function') return callback(new Error('conditionalCopy missing options'));\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n fs.stat(src, (err) => {\n err && optional ? callback() : copyFile(src, dest, callback); // optional file missing\n });\n });\n}\n"],"names":["fs","copyFile","conditionalCopy","src","dest","optional","callback","Error","stat","err"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,cAAc,aAAa;AAElC,eAAe,SAASC,gBAAgBC,GAAG,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACnE,IAAI,OAAOD,aAAa,YAAY,OAAOC,SAAS,IAAIC,MAAM;IAE9DP,GAAGQ,IAAI,CAACJ,MAAM,CAACK;QACb,IAAI,CAACA,KAAK,OAAOH,YAAY,iBAAiB;QAE9CN,GAAGQ,IAAI,CAACL,KAAK,CAACM;YACZA,OAAOJ,WAAWC,aAAaL,SAASE,KAAKC,MAAME,WAAW,wBAAwB;QACxF;IACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
3
|
import extract from 'fast-extract';
|
|
3
|
-
import access from 'fs-access-compat';
|
|
4
4
|
import mkdirp from 'mkdirp-classic';
|
|
5
5
|
import Queue from 'queue-cb';
|
|
6
6
|
export default function conditionalExtract(src, dest, options, callback) {
|
|
@@ -9,14 +9,13 @@ export default function conditionalExtract(src, dest, options, callback) {
|
|
|
9
9
|
options = null;
|
|
10
10
|
}
|
|
11
11
|
options = options || {};
|
|
12
|
-
|
|
12
|
+
fs.stat(dest, (err)=>{
|
|
13
13
|
if (!err) return callback(); // already exists
|
|
14
14
|
const queue = new Queue(1);
|
|
15
15
|
queue.defer(mkdirp.bind(null, path.dirname(dest)));
|
|
16
16
|
queue.defer(extract.bind(null, src, dest, {
|
|
17
17
|
strip: 1,
|
|
18
|
-
time: 1000
|
|
19
|
-
...options
|
|
18
|
+
time: 1000
|
|
20
19
|
}));
|
|
21
20
|
queue.await(callback);
|
|
22
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalExtract.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/conditionalExtract.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport extract from 'fast-extract';\nimport mkdirp from 'mkdirp-classic';\nimport Queue from 'queue-cb';\n\nexport default function conditionalExtract(src, dest, options, callback?) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, path.dirname(dest)));\n queue.defer(extract.bind(null, src, dest, { strip: 1, time: 1000 }));\n queue.await(callback);\n });\n}\n"],"names":["fs","path","extract","mkdirp","Queue","conditionalExtract","src","dest","options","callback","stat","err","queue","defer","bind","dirname","strip","time","await"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,aAAa,eAAe;AACnC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,WAAW,WAAW;AAE7B,eAAe,SAASC,mBAAmBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAS;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBR,GAAGU,IAAI,CAACH,MAAM,CAACI;QACb,IAAI,CAACA,KAAK,OAAOF,YAAY,iBAAiB;QAE9C,MAAMG,QAAQ,IAAIR,MAAM;QACxBQ,MAAMC,KAAK,CAACV,OAAOW,IAAI,CAAC,MAAMb,KAAKc,OAAO,CAACR;QAC3CK,MAAMC,KAAK,CAACX,QAAQY,IAAI,CAAC,MAAMR,KAAKC,MAAM;YAAES,OAAO;YAAGC,MAAM;QAAK;QACjEL,MAAMM,KAAK,CAACT;IACd;AACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FILE_PLATFORMS, FILE_PLATFORM_MAP } from '../constants.mjs';
|
|
2
|
+
import machineArch from '../machine/arch.cjs';
|
|
3
|
+
let archMachine;
|
|
4
|
+
export default function getTarget(options) {
|
|
5
|
+
let platform = options.platform;
|
|
6
|
+
let arch = options.arch;
|
|
7
|
+
if (options.filename) {
|
|
8
|
+
const filePlatform = options.filename.split('-')[0];
|
|
9
|
+
if (FILE_PLATFORMS.indexOf(filePlatform) >= 0) platform = FILE_PLATFORM_MAP[filePlatform] || filePlatform;
|
|
10
|
+
arch = options.filename.split('-')[1];
|
|
11
|
+
}
|
|
12
|
+
if (!platform) platform = process.platform;
|
|
13
|
+
if (!arch) {
|
|
14
|
+
if (!archMachine) archMachine = machineArch(); // call first time needed
|
|
15
|
+
arch = archMachine;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
platform,
|
|
19
|
+
arch
|
|
20
|
+
};
|
|
21
|
+
}
|