@boomerang-io/webapp-spa-server 1.0.1-beta.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +14 -2
- package/index.js +1 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const boomerangLogger = require("@boomerang-io/logger-middleware")("webapp-spa-server/index.js");
|
|
4
|
+
const logger = boomerangLogger.logger;
|
|
3
5
|
/**
|
|
4
6
|
* Import and execute app
|
|
5
7
|
*/
|
|
@@ -22,7 +24,6 @@ require("yargs") // eslint-disable-line
|
|
|
22
24
|
describe: "CORS configuration using cors package. Accepts JSON string.",
|
|
23
25
|
type: "string",
|
|
24
26
|
})
|
|
25
|
-
|
|
26
27
|
.option("disableInjectHTMLHeadData", {
|
|
27
28
|
alias: "d",
|
|
28
29
|
describe: "Enable injection of data and scripts into the head of the HTML file.",
|
|
@@ -36,5 +37,16 @@ require("yargs") // eslint-disable-line
|
|
|
36
37
|
type: "string",
|
|
37
38
|
})
|
|
38
39
|
.coerce({
|
|
39
|
-
cors:
|
|
40
|
+
cors: (arg) => {
|
|
41
|
+
if (arg) {
|
|
42
|
+
return JSON.parse(arg);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
.fail(function (msg, err) {
|
|
47
|
+
logger.error(msg);
|
|
48
|
+
if (err) {
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
process.exit(1);
|
|
40
52
|
}).argv;
|
package/index.js
CHANGED
|
@@ -39,7 +39,6 @@ function createBoomerangServer({
|
|
|
39
39
|
GA_SITE_ID,
|
|
40
40
|
ENABLE_BEEHEARD_SURVEY,
|
|
41
41
|
} = process.env;
|
|
42
|
-
logger.debug("PROCESS ENV: ", process.env);
|
|
43
42
|
|
|
44
43
|
// Monitoring
|
|
45
44
|
if (NEW_RELIC_APP_NAME && NEW_RELIC_LICENSE_KEY) {
|
|
@@ -87,7 +86,6 @@ function createBoomerangServer({
|
|
|
87
86
|
* It will be returned on the second route
|
|
88
87
|
* https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#serving-apps-with-client-side-routing
|
|
89
88
|
*/
|
|
90
|
-
logger.debug("0 - disableInjectHTMLHeadData: ", disableInjectHTMLHeadData);
|
|
91
89
|
if (!disableInjectHTMLHeadData) {
|
|
92
90
|
appRouter.use(
|
|
93
91
|
"/",
|
|
@@ -138,6 +136,7 @@ function createBoomerangServer({
|
|
|
138
136
|
* @param {string} injectedScripts - string of comma delimited values
|
|
139
137
|
* @param {string} appRoot - root context off app. Used for script injection
|
|
140
138
|
* @param {string} gaSiteId - siteID to be injected on scripts to support GA
|
|
139
|
+
* @param {string} baseLaunchUrl - base url to determine GA primaryCategory
|
|
141
140
|
* @param {boolean} enableBeeheardSurvey - true/false value configured at helm to decide to insert survey script
|
|
142
141
|
*/
|
|
143
142
|
function injectEnvDataAndScriptsIntoHTML(
|
|
@@ -153,7 +152,6 @@ function injectEnvDataAndScriptsIntoHTML(
|
|
|
153
152
|
* Create objects to be injected into application via the HEAD tag
|
|
154
153
|
*/
|
|
155
154
|
// Build script for GA integration
|
|
156
|
-
logger.debug("2 - GA Site ID: ", gaSiteId);
|
|
157
155
|
const headScripstGA = Boolean(gaSiteId)
|
|
158
156
|
? `<script type="text/javascript">
|
|
159
157
|
window.idaPageIsSPA = true;
|
package/package.json
CHANGED