Skip to content

Commit 89121fe

Browse files
author
Guillaume Chau
committed
fix: better beta release process + fix isBeta
1 parent d0e5898 commit 89121fe

File tree

7 files changed

+20
-6
lines changed

7 files changed

+20
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"zip:chrome": "cd shells && zip -r -FS ../dist/chrome.zip chrome -x *src/* -x *webpack.config.js",
1515
"zip:firefox": "web-ext build -s shells/chrome -a dist -i src --overwrite-dest",
1616
"release": "node release.js && npm run test && npm run build && npm run zip",
17-
"release:beta": "cross-env CHANNEL=beta && npm run release",
17+
"release:beta": "cross-env RELEASE_CHANNEL=beta npm run release",
1818
"test": "npm run lint && npm run test:e2e",
1919
"test:e2e": "cross-env PORT=4040 start-server-and-test dev:shell http://localhost:4040 test:e2e:run",
2020
"test:e2e:run": "cypress run --config baseUrl=http://localhost:4040",

release.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const semver = require('semver')
44
const pkg = require('./package.json')
55
const manifest = require('./shells/chrome/manifest.json')
66

7-
const curVersion = manifest.version
8-
const newVersion = process.argv[2]
7+
const curVersion = pkg.version
98

109
;(async () => {
1110
const { newVersion } = await inquirer.prompt([{
@@ -31,11 +30,26 @@ const newVersion = process.argv[2]
3130
}])
3231

3332
if (yes) {
33+
const isBeta = newVersion.includes('beta')
3434
pkg.version = newVersion
35-
manifest.version = newVersion
35+
if (isBeta) {
36+
const [, baseVersion, betaVersion] = /(.*)-beta\.(\w+)/.exec(newVersion)
37+
manifest.version = `${baseVersion}.${betaVersion}`
38+
applyIcons(manifest, '-beta')
39+
} else {
40+
manifest.version = newVersion
41+
applyIcons(manifest)
42+
}
43+
3644
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2))
3745
fs.writeFileSync('./shells/chrome/manifest.json', JSON.stringify(manifest, null, 2))
3846
} else {
3947
process.exit(1)
4048
}
4149
})()
50+
51+
function applyIcons (manifest, suffix = '') {
52+
[16, 48, 128].forEach(size => {
53+
manifest.icons[size] = `icons/${size}${suffix}.png`
54+
})
55+
}

shells/chrome/icons/128-beta.png

4.51 KB
Loading

shells/chrome/icons/16-beta.png

644 Bytes
Loading

shells/chrome/icons/48-beta.png

1.71 KB
Loading

shells/createConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = (config, target = { chrome: 52, firefox: 48 }) => {
6868
new VueLoaderPlugin(),
6969
...(process.env.VUE_DEVTOOL_TEST ? [] : [new FriendlyErrorsPlugin()]),
7070
new webpack.DefinePlugin({
71-
'process.env.CHANNEL': JSON.stringify(process.env.CHANNEL || 'stable')
71+
'process.env.RELEASE_CHANNEL': JSON.stringify(process.env.RELEASE_CHANNEL || 'stable')
7272
})
7373
],
7474
devServer: {

src/devtools/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let panelShown = !isChrome
1414
let pendingAction = null
1515

1616
const isDark = isChrome ? chrome.devtools.panels.themeName === 'dark' : false
17-
const isBeta = process.env.CHANNEL === 'beta'
17+
const isBeta = process.env.RELEASE_CHANNEL === 'beta'
1818

1919
// Capture and log devtool errors when running as actual extension
2020
// so that we can debug it by inspecting the background page.

0 commit comments

Comments
 (0)