cdn -> dischargeTarget, and report to heap
This commit is contained in:
parent
e59d47eac8
commit
ab631060a0
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"domain": "0x-instant-dogfood",
|
"domain": "0x-instant-dogfood",
|
||||||
"build_command": "WEBPACK_OUTPUT_PATH=public yarn build:prod --env.cdn=staging",
|
"build_command": "WEBPACK_OUTPUT_PATH=public yarn build --env.discharge_target=dogfood",
|
||||||
"upload_directory": "public",
|
"upload_directory": "public",
|
||||||
"index_key": "index.html",
|
"index_key": "index.html",
|
||||||
"error_key": "index.html",
|
"error_key": "index.html",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"domain": "instant.0xproject.com",
|
"domain": "instant.0xproject.com",
|
||||||
"build_command": "yarn build --env.cdn=production",
|
"build_command": "yarn build --env.discharge_target=production",
|
||||||
"upload_directory": "umd",
|
"upload_directory": "umd",
|
||||||
"index_key": "instant.js",
|
"index_key": "instant.js",
|
||||||
"error_key": "404.html",
|
"error_key": "404.html",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"domain": "0x-instant-staging",
|
"domain": "0x-instant-staging",
|
||||||
"build_command": "WEBPACK_OUTPUT_PATH=public yarn build --env.cdn=staging",
|
"build_command": "WEBPACK_OUTPUT_PATH=public yarn build --env.discharge_target=staging",
|
||||||
"upload_directory": "public",
|
"upload_directory": "public",
|
||||||
"index_key": "index.html",
|
"index_key": "index.html",
|
||||||
"error_key": "index.html",
|
"error_key": "index.html",
|
||||||
|
@ -5,7 +5,11 @@ import * as _ from 'lodash';
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Provider as ReduxProvider } from 'react-redux';
|
import { Provider as ReduxProvider } from 'react-redux';
|
||||||
|
|
||||||
import { ACCOUNT_UPDATE_INTERVAL_TIME_MS, BUY_QUOTE_UPDATE_INTERVAL_TIME_MS } from '../constants';
|
import {
|
||||||
|
ACCOUNT_UPDATE_INTERVAL_TIME_MS,
|
||||||
|
BUY_QUOTE_UPDATE_INTERVAL_TIME_MS,
|
||||||
|
INSTANT_DISCHARGE_TARGET,
|
||||||
|
} from '../constants';
|
||||||
import { SelectedAssetThemeProvider } from '../containers/selected_asset_theme_provider';
|
import { SelectedAssetThemeProvider } from '../containers/selected_asset_theme_provider';
|
||||||
import { asyncData } from '../redux/async_data';
|
import { asyncData } from '../redux/async_data';
|
||||||
import { DEFAULT_STATE, DefaultState, State } from '../redux/reducer';
|
import { DEFAULT_STATE, DefaultState, State } from '../redux/reducer';
|
||||||
@ -132,6 +136,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
|
|||||||
providerName: state.providerState.name,
|
providerName: state.providerState.name,
|
||||||
gitSha: process.env.GIT_SHA,
|
gitSha: process.env.GIT_SHA,
|
||||||
npmVersion: process.env.NPM_PACKAGE_VERSION,
|
npmVersion: process.env.NPM_PACKAGE_VERSION,
|
||||||
|
instantEnvironment: INSTANT_DISCHARGE_TARGET || `Local ${process.env.NODE_ENV}`,
|
||||||
});
|
});
|
||||||
analytics.trackInstantOpened();
|
analytics.trackInstantOpened();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,11 @@ export const HEAP_ANALYTICS_ID = process.env.HEAP_ANALYTICS_ID;
|
|||||||
export const COINBASE_API_BASE_URL = 'https://api.coinbase.com/v2';
|
export const COINBASE_API_BASE_URL = 'https://api.coinbase.com/v2';
|
||||||
export const PROGRESS_STALL_AT_WIDTH = '95%';
|
export const PROGRESS_STALL_AT_WIDTH = '95%';
|
||||||
export const PROGRESS_FINISH_ANIMATION_TIME_MS = 200;
|
export const PROGRESS_FINISH_ANIMATION_TIME_MS = 200;
|
||||||
export const INSTANT_CDN = process.env.INSTANT_CDN as 'production' | 'dogfood' | 'staging' | undefined;
|
export const INSTANT_DISCHARGE_TARGET = process.env.INSTANT_DISCHARGE_TARGET as
|
||||||
|
| 'production'
|
||||||
|
| 'dogfood'
|
||||||
|
| 'staging'
|
||||||
|
| undefined;
|
||||||
export const COINBASE_WALLET_IOS_APP_STORE_URL = 'https://itunes.apple.com/us/app/coinbase-wallet/id1278383455?mt=8';
|
export const COINBASE_WALLET_IOS_APP_STORE_URL = 'https://itunes.apple.com/us/app/coinbase-wallet/id1278383455?mt=8';
|
||||||
export const COINBASE_WALLET_ANDROID_APP_STORE_URL = 'https://play.google.com/store/apps/details?id=org.toshi&hl=en';
|
export const COINBASE_WALLET_ANDROID_APP_STORE_URL = 'https://play.google.com/store/apps/details?id=org.toshi&hl=en';
|
||||||
export const COINBASE_WALLET_SITE_URL = 'https://wallet.coinbase.com/';
|
export const COINBASE_WALLET_SITE_URL = 'https://wallet.coinbase.com/';
|
||||||
|
@ -47,6 +47,7 @@ export interface AnalyticsEventOptions {
|
|||||||
providerName?: string;
|
providerName?: string;
|
||||||
gitSha?: string;
|
gitSha?: string;
|
||||||
npmVersion?: string;
|
npmVersion?: string;
|
||||||
|
instantEnvironment?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const analytics = {
|
export const analytics = {
|
||||||
|
@ -6,12 +6,14 @@ const webpack = require('webpack');
|
|||||||
// The common js bundle (not this one) is built using tsc.
|
// The common js bundle (not this one) is built using tsc.
|
||||||
// The umd bundle (this one) has a different entrypoint.
|
// The umd bundle (this one) has a different entrypoint.
|
||||||
|
|
||||||
const CDNS_THAT_REQUIRE_HEAP = ['production', 'staging', 'dogfood'];
|
const DISCHARGE_TARGETS_THAT_REQUIRED_HEAP = ['production', 'staging', 'dogfood'];
|
||||||
const getConfigForCdn = cdnName => {
|
const getConfigForDischargeTarget = dischargeTarget => {
|
||||||
return {
|
return {
|
||||||
heapAnalyticsIdEnvName:
|
heapAnalyticsIdEnvName:
|
||||||
cdnName === 'production' ? 'INSTANT_HEAP_ANALYTICS_ID_PRODUCTION' : 'INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT',
|
dischargeTarget === 'production'
|
||||||
heapAnalyticsIdRequired: CDNS_THAT_REQUIRE_HEAP.includes(cdnName),
|
? 'INSTANT_HEAP_ANALYTICS_ID_PRODUCTION'
|
||||||
|
: 'INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT',
|
||||||
|
heapAnalyticsIdRequired: DISCHARGE_TARGETS_THAT_REQUIRED_HEAP.includes(dischargeTarget),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -19,14 +21,14 @@ const GIT_SHA = childProcess
|
|||||||
.execSync('git rev-parse HEAD')
|
.execSync('git rev-parse HEAD')
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
const generateConfig = (cdnName, configOptions) => {
|
const generateConfig = (dischargeTarget, configOptions) => {
|
||||||
const outputPath = process.env.WEBPACK_OUTPUT_PATH || 'umd';
|
const outputPath = process.env.WEBPACK_OUTPUT_PATH || 'umd';
|
||||||
|
|
||||||
const { heapAnalyticsIdEnvName, heapAnalyticsIdRequired } = configOptions;
|
const { heapAnalyticsIdEnvName, heapAnalyticsIdRequired } = configOptions;
|
||||||
const heapAnalyticsId = process.env[heapAnalyticsIdEnvName];
|
const heapAnalyticsId = process.env[heapAnalyticsIdEnvName];
|
||||||
if (heapAnalyticsIdRequired && !heapAnalyticsId) {
|
if (heapAnalyticsIdRequired && !heapAnalyticsId) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Must define heap analytics id in ENV var ${heapAnalyticsIdEnvName} when building for ${cdnName}`,
|
`Must define heap analytics id in ENV var ${heapAnalyticsIdEnvName} when building for ${dischargeTarget}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,12 +36,13 @@ const generateConfig = (cdnName, configOptions) => {
|
|||||||
GIT_SHA: JSON.stringify(GIT_SHA),
|
GIT_SHA: JSON.stringify(GIT_SHA),
|
||||||
NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
|
NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
|
||||||
};
|
};
|
||||||
if (cdnName) {
|
if (dischargeTarget) {
|
||||||
envVars.INSTANT_CDN = JSON.stringify(cdnName);
|
envVars.INSTANT_DISCHARGE_TARGET = JSON.stringify(dischargeTarget);
|
||||||
}
|
}
|
||||||
if (heapAnalyticsId) {
|
if (heapAnalyticsId) {
|
||||||
envVars.HEAP_ANALYTICS_ID = JSON.stringify(heapAnalyticsId);
|
envVars.HEAP_ANALYTICS_ID = JSON.stringify(heapAnalyticsId);
|
||||||
}
|
}
|
||||||
|
console.log(envVars);
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
entry: {
|
entry: {
|
||||||
@ -91,7 +94,7 @@ const generateConfig = (cdnName, configOptions) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports = (env, _argv) => {
|
module.exports = (env, _argv) => {
|
||||||
const cdnName = env ? env.cdn : undefined;
|
const dischargeTarget = env ? env.discharge_target : undefined;
|
||||||
const configOptions = getConfigForCdn(cdnName);
|
const configOptions = getConfigForDischargeTarget(dischargeTarget);
|
||||||
return generateConfig(cdnName, configOptions);
|
return generateConfig(dischargeTarget, configOptions);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user