build: simplify versioning process

This commit is contained in:
EnixCoda 2020-03-08 15:17:29 +08:00
parent 05f670bb90
commit 916d718d4c
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
4 changed files with 15 additions and 54 deletions

View file

@ -1,17 +1,17 @@
{
"name": "gitako",
"version": "1.0.1",
"description": "The missing part of GitHub.",
"description": "Awesome GitHub file tree.",
"repository": "https://github.com/EnixCoda/Gitako",
"author": "EnixCoda",
"license": "MIT",
"private": true,
"homepage": "https://github.com/EnixCoda/Gitako",
"scripts": {
"start": "VERSION=dev-v$(node scripts/get-version.js) webpack --watch",
"debug-firefox": "web-ext run -s dist",
"analyse-bundle": "ANALYSE= NODE_ENV=production webpack",
"build": "VERSION=v$(node scripts/get-version.js) NODE_ENV=production webpack",
"postversion": "node scripts/version.js",
"roll": "make release"
},
"dependencies": {

View file

@ -1,29 +0,0 @@
/**
* copy version from package.json to manifest.json
* also remove old git tag for the version
*/
const fs = require('fs')
const path = require('path')
const cp = require('child_process')
const rootPath = path.resolve(__dirname, '../')
const manifestPath = path.resolve(rootPath, 'src/manifest.json')
const manifest = require(manifestPath)
const version = require('./get-version')
manifest.version = version
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, ' '), 'utf-8')
const exec = command =>
new Promise((resolve, reject) =>
cp.exec(command, (error, stdout, stderr) =>
error ? reject(error) : resolve(stdout || stderr),
),
)
exec(`git tag -d v${version}`)
.then(() => exec(`git add src/manifest.json && git commit --amend --no-edit`))
.then(() => exec(`git tag v${version}`))
.catch(console.error)

View file

@ -1,34 +1,17 @@
{
"manifest_version": 2,
"name": "Gitako - Github file tree",
"version": "1.0.1",
"description": "The missing part of GitHub.",
"author": "EnixCoda",
"name": "Gitako",
"icons": {
"64": "icons/Gitako-64.png",
"128": "icons/Gitako-128.png",
"256": "icons/Gitako-256.png"
},
"homepage_url": "https://github.com/EnixCoda/Gitako",
"permissions": [
"storage",
"*://*.github.com/*",
"*://*.sentry.io/*"
],
"web_accessible_resources": [
"icons/vscode/*",
"content.css"
],
"permissions": ["storage", "*://*.github.com/*", "*://*.sentry.io/*"],
"web_accessible_resources": ["icons/vscode/*", "content.css"],
"content_scripts": [
{
"matches": [
"https://github.com/*"
],
"js": [
"firefox-shim.js",
"browser-polyfill.js",
"content.js"
]
"matches": ["https://github.com/*"],
"js": ["firefox-shim.js", "browser-polyfill.js", "content.js"]
}
]
}
}

View file

@ -14,6 +14,13 @@ const plugins = [
{
from: './src/manifest.json',
to: 'manifest.json',
transform(content) {
const { version, description, author, homepage: homepage_url } = require('./package.json')
const manifest = JSON.parse(content)
return JSON.stringify(
Object.assign(manifest, { version, description, author, homepage_url }),
)
},
},
{
from: './src/assets/icons/*',