-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.mjs
More file actions
38 lines (27 loc) · 788 Bytes
/
generate.mjs
File metadata and controls
38 lines (27 loc) · 788 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
30
31
32
33
34
35
import fs from 'fs';
import path from 'path';
const manifest = {
name: '@sidekick-coder/lab-core',
version: '0.0.1',
items: [],
}
const items = fs.readdirSync('./src');
const optional = [
'.spec.ts',
'.test.ts',
'.spec-d.ts',
]
for (const folder of items) {
const files = fs.readdirSync(`./src/${folder}`);
const item = {
name: folder,
files: files.map(file => ({
name: path.basename(file, path.extname(file)),
path: `./src/${folder}/${file}`,
optional: optional.some(ext => file.endsWith(ext)),
}))
}
manifest.items.push(item);
}
const manifestPath = path.join(import.meta.dirname, 'manifest.json');
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), 'utf-8');