|
2 | 2 |
|
3 | 3 | import process from "node:process"; |
4 | 4 | import { Command } from "commander"; |
5 | | -import consola from "consola"; |
6 | 5 | import updateNotifier from "update-notifier"; |
7 | 6 | import pkg from "../package.json"; |
| 7 | +import { Log } from "./utils/log.js"; |
8 | 8 | import { Build, Config, Release, Serve } from "./index.js"; |
9 | 9 |
|
| 10 | +const logger = new Log(); |
| 11 | + |
10 | 12 | export default async function main() { |
11 | 13 | updateNotifier({ pkg }).notify(); |
12 | 14 |
|
@@ -53,38 +55,38 @@ export default async function main() { |
53 | 55 | .command("create") |
54 | 56 | .description("Create the plugin template.") |
55 | 57 | .action((_options: any) => { |
56 | | - consola.error("The create not yet implemented"); |
| 58 | + logger.error("The create not yet implemented"); |
57 | 59 | // new Create().run(); |
58 | 60 | }); |
59 | 61 |
|
60 | 62 | cli |
61 | 63 | .command("release") |
62 | 64 | .description("Release.") |
63 | 65 | .action(async (_options: any) => { |
64 | | - // consola.error("The release not yet implemented"); |
| 66 | + // logger.error("The release not yet implemented"); |
65 | 67 | process.env.NODE_ENV = "production"; |
66 | 68 | const config = await Config.loadConfig({}); |
67 | 69 | new Release(config).run(); |
68 | 70 | }); |
69 | 71 |
|
70 | 72 | cli.arguments("<command>").action((cmd) => { |
71 | 73 | cli.outputHelp(); |
72 | | - consola.error(`Unknown command name=${cmd}.`); |
| 74 | + logger.error(`Unknown command name=${cmd}.`); |
73 | 75 | }); |
74 | 76 |
|
75 | 77 | cli.parse(); |
76 | 78 | } |
77 | 79 |
|
78 | 80 | main().catch((err) => { |
79 | | - console.log(""); |
80 | | - consola.error(err); |
81 | | - console.log(""); |
| 81 | + logger.newLine(); |
| 82 | + logger.error(err); |
| 83 | + logger.newLine(); |
82 | 84 | process.exit(1); |
83 | 85 | }); |
84 | 86 |
|
85 | 87 | process.on("unhandledRejection", (err) => { |
86 | | - console.log(""); |
87 | | - consola.error(err); |
88 | | - console.log(""); |
| 88 | + logger.newLine(); |
| 89 | + logger.error(err); |
| 90 | + logger.newLine(); |
89 | 91 | process.exit(1); |
90 | 92 | }); |
0 commit comments