-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathdebug-generate-packages.js
More file actions
46 lines (38 loc) · 1.08 KB
/
debug-generate-packages.js
File metadata and controls
46 lines (38 loc) · 1.08 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
const glob = require('glob');
const path = require('path');
const fse = require('fs-extra');
const packagePath = process.cwd();
const src = path.resolve(packagePath, './src');
console.log('packagePath:', packagePath);
console.log('src:', src);
async function generatePackages() {
const directories = glob
.sync(`${src}/*/`)
.filter((name) => !name.includes('/tests/'))
.map((path) =>
path
.replace(/\/$/, '')
.split('/')
.pop()
);
console.log('Found directories:', directories);
directories.forEach((dir) => {
const targetPath = path.resolve(packagePath, dir, 'package.json');
const targetDir = path.resolve(packagePath, dir);
console.log(`Directory: ${dir}`);
console.log(` Target dir: ${targetDir}`);
console.log(` Target path: ${targetPath}`);
console.log(` Directory exists: ${fse.existsSync(targetDir)}`);
});
// Don't actually write anything yet
return Promise.resolve();
}
async function run() {
try {
await generatePackages();
} catch (err) {
console.error(err);
process.exit(1);
}
}
run();