1
+ /* eslint-disable no-console */
1
2
/*
2
3
This script prepares the central `build` directory for NPM package creation.
3
4
It first copies all non-code files into the `build` directory, including `package.json`, which
@@ -47,19 +48,20 @@ ASSETS.forEach(asset => {
47
48
const tmpCopyBundles = ! process . argv . includes ( '-skipBundleCopy' ) ;
48
49
if ( tmpCopyBundles ) {
49
50
const npmTmpBundlesPath = path . resolve ( NPM_BUILD_DIR , 'build' ) ;
50
- const cdnBundlesPaht = path . resolve ( 'build' , 'bundles' ) ;
51
+ const cdnBundlesPath = path . resolve ( 'build' , 'bundles' ) ;
51
52
try {
52
53
if ( ! fs . existsSync ( npmTmpBundlesPath ) ) {
53
54
fs . mkdirSync ( npmTmpBundlesPath ) ;
54
55
}
55
- fse . copy ( cdnBundlesPaht , npmTmpBundlesPath ) ;
56
+ void fse . copy ( cdnBundlesPath , npmTmpBundlesPath ) ;
56
57
} catch ( error ) {
57
58
console . error ( `Error while tmp copying CDN bundles to ${ NPM_BUILD_DIR } ` ) ;
58
59
process . exit ( 1 ) ;
59
60
}
60
61
}
61
62
// package.json modifications
62
63
const packageJsonPath = path . resolve ( NPM_BUILD_DIR , 'package.json' ) ;
64
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
63
65
const pkgJson : { [ key : string ] : unknown } = require ( packageJsonPath ) ;
64
66
65
67
// modify entry points to point to correct paths (i.e. strip out the build directory)
@@ -75,7 +77,7 @@ delete pkgJson.jest;
75
77
try {
76
78
fs . writeFileSync ( packageJsonPath , JSON . stringify ( pkgJson , null , 2 ) ) ;
77
79
} catch ( error ) {
78
- console . error ( ` Error while writing package.json to disk` ) ;
80
+ console . error ( ' Error while writing package.json to disk' ) ;
79
81
process . exit ( 1 ) ;
80
82
}
81
83
0 commit comments