Skip to content

Commit 28cf9e6

Browse files
committed
feat(): support copy-jsx-d-ts
1 parent 30de503 commit 28cf9e6

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
import { existsSync } from "node:fs";
3+
import { copyFile } from "node:fs/promises";
4+
import path from "node:path";
5+
6+
const packageDir = process.cwd();
7+
const jsxDtsSrc = path.join(packageDir, "src", "jsx.d.ts");
8+
const jsxDtsDestDir = path.join(packageDir, "dist-types");
9+
const jsxDtsDest = path.join(jsxDtsDestDir, "jsx.d.ts");
10+
11+
async function copyJsxDts() {
12+
try {
13+
if (!existsSync(jsxDtsSrc)) {
14+
console.log(`Source file ${jsxDtsSrc} does not exist. Skipping copy.`);
15+
return;
16+
}
17+
18+
await copyFile(jsxDtsSrc, jsxDtsDest);
19+
console.log(`Copied ${jsxDtsSrc} to ${jsxDtsDest}`);
20+
} catch (error) {
21+
console.error("Error copying jsx.d.ts:", error);
22+
process.exit(1);
23+
}
24+
}
25+
26+
copyJsxDts();

packages/build-next-bricks/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"bin": {
1010
"build-next-bricks": "./bin/build-next-bricks.js",
1111
"pre-build-next-bricks": "./bin/pre-build-next-bricks.js",
12-
"post-build-next-bricks": "./bin/post-build-next-bricks.js"
12+
"post-build-next-bricks": "./bin/post-build-next-bricks.js",
13+
"copy-jsx-d-ts": "./bin/copy-jsx-d-ts.js"
1314
},
1415
"files": [
1516
"bin",

0 commit comments

Comments
 (0)