-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
sign-firefox.js
43 lines (37 loc) · 920 Bytes
/
sign-firefox.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
/* eslint-disable no-console */
const path = require('node:path')
const fs = require('node:fs')
const execa = require('execa')
const credFile = path.resolve(__dirname, '.amo.env.json')
if (!fs.existsSync(credFile)) {
fs.writeFileSync(credFile, JSON.stringify({
apiKey: '',
apiSecret: '',
}, null, 2), { encoding: 'utf8' })
console.log('Please provide Mozilla API credentials in .amo.env.json\nhttps://addons.mozilla.org/developers/addon/api/key/')
process.exit(1)
}
const creds = JSON.parse(fs.readFileSync(credFile, {
encoding: 'utf8',
}))
const child = execa('web-ext', [
'sign',
'--api-key',
creds.apiKey,
'--api-secret',
creds.apiSecret,
'-s',
'packages/shell-chrome',
'-a',
'dist',
'-i',
'src',
'--id',
'{c087fa6e-b59f-475d-b08d-f03fef34fa7f}',
], {
shell: true,
stdio: ['inherit', 'inherit', 'inherit'],
})
child.on('exit', (code) => {
process.exit(code)
})