File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-console */
2
+
3
+ // DO NOT RUN this script yourself!
4
+ // This is invoked from the main `prepack.ts` script in `sentry-javascript/scripts/prepack.ts`.
5
+
6
+ import * as fs from 'fs' ;
7
+ import * as fse from 'fs-extra' ;
8
+ import * as path from 'path' ;
9
+
10
+ export function prepack ( buildDir : string ) : boolean {
11
+ // copy package-specific assets to build dir
12
+ const assetPath = path . resolve ( 'jsPolyfills' ) ;
13
+ try {
14
+ if ( ! fs . existsSync ( assetPath ) ) {
15
+ console . error (
16
+ "\nERROR: Missing 'packages/utils/jsPolyfills' directory. Please run `yarn build` in the `utils` package before running this script again." ,
17
+ ) ;
18
+ return false ;
19
+ }
20
+ console . log ( `Copying 'jsPolyfills' to ${ path . resolve ( buildDir , 'jsPolyfills' ) } .` ) ;
21
+ fse . copySync ( assetPath , path . resolve ( buildDir , 'jsPolyfills' ) ) ;
22
+ } catch ( error ) {
23
+ console . error ( `\nERROR: Error while copying 'jsPolyfills' to ${ buildDir } :\n${ error } ` ) ;
24
+ return false ;
25
+ }
26
+ return true ;
27
+ }
Original file line number Diff line number Diff line change 73
73
async function runPackagePrepack ( packagePrepackPath : string ) : Promise < void > {
74
74
const { prepack } = await import ( packagePrepackPath ) ;
75
75
if ( prepack && typeof prepack === 'function' ) {
76
- const isSuccess = prepack ( buildDir ) ;
76
+ const isSuccess = await prepack ( buildDir ) ;
77
77
if ( ! isSuccess ) {
78
78
process . exit ( 1 ) ;
79
79
}
You can’t perform that action at this time.
0 commit comments