Dead plugin removal; TOS_URL debugging

pull/395/head
Rick Carlino 2017-08-10 14:11:17 -05:00
parent 123bd27c0f
commit 6458e80fb9
11 changed files with 22 additions and 21 deletions

View File

@ -2,9 +2,7 @@
<script>
// IMPORTANT!!!!
// ALWAYS LOAD THIS *FIRST*
window.process = {
env: <%= raw($FRONTEND_SHARED_DATA) %> // SEE COMMENTS!
};
window.globalConfig = <%= raw($FRONTEND_SHARED_DATA) %> // SEE COMMENTS!;
// READ COMMENT ABOVE
</script>
<%= render "addons" %>

View File

@ -10,9 +10,6 @@ var production = process.env.RAILS_ENV === 'production';
var StatsPlugin = require('stats-webpack-plugin');
var UglifyJsPlugin = require("webpack-uglify-js-plugin");
var webpack = require("webpack");
var VERSION = JSON.stringify(process.env.BUILT_AT
|| process.env.HEROKU_SLUG_COMMIT
|| "NONE");
console.log("INSIDE DEV MODE WEBPACK CONFIG!");
@ -65,6 +62,9 @@ module.exports = {
chunks: false,
modules: false,
assets: true
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("production")
})
]
}

View File

@ -12,9 +12,6 @@ var production = process.env.RAILS_ENV === 'production';
var StatsPlugin = require('stats-webpack-plugin');
var UglifyJsPlugin = require("webpack-uglify-js-plugin");
var webpack = require("webpack");
var VERSION = JSON.stringify(process.env.BUILT_AT
|| process.env.HEROKU_SLUG_COMMIT
|| "NONE");
console.log("INSIDE PRODUCTION WEBPACK CONFIG!");
@ -93,6 +90,9 @@ module.exports = {
screw_ie8: true,
output: { comments: false },
compressor: { warnings: false }
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("production")
})
]
}

View File

@ -13,7 +13,7 @@
"start": "echo '===We use `npm run dev` now.==='",
"heroku-postbuild": "webpack --config=./config/webpack.prod.js",
"dev": "PORT=3000 bundle exec foreman start --procfile=Procfile.dev",
"webpack": "webpack-dev-server --config tools/webpack.config.dev.js --content-base public/ --host 0.0.0.0",
"webpack": "./node_modules/.bin/webpack-dev-server --config config/webpack.config.js --host 0.0.0.0",
"test": "jest --coverage --no-cache",
"typecheck": "tsc --noEmit --jsx preserve"
},

3
typings/index.d.ts vendored
View File

@ -1 +1,4 @@
/// <reference path="react-redux.d.ts" />
/** This contains all of the global ENV vars passed from server => client.
* Previously was `process.env.XYZ`. */
declare var globalConfig: { [k: string]: string };

View File

@ -5,7 +5,7 @@ import { ready } from "./config/actions";
import { detectLanguage } from "./i18n";
import * as i18next from "i18next";
import { stopIE, attachToRoot, shortRevision } from "./util";
console.log("...");
stopIE();
let r = shortRevision();

View File

@ -122,13 +122,13 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
maybeRenderTos() {
console.group();
console.log(process.env.TOS_URL || "NOT_SET");
console.log(process.env.PRIV_URL || "NOT_SET");
console.log(globalConfig.TOS_URL || "NOT_SET");
console.log(globalConfig.PRIV_URL || "NOT_SET");
console.groupEnd();
const TOS_URL = process.env.TOS_URL;
const TOS_URL = globalConfig.TOS_URL;
if (TOS_URL) {
const PRV_URL = process.env.PRIV_URL;
const PRV_URL = globalConfig.PRIV_URL;
return (
<div>
<div>

View File

@ -27,7 +27,7 @@ export const AdditionalMenu = (logout: () => void) => {
href="https://github.com/FarmBot/Farmbot-Web-App"
target="_blank"
>
{(process.env.SHORT_REVISION || "NONE").slice(0, 8)}
{(globalConfig.SHORT_REVISION || "NONE").slice(0, 8)}
</a>
</div>
</div>;

View File

@ -4,7 +4,7 @@ import { rootReducer } from "./root_reducer";
import { registerSubscribers } from "./subscribers";
import { getMiddleware } from "./middlewares";
let ENV = process.env.NODE_ENV as string;
let ENV = process.env.NODE_ENV || "development";
function dev() {
store = createStore(rootReducer as any,

View File

@ -87,7 +87,7 @@ export class Wow extends React.Component<Props, Partial<State>> {
}
render() {
if (!process.env.TOS_URL && !process.env.PRIV_URL) {
if (!globalConfig.TOS_URL && !globalConfig.PRIV_URL) {
return <div className="static-page">
<div className="all-content-wrapper">
<div className="row">
@ -154,13 +154,13 @@ export class Wow extends React.Component<Props, Partial<State>> {
<hr />
<ul>
<li>
<a href={process.env.TOS_URL}>
<a href={globalConfig.TOS_URL}>
{t("Terms of Service")}
</a>
<span className="fa fa-external-link"></span>
</li>
<li>
<a href={process.env.PRIV_URL}>
<a href={globalConfig.PRIV_URL}>
{t("Privacy Policy")}
</a>
<span className="fa fa-external-link">

View File

@ -429,7 +429,7 @@ export interface HttpData<T> extends AxiosResponse {
export interface HttpPromise<T> extends Promise<HttpData<T>> { }
export function shortRevision() {
return (process.env.SHORT_REVISION || "NONE").slice(0, 8);
return (globalConfig.SHORT_REVISION || "NONE").slice(0, 8);
}
/** When needing to reference the url in some js universally or vice versa. */