File tree 3 files changed +26
-2
lines changed
3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 17
17
},
18
18
"scripts" : {
19
19
"start" : " tsdx watch" ,
20
- "build" : " tsdx build --target node" ,
20
+ "addShebang" : " node ./scripts/appendShebang.js" ,
21
+ "build" : " tsdx build --target node && npm run addShebang" ,
21
22
"test" : " tsdx test" ,
22
23
"lint" : " tsdx lint" ,
23
- "prepare" : " tsdx build" ,
24
+ "prepare" : " npm run build" ,
24
25
"size" : " size-limit" ,
25
26
"analyze" : " size-limit --why"
26
27
},
52
53
"@size-limit/preset-small-lib" : " ^4.10.0" ,
53
54
"del" : " 4.1.1" ,
54
55
"husky" : " ^5.1.3" ,
56
+ "rollup-plugin-preserve-shebang" : " ^1.0.1" ,
55
57
"size-limit" : " ^4.10.0" ,
56
58
"tsdx" : " ^0.14.1" ,
57
59
"tslib" : " ^2.1.0" ,
Original file line number Diff line number Diff line change
1
+ // https://github.com/formium/tsdx/issues/793
2
+ // https://github.com/formium/tsdx/issues/338
3
+ const path = require ( 'path' ) ;
4
+ const fs = require ( 'fs' ) ;
5
+
6
+ const indexPath = path . join ( __dirname , '../dist/index.js' ) ;
7
+
8
+ const content = fs . readFileSync ( indexPath ) ;
9
+ fs . writeFile ( indexPath , `#!/usr/bin/env node\n${ content } ` , err => {
10
+ if ( err ) {
11
+ console . error ( err ) ;
12
+ process . exit ( 1 ) ;
13
+ }
14
+ console . log ( '> Successfully to add the Shebang to the dist/index.js file.' ) ;
15
+ } ) ;
Original file line number Diff line number Diff line change @@ -7226,6 +7226,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
7226
7226
hash-base "^3.0.0"
7227
7227
inherits "^2.0.1"
7228
7228
7229
+ rollup-plugin-preserve-shebang@^1.0.1 :
7230
+ version "1.0.1"
7231
+ resolved "https://registry.yarnpkg.com/rollup-plugin-preserve-shebang/-/rollup-plugin-preserve-shebang-1.0.1.tgz#17109cdb4ed12c3cac9379b802182427cdbee5a1"
7232
+ integrity sha512-gk7ExGBqvUinhgrvldKHkAKXXwRkWMXMZymNkrtn50uBgHITlhRjhnKmbNGwAIc4Bzgl3yLv7/8Fhi/XeHhFKg==
7233
+ dependencies :
7234
+ magic-string "^0.25.7"
7235
+
7229
7236
rollup-plugin-sourcemaps@^0.6.2 :
7230
7237
version "0.6.3"
7231
7238
resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.3.tgz#bf93913ffe056e414419607f1d02780d7ece84ed"
You can’t perform that action at this time.
0 commit comments