forked from strapi/strapi
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlink.js
More file actions
executable file
·29 lines (22 loc) · 830 Bytes
/
link.js
File metadata and controls
executable file
·29 lines (22 loc) · 830 Bytes
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
'use strict';
const { join } = require('path');
const { promisify } = require('util');
const execa = require('execa');
const fs = require('fs-extra');
const glob = promisify(require('glob').glob);
async function run() {
const packageDirs = await glob('packages/**/*', { ignore: '**/node_modules/**' });
console.log('Linking all packages');
const packages = packageDirs
.filter((dir) => fs.pathExistsSync(join(dir, 'package.json')))
.map((dir) => {
return {
dir,
pkgJSON: fs.readJSONSync(join(dir, 'package.json')),
};
});
await Promise.all(packages.map(({ dir }) => execa('yarn', ['link'], { cwd: dir })));
const packageNames = packages.map((p) => p.pkgJSON.name).join(' ');
console.log(`Package names: \n ${packageNames}\n`);
}
run().catch((err) => console.error(err));