-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.mjs
executable file
·41 lines (30 loc) · 1000 Bytes
/
index.mjs
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
#!/usr/bin/env node
import fs from "node:fs";
import path from "node:path";
import { program } from "commander";
import { scanForAlteredFiles, scanForFiles, hasSrcDir } from "./src/git.mjs";
import { readComponentsManifest } from "./src/components.mjs";
import { createDiff } from "./src/create-diff.mjs";
program.option("-n, --name <name>");
program.parse();
const options = program.opts();
const main = () => {
const name = options.name || path.basename(process.cwd());
const { alteredFiles, specificFiles } = scanForAlteredFiles([
"./package.json",
]);
const currentFiles = scanForFiles(process.cwd());
const currentPackageJson = fs.readFileSync("./package.json", "utf-8");
const config = readComponentsManifest(process.cwd());
config.isSrcDir = hasSrcDir(process.cwd());
const output = createDiff({
name,
config,
alteredFiles,
currentFiles,
specificFiles,
currentPackageJson,
});
console.log(JSON.stringify(output, null, 2));
};
main();