feat: exclude desktop functionality from browser target (#713)

Remove electron functionality from browser builds. Some updates to
CI scripts, based on things found in the last release.
This commit is contained in:
P.J. Little 2019-04-01 20:03:13 +02:00 коммит произвёл Wallace Breza
Родитель 74f5237993
Коммит ab3ce6f108
11 изменённых файлов: 67 добавлений и 61 удалений

Просмотреть файл

@ -13,7 +13,7 @@ steps:
# clean install
npm ci
npm run release
npm run release-ci
mkdir -p linux
cp releases/vott*.snap linux/

Просмотреть файл

@ -9,7 +9,7 @@ steps:
# clean install
npm ci
npm run release
npm run release-ci
mkdir -p mac
cp releases/vott*.dmg mac/

Просмотреть файл

@ -9,7 +9,7 @@ steps:
# clean install
npm ci
npm run release
npm run release-ci
mkdir -p windows
cp releases/vott*.exe windows/

41
package-lock.json сгенерированный
Просмотреть файл

@ -7232,8 +7232,7 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"optional": true
"bundled": true
},
"aproba": {
"version": "1.2.0",
@ -7251,13 +7250,11 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"optional": true
"bundled": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -7270,18 +7267,15 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"core-util-is": {
"version": "1.0.2",
@ -7384,8 +7378,7 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"optional": true
"bundled": true
},
"ini": {
"version": "1.3.5",
@ -7395,7 +7388,6 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -7408,20 +7400,17 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"optional": true
"bundled": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -7438,7 +7427,6 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -7511,8 +7499,7 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"object-assign": {
"version": "4.1.1",
@ -7522,7 +7509,6 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -7598,8 +7584,7 @@
},
"safe-buffer": {
"version": "5.1.1",
"bundled": true,
"optional": true
"bundled": true
},
"safer-buffer": {
"version": "2.1.2",
@ -7629,7 +7614,6 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -7647,7 +7631,6 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -7686,13 +7669,11 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"optional": true
"bundled": true
},
"yallist": {
"version": "3.0.2",
"bundled": true,
"optional": true
"bundled": true
}
}
},

Просмотреть файл

@ -65,6 +65,7 @@
"eject": "react-scripts eject",
"release-pr": "./scripts/release-pr.sh",
"release-web": "npm run build && npm run webpack:prod",
"release-ci": "./scripts/build.sh",
"release": "npm run build && npm run webpack:prod && electron-builder",
"pretest": "./node_modules/.bin/tslint 'src/**/*.ts*'",
"lintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix",

Просмотреть файл

@ -19,14 +19,14 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Visual Object Tagging Tool (VoTT)</title>
<title>Visual Object Tagging Tool (VoTT) v%REACT_APP_VERSION%</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<div id="appInfo">VoTT v%REACT_APP_VERSION%, commit=%REACT_APP_COMMIT_SHA%</div>
<div style="display: none;">VoTT v%REACT_APP_VERSION%, commit=%REACT_APP_COMMIT_SHA%</div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

18
scripts/build.sh Executable file
Просмотреть файл

@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
# NOTE: this script should be ran from the root of the repository; the CWD should reflect this
VERSION=$(node -pe "require('./package.json').version")
COMMIT_SHA=$(git rev-parse --short HEAD)
NPM_BIN_DIR=$(npm bin)
echo "cwd=$(pwd)"
echo "version=${VERSION}"
echo "commit=${COMMIT_SHA}"
export REACT_APP_VERSION=${VERSION}
export REACT_APP_COMMIT_SHA=${COMMIT_SHA}
npx react-scripts build
npx webpack -p --config ./config/webpack.prod.js
npx electron-builder

Просмотреть файл

@ -49,7 +49,9 @@ then
git tag -a ${NEW_VERSION} -m "VoTT v${NEW_VERSION}"
# update package.json version and the changelog
npm install json --no-save
# NOTE: at some point, we need to move to `npm version` and do all of this via build system
./node_modules/.bin/json -I -f package.json -4 -e "this.version=\"${NEW_VERSION}\""
./node_modules/.bin/json -I -f package-lock.json -4 -e "this.version=\"${NEW_VERSION}\""
${BASEDIR}/generate-changelog.sh --from ${PREVIOUS_VERSION} --to ${NEW_VERSION}
git commit -am "ci: update package version and changelog for ${NEW_VERSION} release"
git push -u origin ${RELEASE_BRANCH}

Просмотреть файл

@ -8,10 +8,6 @@ body {
overflow: hidden;
}
#appInfo {
display: none;
}
input[type=file] {
display: none;
}

Просмотреть файл

@ -9,6 +9,7 @@ import { AppSettingsForm } from "./appSettingsForm";
import { RouteComponentProps } from "react-router-dom";
import { toast } from "react-toastify";
import { appInfo } from "../../../../common/appInfo";
import { isElectron } from "../../../../common/hostProcess";
/**
* Props for App Settings Page
@ -67,18 +68,22 @@ export default class AppSettingsPage extends React.Component<IAppSettingsProps>
<div className="my-3">
<p>{`${strings.appSettings.commit}: `} {process.env.REACT_APP_COMMIT_SHA}</p>
</div>
<div className="my-3">
<p>{strings.appSettings.devTools.description}</p>
<button id="toggleDevTools" className="btn btn-primary btn-sm"
onClick={this.toggleDevTools}>{strings.appSettings.devTools.button}
</button>
</div>
<div className="my-3">
<p>{strings.appSettings.reload.description}</p>
<button id="refreshApp" className="btn btn-primary btn-sm"
onClick={this.reloadApp}>{strings.appSettings.reload.button}
</button>
</div>
{ isElectron() &&
<span>
<div className="my-3">
<p>{strings.appSettings.devTools.description}</p>
<button id="toggleDevTools" className="btn btn-primary btn-sm"
onClick={this.toggleDevTools}>{strings.appSettings.devTools.button}
</button>
</div>
<div className="my-3">
<p>{strings.appSettings.reload.description}</p>
<button id="refreshApp" className="btn btn-primary btn-sm"
onClick={this.reloadApp}>{strings.appSettings.reload.button}
</button>
</div>
</span>
}
</div>
</div>
);

Просмотреть файл

@ -20,6 +20,7 @@ import ImportService from "../../../../services/importService";
import { IAssetMetadata } from "../../../../models/applicationState";
import { toast } from "react-toastify";
import MessageBox from "../../common/messageBox/messageBox";
import { isElectron } from "../../../../common/hostProcess";
export interface IHomePageProps extends RouteComponentProps, React.Props<HomePage> {
recentProjects: IProject[];
@ -71,6 +72,7 @@ export default class HomePage extends React.Component<IHomePageProps, IHomePageS
<h6>{strings.homePage.newProject}</h6>
</a>
</li>
{ isElectron() &&
<li>
<a href="#" onClick={() => this.filePicker.current.upload()} className="p-5 file-upload">
<i className="fas fa-folder-open fa-9x"></i>
@ -80,6 +82,7 @@ export default class HomePage extends React.Component<IHomePageProps, IHomePageS
onChange={this.onProjectFileUpload}
onError={this.onProjectFileUploadError} />
</li>
}
<li>
{/*Open Cloud Project*/}
<a href="#" onClick={this.handleOpenCloudProjectClick} className="p-5 cloud-open-project">