mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
prod environment settings
This commit is contained in:
10
package-lock.json
generated
10
package-lock.json
generated
@@ -2620,6 +2620,16 @@
|
|||||||
"sha.js": "2.4.10"
|
"sha.js": "2.4.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"cross-env": {
|
||||||
|
"version": "5.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.1.4.tgz",
|
||||||
|
"integrity": "sha512-Mx8mw6JWhfpYoEk7PGvHxJMLQwQHORAs8+2bX+C1lGQ4h3GkDb1zbzC2Nw85YH9ZQMlO0BHZxMacgrfPmMFxbg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"cross-spawn": "5.1.0",
|
||||||
|
"is-windows": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"cross-spawn": {
|
"cross-spawn": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -6,13 +6,14 @@
|
|||||||
"sub:update": "git submodule update --remote",
|
"sub:update": "git submodule update --remote",
|
||||||
"sub:pull": "git submodule foreach git pull",
|
"sub:pull": "git submodule foreach git pull",
|
||||||
"postinstall": "npm run sub:init",
|
"postinstall": "npm run sub:init",
|
||||||
"start:firefox": "web-ext run --source-dir ./dist/",
|
|
||||||
"build": "gulp build && webpack --config webpack.config.js",
|
"build": "gulp build && webpack --config webpack.config.js",
|
||||||
"build:watch": "gulp build && webpack --config webpack.config.js --watch",
|
"build:watch": "gulp build && webpack --config webpack.config.js --watch",
|
||||||
"dist": "npm run build && gulp dist",
|
"build:prod": "gulp build && cross-env NODE_ENV=production webpack --config webpack.config.js",
|
||||||
"dist:firefox": "npm run build && gulp dist:firefox",
|
"build:prod:watch": "gulp build && cross-env NODE_ENV=production webpack --config webpack.config.js --watch",
|
||||||
"dist:opera": "npm run build && gulp dist:opera",
|
"dist": "npm run build:prod && gulp dist",
|
||||||
"dist:safari": "npm run build && gulp dist:safari",
|
"dist:firefox": "npm run build:prod && gulp dist:firefox",
|
||||||
|
"dist:opera": "npm run build:prod && gulp dist:opera",
|
||||||
|
"dist:safari": "npm run build:prod && gulp dist:safari",
|
||||||
"lint": "tslint src/**/*.ts || true",
|
"lint": "tslint src/**/*.ts || true",
|
||||||
"lint:fix": "tslint src/**/*.ts --fix",
|
"lint:fix": "tslint src/**/*.ts --fix",
|
||||||
"test": "karma start --single-run",
|
"test": "karma start --single-run",
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
"clean-webpack-plugin": "^0.1.17",
|
"clean-webpack-plugin": "^0.1.17",
|
||||||
"clipboard": "1.7.1",
|
"clipboard": "1.7.1",
|
||||||
"copy-webpack-plugin": "^4.2.0",
|
"copy-webpack-plugin": "^4.2.0",
|
||||||
|
"cross-env": "^5.1.4",
|
||||||
"css-loader": "^0.28.7",
|
"css-loader": "^0.28.7",
|
||||||
"del": "3.0.0",
|
"del": "3.0.0",
|
||||||
"extract-text-webpack-plugin": "^3.0.1",
|
"extract-text-webpack-plugin": "^3.0.1",
|
||||||
|
|||||||
@@ -262,7 +262,8 @@ export class BrowserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gaFilter() {
|
static gaFilter() {
|
||||||
return BrowserApi.isSafariApi && safari.application.activeBrowserWindow.activeTab.private;
|
return process.env.ENV !== 'production' ||
|
||||||
|
(BrowserApi.isSafariApi && safari.application.activeBrowserWindow.activeTab.private);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getUILanguage(win: Window) {
|
static getUILanguage(win: Window) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ require('../scripts/duo.js');
|
|||||||
|
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
// if (!isDev()) {
|
if (process.env.ENV === 'production') {
|
||||||
// enableProdMode();
|
enableProdMode();
|
||||||
// }
|
}
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ export function initFactory(i18nService: I18nService, storageService: StorageSer
|
|||||||
window.document.documentElement.classList.add('locale_' + i18nService.translationLocale);
|
window.document.documentElement.classList.add('locale_' + i18nService.translationLocale);
|
||||||
authService.init();
|
authService.init();
|
||||||
|
|
||||||
new Analytics(window, () => BrowserApi.gaFilter(), null, null, null, () => {
|
const analytics = new Analytics(window, () => BrowserApi.gaFilter(), null, null, null, () => {
|
||||||
const bgPage = BrowserApi.getBackgroundPage();
|
const bgPage = BrowserApi.getBackgroundPage();
|
||||||
if (bgPage == null || bgPage.bitwardenMain == null) {
|
if (bgPage == null || bgPage.bitwardenMain == null) {
|
||||||
throw 'Cannot resolve background page main.';
|
throw new Error('Cannot resolve background page main.');
|
||||||
}
|
}
|
||||||
return bgPage.bitwardenMain;
|
return bgPage.bitwardenMain;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
|
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV == null) {
|
||||||
|
process.env.NODE_ENV = 'development';
|
||||||
|
}
|
||||||
|
const ENV = process.env.ENV = process.env.NODE_ENV;
|
||||||
|
|
||||||
const isVendorModule = (module) => {
|
const isVendorModule = (module) => {
|
||||||
if (!module.context) {
|
if (!module.context) {
|
||||||
return false;
|
return false;
|
||||||
@@ -159,6 +164,11 @@ const config = {
|
|||||||
include: ['popup/main.js', 'background.js'],
|
include: ['popup/main.js', 'background.js'],
|
||||||
}),
|
}),
|
||||||
extractCss,
|
extractCss,
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': {
|
||||||
|
'ENV': JSON.stringify(ENV)
|
||||||
|
}
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user