feat(cli): serve to show mcfly & nitro version
This commit is contained in:
parent
92e468e717
commit
52b0c69db7
3 changed files with 29 additions and 10 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -3970,11 +3970,12 @@
|
||||||
},
|
},
|
||||||
"packages/cli": {
|
"packages/cli": {
|
||||||
"name": "@mcflyjs/cli",
|
"name": "@mcflyjs/cli",
|
||||||
"version": "0.0.19",
|
"version": "0.0.20",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"citty": "^0.1.4",
|
"citty": "^0.1.4",
|
||||||
"consola": "^3.2.3"
|
"consola": "^3.2.3",
|
||||||
|
"pathe": "^1.1.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"mcfly": "index.js"
|
"mcfly": "index.js"
|
||||||
|
@ -4043,13 +4044,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"templates/basic/node_modules/@mcflyjs/cli": {
|
"templates/basic/node_modules/@mcflyjs/cli": {
|
||||||
"version": "0.0.18",
|
"version": "0.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/@mcflyjs/cli/-/cli-0.0.18.tgz",
|
"resolved": "https://registry.npmjs.org/@mcflyjs/cli/-/cli-0.0.19.tgz",
|
||||||
"integrity": "sha512-ILYAL1wkZALucplgahIcRW8eExoiRzPC4+/i8cCcEaDU2TGJOxWDS3FKyiRoNfjNwmHlCnXEAvT1AqaNvHRrIg==",
|
"integrity": "sha512-dVicZeoL9Gkggbj2qQhXd7dzK7ZOLvh/fBwGVeHoCGEDzZAOIxgaqXl3wYrGcZIGTO6wGmLIqnaO3y3ZykLzPg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"citty": "^0.1.4",
|
"citty": "^0.1.4",
|
||||||
"consola": "^3.2.3",
|
"consola": "^3.2.3"
|
||||||
"web-component-base": "^1.9.5"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"mcfly": "index.js"
|
"mcfly": "index.js"
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { consola } from "consola";
|
import { consola } from "consola";
|
||||||
|
import { colorize } from "consola/utils";
|
||||||
import { defineCommand } from "citty";
|
import { defineCommand } from "citty";
|
||||||
import { execSync as exec } from "child_process";
|
import { execSync as exec } from "node:child_process";
|
||||||
|
import { createRequire } from "node:module";
|
||||||
|
|
||||||
export default defineCommand({
|
export default defineCommand({
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -10,6 +12,22 @@ export default defineCommand({
|
||||||
description: "Runs the dev server.",
|
description: "Runs the dev server.",
|
||||||
},
|
},
|
||||||
async run() {
|
async run() {
|
||||||
|
try {
|
||||||
|
const _require = createRequire(import.meta.url);
|
||||||
|
const mcflyPkg = await _require("@mcflyjs/core/package.json");
|
||||||
|
const mcflyPkgVersion = `McFly ${mcflyPkg.version}`;
|
||||||
|
const nitroPkg = await _require("nitropack/package.json");
|
||||||
|
const nitroPkgVersion = `Nitro ${nitroPkg.version}`;
|
||||||
|
consola.log(
|
||||||
|
`${colorize("blue", mcflyPkgVersion)} ${colorize(
|
||||||
|
"dim",
|
||||||
|
nitroPkgVersion
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
consola.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
exec(`npx nitropack dev`, { stdio: "inherit" });
|
exec(`npx nitropack dev`, { stdio: "inherit" });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@mcflyjs/cli",
|
"name": "@mcflyjs/cli",
|
||||||
"version": "0.0.19",
|
"version": "0.0.20",
|
||||||
"description": "McFly CLI tools",
|
"description": "McFly CLI tools",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
"homepage": "https://github.com/ayoayco/McFly#readme",
|
"homepage": "https://github.com/ayoayco/McFly#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"citty": "^0.1.4",
|
"citty": "^0.1.4",
|
||||||
"consola": "^3.2.3"
|
"consola": "^3.2.3",
|
||||||
|
"pathe": "^1.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue