-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·54 lines (42 loc) · 1.6 KB
/
Copy pathindex.js
File metadata and controls
executable file
·54 lines (42 loc) · 1.6 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
47
48
49
50
51
52
53
54
#!/usr/bin/env node
const { Command } = require("commander");
const fs = require("fs-extra");
const path = require("path");
const packageJsonPath = path.join(__dirname, "package.json");
const packageJson = fs.readJsonSync(packageJsonPath);
const checkForUpdates = require("./src/utils/check-for-updates");
const newCommand = require("./src/commands/new");
const generateCommand = require("./src/commands/generate");
const updateCommand = require("./src/commands/update");
const translateCommand = require("./src/commands/translate");
const configCommand = require("./src/commands/config");
const program = new Command();
program
.name("nitrokit")
.description("A CLI to help create and manage Nitrokit projects.")
.version(packageJson.version);
program.command(newCommand.command)
.description(newCommand.description)
.argument(`<project-name>`, newCommand.argumentDescription)
.action(newCommand.action);
program.command(generateCommand.command)
.description(generateCommand.description)
.argument(...generateCommand.argument)
.action(generateCommand.action);
program.command(translateCommand.command)
.description(translateCommand.description)
.action(translateCommand.action);
program.command(configCommand.command)
.description(configCommand.description)
.action(configCommand.action);
const updateCmd = program
.command(updateCommand.command)
.description(updateCommand.description)
.action(updateCommand.action);
updateCommand.options.forEach(option => {
updateCmd.option(...option);
});
(async () => {
await checkForUpdates(packageJson);
await program.parseAsync(process.argv);
})();