git ssb

0+

cel-desktop / ssb-pkg



Tree: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44

Files: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44 / test / test-42-fetch-all / main.js

1366 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5const assert = require('assert');
6const fetch = require('pkg-fetch');
7const dontBuild = require('pkg-fetch/lib-es5/upload.js').dontBuild;
8const knownPlatforms = fetch.system.knownPlatforms;
9const items = [];
10
11function nodeRangeToNodeVersion (nodeRange) {
12 assert(/^node/.test(nodeRange));
13 return 'v' + nodeRange.slice(4);
14}
15
16
17for (const platform of knownPlatforms) {
18 const nodeRanges = [ 'node8', 'node10', 'node12' ];
19 if (platform === 'linux' || platform === 'alpine') nodeRanges.unshift('node6');
20 if (platform === 'linux') nodeRanges.unshift('node4');
21 for (const nodeRange of nodeRanges) {
22 const nodeVersion = nodeRangeToNodeVersion(nodeRange);
23 const archs = [ 'x64' ];
24 if (platform === 'win') archs.unshift('x86');
25 if (platform === 'linux') archs.push('armv7');
26 // linux-armv7 is needed in multi-arch tests,
27 // so keeping it here as obligatory. but let's
28 // leave compiling for freebsd to end users
29 if (platform === 'freebsd') continue;
30 for (const arch of archs) {
31 if (dontBuild(nodeVersion, platform, arch)) continue;
32 items.push({ nodeRange, platform, arch });
33 }
34 }
35}
36
37let p = Promise.resolve();
38items.forEach((item) => {
39 p = p.then(() => fetch.need(item));
40});
41
42p.catch((error) => {
43 if (!error.wasReported) console.log(`> ${error}`);
44 process.exit(2);
45});
46

Built with git-ssb-web