Merge branch 'feature/makefile' into develop

This commit is contained in:
EnixCoda 2019-11-10 15:09:03 +08:00
commit 9cff1a2985
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
7 changed files with 36 additions and 36 deletions

21
Makefile Executable file
View file

@ -0,0 +1,21 @@
build:
rm -rf dist
yarn build
upload-for-analytics:
VERSION=v$(node scripts/get-version.js)
# make sure sentry can retrieve current commit on remote
git push --tags
yarn sentry-cli releases new "$(VERSION)"
yarn sentry-cli releases set-commits "$(VERSION)" --auto
yarn sentry-cli releases files "$(VERSION)" upload-sourcemaps dist --no-rewrite
yarn sentry-cli releases finalize "$(VERSION)"
compress:
rm -f dist/gitako.zip
cd dist && zip -r gitako.zip * -x *.map
release:
$(MAKE) build
$(MAKE) upload-for-analytics
$(MAKE) compress

View file

@ -7,12 +7,12 @@
"license": "MIT",
"private": true,
"scripts": {
"start": "webpack --watch",
"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": "NODE_ENV=production webpack",
"build": "VERSION=v$(node scripts/get-version.js) NODE_ENV=production webpack",
"postversion": "node scripts/version.js",
"roll": "./scripts/release.sh"
"roll": "make release"
},
"dependencies": {
"@primer/octicons": "^9.2.0",

View file

@ -1,18 +0,0 @@
#!/bin/sh
rm -rf dist
yarn build
GIT_SHA=$(git rev-parse HEAD)
VERSION=v$(node scripts/get-version.js)
echo "Got version $VERSION"
# sentry
git push --tags # make sure sentry can retrieve current commit on remote
yarn sentry-cli releases new "$VERSION"
yarn sentry-cli releases set-commits "$VERSION" --auto
yarn sentry-cli releases files "$VERSION" upload-sourcemaps dist --no-rewrite
yarn sentry-cli releases finalize "$VERSION"
cd dist
rm -f ./gitako.zip
zip -r gitako.zip * -x *.map

View file

@ -1,14 +1,13 @@
import * as Sentry from '@sentry/browser'
import { Middleware } from 'driver/connect.js'
import { IN_PRODUCTION_MODE } from 'env'
import { version } from '../package.json'
import { IN_PRODUCTION_MODE, VERSION } from 'env'
const PUBLIC_KEY = 'd22ec5c9cc874539a51c78388c12e3b0'
const PROJECT_ID = '1406497'
const sentryOptions: Sentry.BrowserOptions = {
dsn: `https://${PUBLIC_KEY}@sentry.io/${PROJECT_ID}`,
release: `v${version}`,
release: VERSION,
environment: IN_PRODUCTION_MODE ? 'production' : 'development',
// Not safe to activate all integrations in non-Chrome environments where Gitako may not run in top context
// https://docs.sentry.io/platforms/javascript/#sdk-integrations

View file

@ -1,11 +1,10 @@
import { raiseError } from 'analytics'
import { Icon } from 'components/Icon'
import { oauth } from 'env'
import { oauth, VERSION } from 'env'
import * as React from 'react'
import { Config, configKeys, setOne } from 'utils/configHelper'
import { friendlyFormatShortcut, JSONRequest, parseURLSearch } from 'utils/general'
import * as keyHelper from 'utils/keyHelper'
import { version } from '../../package.json'
const WIKI_HOME_LINK = 'https://github.com/EnixCoda/Gitako/wiki'
const wikiLinks = {
@ -348,7 +347,7 @@ export class SettingsBar extends React.PureComponent<Props, State> {
target={'_blank'}
title={'Check out new features!'}
>
v{version}
{VERSION}
</a>
{activated ? (
<Icon

View file

@ -9,3 +9,5 @@ export const oauth = {
clientId: process.env.GITHUB_OAUTH_CLIENT_ID,
clientSecret: process.env.GITHUB_OAUTH_CLIENT_SECRET,
}
export const VERSION = process.env.VERSION

View file

@ -38,15 +38,12 @@ if (analyse) {
}
const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
if (IN_PRODUCTION_MODE) {
plugins.push(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
)
}
plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.VERSION': JSON.stringify(process.env.VERSION),
}),
)
module.exports = {
entry: {