1
0
mirror of https://github.com/zuiidea/antd-admin synced 2026-09-24 01:55:12 +00:00

build(create): tsup bundle and postbuild examples manifest

Made-with: Cursor
This commit is contained in:
zuiidea
2026-04-14 22:28:11 +08:00
parent cc1a803bdb
commit 02150a61a7
4 changed files with 37 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
"dist"
],
"scripts": {
"prepublishOnly": "pnpm run build",
"build": "tsup && node ./scripts/write-examples-json.mjs",
"dev": "tsup --watch",
"check-types": "tsc --noEmit",

View File

@@ -0,0 +1,20 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(__dirname, "../../..");
const appsDir = path.join(repoRoot, "apps");
const outFile = path.resolve(__dirname, "../dist/examples.json");
const exclude = new Set(["docs"]);
const names = fs
.readdirSync(appsDir, { withFileTypes: true })
.filter((d) => d.isDirectory())
.map((d) => d.name)
.filter((name) => !exclude.has(name))
.sort();
fs.mkdirSync(path.dirname(outFile), { recursive: true });
fs.writeFileSync(outFile, JSON.stringify({ examples: names }, null, 2));
console.log(`write-examples-json: wrote ${outFile}`, names);

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
console.log("create-antd-admin stub");

View File

@@ -0,0 +1,14 @@
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/cli.ts"],
format: ["esm"],
platform: "node",
target: "node20",
outDir: "dist",
clean: true,
banner: {
js: "#!/usr/bin/env node",
},
shims: false,
});