File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 48
48
"scripts" : {
49
49
"postinstall" : " node postinstall.js" ,
50
50
"artifacts" : " napi artifacts --npm-dir scripts/npm" ,
51
- "prepack" : " tsc -d && napi prepublish -p scripts/npm --tag-style npm" ,
51
+ "prepack" : " tsc -d && napi prepublish -p scripts/npm --tag-style npm && node scripts/copy-readme.js " ,
52
52
"pack" : " wasm-pack" ,
53
53
"build:ts" : " tsc -d" ,
54
54
"build:wasm" : " npm-run-all \" pack -- build ../../bindings/binding_core_wasm --scope swc {1} -t {2} --features plugin\" --" ,
Original file line number Diff line number Diff line change
1
+ /**
2
+ * This script copies the README.md from the repository root to the packages/core directory
3
+ * to ensure it's properly included in the npm package.
4
+ */
5
+ const fs = require ( 'fs' ) ;
6
+ const path = require ( 'path' ) ;
7
+
8
+ // Path to the project root README.md and the packages/core README.md
9
+ const rootReadmePath = path . resolve ( __dirname , '../../../README.md' ) ;
10
+ const packageReadmePath = path . resolve ( __dirname , '../README.md' ) ;
11
+
12
+ try {
13
+ // Check if root README exists
14
+ if ( ! fs . existsSync ( rootReadmePath ) ) {
15
+ console . error ( 'Root README.md does not exist:' , rootReadmePath ) ;
16
+ process . exit ( 1 ) ;
17
+ }
18
+
19
+ // Copy the README.md file
20
+ fs . copyFileSync ( rootReadmePath , packageReadmePath ) ;
21
+ console . log ( 'Successfully copied README.md to packages/core for npm publishing.' ) ;
22
+ } catch ( error ) {
23
+ console . error ( 'Error copying README.md:' , error ) ;
24
+ process . exit ( 1 ) ;
25
+ }
You can’t perform that action at this time.
0 commit comments