-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (33 loc) · 953 Bytes
/
index.js
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 inquirer from "inquirer";
import chalkAnimation from "chalk-animation";
import { extractCurrent, extractPath } from "./src/extractors.js";
const sleep = (ms = 1000) => new Promise((r) => setTimeout(r, ms));
async function depextract() {
const rainbowTitle = chalkAnimation.rainbow(
"depextract: Dependency extractor for package.json \n"
);
await sleep();
rainbowTitle.stop();
}
async function handleOperation(selectedOperation) {
if (selectedOperation === "current directory") {
extractCurrent();
} else {
extractPath();
}
}
async function selectOperation() {
const selection = await inquirer.prompt({
name: "operation",
type: "list",
message: "Select location of package.json\n",
choices: [
"current directory",
"another directory (provide path in next step)",
],
});
handleOperation(selection.operation);
}
await depextract();
await selectOperation();