-
Notifications
You must be signed in to change notification settings - Fork 51
/
afterPack.js
52 lines (41 loc) · 1.2 KB
/
afterPack.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env node
const path = require( 'path' );
const fs = require( 'fs-extra' );
const thePackage = require( './package' );
const { platform } = process;
const MAC = 'darwin';
const LINUX = 'linux';
const WINDOWS = 'win32';
// let CONTAINING_FOLDER;
// AfterPackContext {
// outDir: string
// appOutDir: string
// packager: PlatformPackager<any>
// electronPlatformName: string
// arch: Arch
// targets: Array<Target>
// }
module.exports = async ( AfterPackContext ) => {
// const targetDir = path.resolve( __dirname, 'release' );
const CONTAINING_FOLDER = AfterPackContext.appOutDir;
let APP_ITSELF_DIR = AfterPackContext.appOutDir;
if ( platform === MAC )
APP_ITSELF_DIR = path.resolve(
AfterPackContext.appOutDir,
'SAFE Browser.app/Contents/Resources'
);
// add version file
fs.outputFileSync(
path.resolve( APP_ITSELF_DIR, 'version' ),
thePackage.version
);
// remove licenses
const removalArray = [
'LICENSE.electron.txt',
'LICENSES.chromium.html',
'LICENSE'
];
removalArray.forEach( ( file ) => {
fs.removeSync( `${CONTAINING_FOLDER}/${file}` );
} );
};