forked from handsontable/handsontable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-subpackages.mjs
More file actions
53 lines (44 loc) · 1.62 KB
/
install-subpackages.mjs
File metadata and controls
53 lines (44 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* Run the npm install command for the examples monorepo and all of the framework mini-monorepos.
*/
import execa from 'execa';
import thisPackageJson from '../package.json' with { type: 'json' };
import glob from 'glob';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import {
spawnProcess,
displayErrorMessage
} from '../../scripts/utils/index.mjs';
const argv = yargs(hideBin(process.argv))
.boolean('skip-clean')
.default('skip-clean', false)
.argv;
const [version] = argv._;
if (!version) {
displayErrorMessage('Version for the examples was not provided.');
process.exit(1);
}
if (!argv.skipClean) {
// Clean node_modules, package-lock and /dist/ for the versioned subpackages.
await spawnProcess(`node ./scripts/clean-subpackages.mjs ${version}`);
}
// Run `npm i` for all the examples in the versioned directory.
for (const frameworkPackage of thisPackageJson.internal.framework_dirs) {
const frameworkUrls = glob.sync(`${frameworkPackage}`);
for (const frameworkUrl of frameworkUrls) {
if ((version && frameworkUrl.startsWith(version))) {
console.log(`\nRunning npm install for ${frameworkUrl}:\n`);
await spawnProcess('npm install --no-audit', {
cwd: frameworkUrl
});
}
}
// Link the main-level packages from the base ./node_modules to the local ./node_modules (to be read by the
// examples).
await spawnProcess([
'node ./scripts/link-packages.mjs',
'--f js ts angular angular-wrapper angular-12 angular-13 angular-14 angular-15 angular-16 angular-17 react react-wrapper vue vue3',
`--examples-version ${version}`,
].join(' '));
}