-
Notifications
You must be signed in to change notification settings - Fork 35
/
packageWalletDataFiles.js
40 lines (31 loc) · 1.47 KB
/
packageWalletDataFiles.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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// Example usage:
// npm run package-wallet-data-files -- --binary "/Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary" --key-file path/to/wallet-data-files-updater.pem
import fs from 'fs-extra'
import path from 'path'
import util from '../lib/util.js'
import { getPackagingArgs, packageComponent } from './packageComponent.js'
const getOriginalManifest = (packageDir) => {
return path.join(packageDir, 'manifest.json')
}
class WalletDataFilesUpdater {
constructor () {
const originalManifest = getOriginalManifest(this.packageDir)
const parsedManifest = util.parseManifest(originalManifest)
this.componentId = util.getIDFromBase64PublicKey(parsedManifest.key)
}
packageDir = path.join('node_modules', 'brave-wallet-lists')
stagingDir = path.join('build', 'wallet-data-files-updater')
crxFile = path.join(this.stagingDir, 'wallet-data-files-updater.crx')
privateKeyFromDir (keyDir) {
return path.join(keyDir, 'wallet-data-files-updater.pem')
}
async stageFiles (version, outputDir) {
util.stageDir(this.packageDir, getOriginalManifest(this.packageDir), version, outputDir)
fs.unlinkSync(path.join(outputDir, 'package.json'))
}
}
const args = getPackagingArgs()
packageComponent(args, new WalletDataFilesUpdater())