Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Removing PropTypes on build #2322

Merged
merged 3 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions js/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"presets": ["es2017", "es2016", "es2015", "stage-0", "react"],
"plugins": ["transform-runtime", "transform-decorators-legacy", "transform-class-properties", "lodash"],
"retainLines": true
"plugins": [
"transform-runtime",
"transform-decorators-legacy",
"transform-class-properties",
"lodash"
],
"retainLines": true,
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
}
}
}
40 changes: 40 additions & 0 deletions js/build-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.

// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPL? :)

* Run `PARITY_URL="127.0.0.1:8180" NODE_ENV="production" npm run build`
* to build the project ; use this server to test that the minifed
* version is working (this is a simple proxy server)
*/

var express = require('express');
var proxy = require('http-proxy-middleware');

var app = express();

app.use(express.static('build'));

app.use('/api/*', proxy({
target: 'http://127.0.0.1:8080',
changeOrigin: true
}));

app.use('/rpc/*', proxy({
target: 'http://127.0.0.1:8080',
changeOrigin: true
}));

app.listen(3000);
1 change: 1 addition & 0 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"babel-plugin-lodash": "^3.2.2",
"babel-plugin-transform-class-properties": "^6.11.5",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-react-remove-prop-types": "^0.2.9",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.9.0",
Expand Down
7 changes: 6 additions & 1 deletion js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ import './index.html';
injectTapEventPlugin();

const initToken = window.localStorage.getItem('sysuiToken');
const parityUrl = process.env.NODE_ENV === 'production' ? window.location.host : '127.0.0.1:8180';
const parityUrl = process.env.PARITY_URL ||
(
process.env.NODE_ENV === 'production'
? window.location.host
: '127.0.0.1:8180'
);

const api = new Api(new Api.Transport.Ws(`ws://${parityUrl}`, initToken)); // new Api.Transport.Http('/rpc/'));

Expand Down
1 change: 1 addition & 0 deletions js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ module.exports = {
'process.env': {
NODE_ENV: JSON.stringify(ENV),
RPC_ADDRESS: JSON.stringify(process.env.RPC_ADDRESS),
PARITY_URL: JSON.stringify(process.env.PARITY_URL),
LOGGING: JSON.stringify(!isProd)
}
})
Expand Down
6 changes: 6 additions & 0 deletions js/webpack.vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ module.exports = {
new webpack.DllPlugin({
name: '[name]_lib',
path: 'build/[name]-manifest.json'
}),

new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(ENV)
}
})
];

Expand Down