File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 1111 "typecheck" : " tsc --noEmit" ,
1212 "clean" : " git clean -dfX" ,
1313 "release" : " semantic-release" ,
14- "build" : " npm run typecheck && bob build" ,
14+ "build" : " npm run typecheck && bob build && node ./scripts/remove-source-maps.cjs " ,
1515 "codegen" : " nitrogen --logLevel=\" debug\" && npm run build && node post-script.js" ,
1616 "prepublish" : " yarn codegen"
1717 },
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ const path = require ( 'path' )
4+ const { promises : fs } = require ( 'fs' )
5+
6+ async function removeMaps ( directory ) {
7+ const entries = await fs . readdir ( directory , { withFileTypes : true } )
8+
9+ await Promise . all (
10+ entries . map ( async ( entry ) => {
11+ const entryPath = path . join ( directory , entry . name )
12+
13+ if ( entry . isDirectory ( ) ) {
14+ await removeMaps ( entryPath )
15+ return
16+ }
17+
18+ if ( entry . isFile ( ) && entry . name . endsWith ( '.map' ) ) {
19+ await fs . unlink ( entryPath )
20+ }
21+ } )
22+ )
23+ }
24+
25+ async function main ( ) {
26+ const libPath = path . join ( __dirname , '..' , 'lib' )
27+
28+ try {
29+ await fs . access ( libPath )
30+ } catch {
31+ return
32+ }
33+
34+ await removeMaps ( libPath )
35+ }
36+
37+ main ( ) . catch ( ( error ) => {
38+ console . error ( 'Failed to remove source maps from lib directory:' , error )
39+ process . exitCode = 1
40+ } )
You can’t perform that action at this time.
0 commit comments