File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
packages/build-next-bricks Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 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 ( ) ;
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments