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.
Esse commit está contido em:
P.J. Little
2019-04-01 20:03:13 +02:00
commit de Wallace Breza
commit ab3ce6f108
11 arquivos alterados com 67 adições e 61 exclusões
+4 -4
Ver Arquivo
@@ -8,13 +8,13 @@ steps:
inputs: inputs:
versionSpec: 10.x versionSpec: 10.x
- bash: | - bash: |
set -ex set -ex
# clean install # clean install
npm ci npm ci
npm run release npm run release-ci
mkdir -p linux mkdir -p linux
cp releases/vott*.snap linux/ cp releases/vott*.snap linux/
displayName: Build displayName: Build
+4 -4
Ver Arquivo
@@ -4,13 +4,13 @@ steps:
inputs: inputs:
versionSpec: 10.x versionSpec: 10.x
- bash: | - bash: |
set -ex set -ex
# clean install # clean install
npm ci npm ci
npm run release npm run release-ci
mkdir -p mac mkdir -p mac
cp releases/vott*.dmg mac/ cp releases/vott*.dmg mac/
displayName: Build displayName: Build
@@ -4,16 +4,16 @@ steps:
inputs: inputs:
versionSpec: 10.x versionSpec: 10.x
- bash: | - bash: |
set -ex set -ex
# clean install # clean install
npm ci npm ci
npm run release npm run release-ci
mkdir -p windows mkdir -p windows
cp releases/vott*.exe windows/ cp releases/vott*.exe windows/
displayName: Build displayName: Build
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
+11 -30
Ver Arquivo
@@ -7232,8 +7232,7 @@
}, },
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true, "bundled": true
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@@ -7251,13 +7250,11 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@@ -7270,18 +7267,15 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@@ -7384,8 +7378,7 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@@ -7395,7 +7388,6 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@@ -7408,20 +7400,17 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@@ -7438,7 +7427,6 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@@ -7511,8 +7499,7 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@@ -7522,7 +7509,6 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@@ -7598,8 +7584,7 @@
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.1", "version": "5.1.1",
"bundled": true, "bundled": true
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@@ -7629,7 +7614,6 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@@ -7647,7 +7631,6 @@
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@@ -7686,13 +7669,11 @@
}, },
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.2", "version": "3.0.2",
"bundled": true, "bundled": true
"optional": true
} }
} }
}, },
+1
Ver Arquivo
@@ -65,6 +65,7 @@
"eject": "react-scripts eject", "eject": "react-scripts eject",
"release-pr": "./scripts/release-pr.sh", "release-pr": "./scripts/release-pr.sh",
"release-web": "npm run build && npm run webpack:prod", "release-web": "npm run build && npm run webpack:prod",
"release-ci": "./scripts/build.sh",
"release": "npm run build && npm run webpack:prod && electron-builder", "release": "npm run build && npm run webpack:prod && electron-builder",
"pretest": "./node_modules/.bin/tslint 'src/**/*.ts*'", "pretest": "./node_modules/.bin/tslint 'src/**/*.ts*'",
"lintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix", "lintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix",
+2 -2
Ver Arquivo
@@ -19,14 +19,14 @@
work correctly both with client-side routing and a non-root public URL. 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`. 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> </head>
<body> <body>
<noscript> <noscript>
You need to enable JavaScript to run this app. You need to enable JavaScript to run this app.
</noscript> </noscript>
<div id="root"></div> <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. This HTML file is a template.
If you open it directly in the browser, you will see an empty page. If you open it directly in the browser, you will see an empty page.
Arquivo executável
+18
Ver Arquivo
@@ -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
+2
Ver Arquivo
@@ -49,7 +49,9 @@ then
git tag -a ${NEW_VERSION} -m "VoTT v${NEW_VERSION}" git tag -a ${NEW_VERSION} -m "VoTT v${NEW_VERSION}"
# update package.json version and the changelog # update package.json version and the changelog
npm install json --no-save 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.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} ${BASEDIR}/generate-changelog.sh --from ${PREVIOUS_VERSION} --to ${NEW_VERSION}
git commit -am "ci: update package version and changelog for ${NEW_VERSION} release" git commit -am "ci: update package version and changelog for ${NEW_VERSION} release"
git push -u origin ${RELEASE_BRANCH} git push -u origin ${RELEASE_BRANCH}
-4
Ver Arquivo
@@ -8,10 +8,6 @@ body {
overflow: hidden; overflow: hidden;
} }
#appInfo {
display: none;
}
input[type=file] { input[type=file] {
display: none; display: none;
} }
@@ -9,6 +9,7 @@ import { AppSettingsForm } from "./appSettingsForm";
import { RouteComponentProps } from "react-router-dom"; import { RouteComponentProps } from "react-router-dom";
import { toast } from "react-toastify"; import { toast } from "react-toastify";
import { appInfo } from "../../../../common/appInfo"; import { appInfo } from "../../../../common/appInfo";
import { isElectron } from "../../../../common/hostProcess";
/** /**
* Props for App Settings Page * Props for App Settings Page
@@ -67,18 +68,22 @@ export default class AppSettingsPage extends React.Component<IAppSettingsProps>
<div className="my-3"> <div className="my-3">
<p>{`${strings.appSettings.commit}: `} {process.env.REACT_APP_COMMIT_SHA}</p> <p>{`${strings.appSettings.commit}: `} {process.env.REACT_APP_COMMIT_SHA}</p>
</div> </div>
<div className="my-3"> { isElectron() &&
<p>{strings.appSettings.devTools.description}</p> <span>
<button id="toggleDevTools" className="btn btn-primary btn-sm" <div className="my-3">
onClick={this.toggleDevTools}>{strings.appSettings.devTools.button} <p>{strings.appSettings.devTools.description}</p>
</button> <button id="toggleDevTools" className="btn btn-primary btn-sm"
</div> onClick={this.toggleDevTools}>{strings.appSettings.devTools.button}
<div className="my-3"> </button>
<p>{strings.appSettings.reload.description}</p> </div>
<button id="refreshApp" className="btn btn-primary btn-sm" <div className="my-3">
onClick={this.reloadApp}>{strings.appSettings.reload.button} <p>{strings.appSettings.reload.description}</p>
</button> <button id="refreshApp" className="btn btn-primary btn-sm"
</div> onClick={this.reloadApp}>{strings.appSettings.reload.button}
</button>
</div>
</span>
}
</div> </div>
</div> </div>
); );
@@ -20,6 +20,7 @@ import ImportService from "../../../../services/importService";
import { IAssetMetadata } from "../../../../models/applicationState"; import { IAssetMetadata } from "../../../../models/applicationState";
import { toast } from "react-toastify"; import { toast } from "react-toastify";
import MessageBox from "../../common/messageBox/messageBox"; import MessageBox from "../../common/messageBox/messageBox";
import { isElectron } from "../../../../common/hostProcess";
export interface IHomePageProps extends RouteComponentProps, React.Props<HomePage> { export interface IHomePageProps extends RouteComponentProps, React.Props<HomePage> {
recentProjects: IProject[]; recentProjects: IProject[];
@@ -71,6 +72,7 @@ export default class HomePage extends React.Component<IHomePageProps, IHomePageS
<h6>{strings.homePage.newProject}</h6> <h6>{strings.homePage.newProject}</h6>
</a> </a>
</li> </li>
{ isElectron() &&
<li> <li>
<a href="#" onClick={() => this.filePicker.current.upload()} className="p-5 file-upload"> <a href="#" onClick={() => this.filePicker.current.upload()} className="p-5 file-upload">
<i className="fas fa-folder-open fa-9x"></i> <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} onChange={this.onProjectFileUpload}
onError={this.onProjectFileUploadError} /> onError={this.onProjectFileUploadError} />
</li> </li>
}
<li> <li>
{/*Open Cloud Project*/} {/*Open Cloud Project*/}
<a href="#" onClick={this.handleOpenCloudProjectClick} className="p-5 cloud-open-project"> <a href="#" onClick={this.handleOpenCloudProjectClick} className="p-5 cloud-open-project">