-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.js
36 lines (28 loc) · 901 Bytes
/
publish.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
require('dotenv').config()
const Webstore = require('chrome-webstore-upload')
const clientId = process.env.CLIENT_ID
const clientSecret = process.env.CLIENT_SECRET
const refreshToken = process.env.REFRESH_TOKEN
if (!clientId || !clientSecret || !refreshToken) {
console.log('Missing configuration')
process.exit(1)
return
}
const { execSync } = require('child_process')
const { createReadStream } = require('fs')
const webStore = Webstore({
extensionId: 'bgaoaeaaplebihikpnlloglbpficgopi',
clientId,
clientSecret,
refreshToken,
})
async function publish() {
execSync('zip -r ./build.zip build')
const zippedPackage = createReadStream('./build.zip')
const token = await webStore.fetchToken()
await webStore.uploadExisting(zippedPackage, token)
console.log('Extension uploaded')
await webStore.publish('default', token)
console.log('Extension published')
}
publish()