fix template dir location
This commit is contained in:
12
index.ts
12
index.ts
@@ -3,7 +3,7 @@
|
|||||||
import * as p from "@clack/prompts";
|
import * as p from "@clack/prompts";
|
||||||
import { initRenderer } from '@gregorlohaus/tdir'
|
import { initRenderer } from '@gregorlohaus/tdir'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import join from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
p.intro("create-glstack");
|
p.intro("create-glstack");
|
||||||
|
|
||||||
@@ -35,22 +35,22 @@ const project = await p.group(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const createRenderer = initRenderer('./template')
|
const createRenderer = initRenderer(path.join(import.meta.dir, 'template'))
|
||||||
const render = createRenderer(z.object({
|
const render = createRenderer(z.object({
|
||||||
project: z.object({
|
project: z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
goprefix: z.string()
|
goprefix: z.string()
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
const destDir = join.join("./",project.name);
|
const destDir = path.join("./",project.name);
|
||||||
render(destDir,{project})
|
render(destDir,{project})
|
||||||
// TODO: template rendering — copy/generate files into destDir
|
// TODO: template rendering — copy/generate files into destDir
|
||||||
|
|
||||||
const s = p.spinner();
|
const s = p.spinner();
|
||||||
s.start("Installing dependencies");
|
s.start("Installing dependencies");
|
||||||
await Bun.$`bun install`.cwd(join.join(destDir)).quiet();
|
await Bun.$`bun install`.cwd(path.join(destDir)).quiet();
|
||||||
await Bun.$`bun install`.cwd(join.join(destDir,'packages','rpc')).quiet();
|
await Bun.$`bun install`.cwd(path.join(destDir,'packages','rpc')).quiet();
|
||||||
await Bun.$`bun install`.cwd(join.join(destDir,'apps','web')).quiet();
|
await Bun.$`bun install`.cwd(path.join(destDir,'apps','web')).quiet();
|
||||||
s.stop("Dependencies installed.");
|
s.stop("Dependencies installed.");
|
||||||
|
|
||||||
p.outro("You're all set!");
|
p.outro("You're all set!");
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"template"
|
"template"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "bun build ./index.ts --outdir ./dist --target node",
|
"build": "bun build ./index.ts --outdir ./dist --target bun",
|
||||||
"prepublishOnly": "bun run build"
|
"prepublishOnly": "bun run build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user