mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #3845 from MetaMask/build-fix-env
build - correctly set METAMASK_ENV via envify
This commit is contained in:
commit
3e4b11e0d7
@ -22,7 +22,7 @@ const EdgeEncryptor = require('./edge-encryptor')
|
||||
const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code')
|
||||
|
||||
const STORAGE_KEY = 'metamask-config'
|
||||
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
||||
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
|
||||
|
||||
window.log = log
|
||||
log.setDefaultLevel(METAMASK_DEBUG ? 'debug' : 'warn')
|
||||
@ -94,7 +94,7 @@ function setupController (initState, initLangCode) {
|
||||
//
|
||||
// MetaMask Controller
|
||||
//
|
||||
|
||||
|
||||
const controller = new MetamaskController({
|
||||
// User confirmation callbacks:
|
||||
showUnconfirmedMessage: triggerUi,
|
||||
|
@ -13,7 +13,7 @@ const DEFAULT_RPC = 'rinkeby'
|
||||
const OLD_UI_NETWORK_TYPE = 'network'
|
||||
const BETA_UI_NETWORK_TYPE = 'networkBeta'
|
||||
|
||||
global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
||||
global.METAMASK_DEBUG = process.env.METAMASK_DEBUG
|
||||
|
||||
module.exports = {
|
||||
network: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// test and development environment variables
|
||||
const env = process.env.METAMASK_ENV
|
||||
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
||||
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
|
||||
|
||||
//
|
||||
// The default state of MetaMask
|
||||
|
@ -9,7 +9,7 @@ const setupDappAutoReload = require('./lib/auto-reload.js')
|
||||
const MetamaskInpageProvider = require('./lib/inpage-provider.js')
|
||||
restoreContextAfterImports()
|
||||
|
||||
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
||||
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
|
||||
window.log = log
|
||||
log.setDefaultLevel(METAMASK_DEBUG ? 'debug' : 'warn')
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
const Raven = require('raven-js')
|
||||
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
||||
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
|
||||
const extractEthjsErrorMessage = require('./extractEthjsErrorMessage')
|
||||
const PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505'
|
||||
const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496'
|
||||
|
16
gulpfile.js
16
gulpfile.js
@ -1,5 +1,6 @@
|
||||
const watchify = require('watchify')
|
||||
const browserify = require('browserify')
|
||||
const envify = require('envify/custom')
|
||||
const disc = require('disc')
|
||||
const gulp = require('gulp')
|
||||
const source = require('vinyl-source-stream')
|
||||
@ -377,12 +378,6 @@ gulp.task('zip:edge', zipTask('edge'))
|
||||
gulp.task('zip:opera', zipTask('opera'))
|
||||
gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge', 'zip:opera'))
|
||||
|
||||
// set env for production
|
||||
gulp.task('apply-prod-environment', function(done) {
|
||||
process.env.NODE_ENV = 'production'
|
||||
done()
|
||||
});
|
||||
|
||||
// high level tasks
|
||||
|
||||
gulp.task('dev',
|
||||
@ -458,7 +453,6 @@ gulp.task('build:mascara',
|
||||
|
||||
gulp.task('dist',
|
||||
gulp.series(
|
||||
'apply-prod-environment',
|
||||
'build',
|
||||
'zip'
|
||||
)
|
||||
@ -484,6 +478,12 @@ function generateBundler(opts, performBundle) {
|
||||
|
||||
let bundler = browserify(browserifyOpts)
|
||||
|
||||
// inject variables into bundle
|
||||
bundler.transform(envify({
|
||||
METAMASK_DEBUG: opts.devMode,
|
||||
NODE_ENV: opts.devMode ? 'development' : 'production',
|
||||
}))
|
||||
|
||||
// Minification
|
||||
if (opts.minifyBuild) {
|
||||
bundler.transform('uglifyify', {
|
||||
@ -557,8 +557,6 @@ function bundleTask(opts) {
|
||||
buildStream = buildStream
|
||||
// convert bundle stream to gulp vinyl stream
|
||||
.pipe(source(opts.filename))
|
||||
// inject variables into bundle
|
||||
.pipe(replace('\'GULP_METAMASK_DEBUG\'', opts.devMode))
|
||||
// buffer file contents (?)
|
||||
.pipe(buffer())
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "gulp dev:extension",
|
||||
"mascara": "gulp dev:mascara & cross-env METAMASK_DEBUG=true node ./mascara/example/server",
|
||||
"mascara": "gulp dev:mascara & node ./mascara/example/server",
|
||||
"dist": "gulp dist",
|
||||
"test": "npm run test:unit && npm run test:integration && npm run lint",
|
||||
"test:unit": "cross-env METAMASK_ENV=test mocha --exit --require babel-core/register --require test/helper.js --recursive \"test/unit/**/*.js\"",
|
||||
@ -61,7 +61,6 @@
|
||||
}
|
||||
],
|
||||
"reactify",
|
||||
"envify",
|
||||
"brfs"
|
||||
]
|
||||
},
|
||||
|
@ -4,7 +4,7 @@ const thunkMiddleware = require('redux-thunk').default
|
||||
const rootReducer = require('./reducers')
|
||||
const createLogger = require('redux-logger').createLogger
|
||||
|
||||
global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
||||
global.METAMASK_DEBUG = process.env.METAMASK_DEBUG
|
||||
|
||||
module.exports = configureStore
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user