Skip to content

Commit

Permalink
fix index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-tunda committed Nov 13, 2023
1 parent ebef313 commit 635956a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@robertchaw/create-myapp",
"version": "0.0.4",
"version": "0.0.5",
"description": "",
"author": "Robert Chaw",
"homepage": "https://github.com/RobertChaw/create-myapp",
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { reset, cyan, green, lightBlue, red } from "kolorist";
import path from "path";
import fs from "fs-extra";
import * as process from "process";
import { fileURLToPath } from "node:url";

type ColorFn = (text: string | number) => string;

Expand Down Expand Up @@ -128,17 +129,18 @@ async function init() {
}));
},
onState: ({ value }) => {
templatePath = path.join(__dirname, "../templates", value);
console.log(`templatePath`, templatePath);
const dirUrl = new URL("../", import.meta.url);
const dirname = fileURLToPath(dirUrl);
templatePath = path.join(dirname, "/templates", value);
},
},
]);

copyFiles(templatePath, exportingPath);

console.log("部署完成");
console.log(`${exportingPath}`)
console.log("运行以下命令:")
console.log("部署完成:");
console.log(`${exportingPath}`);
console.log("运行以下命令:");
console.log("pnpm install");
console.log("pnpm run dev");
} catch (e) {
Expand Down

0 comments on commit 635956a

Please sign in to comment.