feat(cli): better info on prepare script
This commit is contained in:
parent
9c7cd8c43c
commit
969a9ddd76
3 changed files with 16 additions and 8 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -3970,7 +3970,7 @@
|
|||
},
|
||||
"packages/cli": {
|
||||
"name": "@mcflyjs/cli",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.11",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"citty": "^0.1.4",
|
||||
|
@ -4031,9 +4031,9 @@
|
|||
}
|
||||
},
|
||||
"templates/basic/node_modules/@mcflyjs/cli": {
|
||||
"version": "0.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@mcflyjs/cli/-/cli-0.0.9.tgz",
|
||||
"integrity": "sha512-3U49X0CZD8lF2okURNos6OUmyvJkOLClsQ/kssLElN2hotm6csmg7XQc3dxA9KYZctouPbbBqOUPDVw86p1CVQ==",
|
||||
"version": "0.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@mcflyjs/cli/-/cli-0.0.10.tgz",
|
||||
"integrity": "sha512-Nhig+bnQbgwX5IYoIMYjZzdWsMAfPpwx0edzvgHdtU87zLcJsPU/k4PfXl6t/rIwLwviIieHyNqZlImlj289gA==",
|
||||
"dependencies": {
|
||||
"citty": "^0.1.4",
|
||||
"consola": "^3.2.3",
|
||||
|
|
|
@ -17,13 +17,14 @@ export default defineCommand({
|
|||
async run({ args }) {
|
||||
const typeDefinition = `\n/// <reference path="./mcfly-imports.d.ts" />`;
|
||||
const globalDefinition = `import {WebComponent as W} from "web-component-base/WebComponent.mjs"; declare global {class WebComponent extends W {}}export {WebComponent} from 'web-component-base/WebComponent.mjs';`;
|
||||
let hasErrors = false;
|
||||
|
||||
consola.info("ola");
|
||||
|
||||
consola.start("Preparing McFly workspace...");
|
||||
try {
|
||||
exec("npx nitropack prepare", { stdio: "inherit" });
|
||||
} catch (e) {
|
||||
consola.error(e);
|
||||
hasErrors = true;
|
||||
}
|
||||
|
||||
if (existsSync(".nitro/types/nitro.d.ts")) {
|
||||
|
@ -31,16 +32,23 @@ export default defineCommand({
|
|||
writeFileSync(".nitro/types/mcfly-imports.d.ts", globalDefinition);
|
||||
} catch (e) {
|
||||
consola.error(e);
|
||||
hasErrors = true;
|
||||
}
|
||||
try {
|
||||
appendFileSync(".nitro/types/nitro.d.ts", typeDefinition);
|
||||
} catch (e) {
|
||||
consola.error(e);
|
||||
hasErrors = true;
|
||||
}
|
||||
} else {
|
||||
consola.log(
|
||||
consola.fail(
|
||||
"Preparation Failed. Please run:\n> npx nitropack prepare && npx mcfly prepare"
|
||||
);
|
||||
hasErrors = true;
|
||||
}
|
||||
|
||||
if (!hasErrors) {
|
||||
consola.success("Done!");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@mcflyjs/cli",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.11",
|
||||
"description": "McFly CLI tools",
|
||||
"type": "module",
|
||||
"main": "index.mjs",
|
||||
|
|
Loading…
Reference in a new issue