mod-build 4.0.0-alpha.10 → 4.0.0-alpha.11
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/package.json +1 -1
- package/tasks/grab-shared-scripts.js +4 -6
- package/tasks/templates.js +11 -9
package/package.json
CHANGED
|
@@ -240,7 +240,7 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
|
|
|
240
240
|
export default async function(config) {
|
|
241
241
|
const { isLocal } = defaultSettings;
|
|
242
242
|
const isQuotePage = config.siteData?.isQuotePage || config.isQuotePage;
|
|
243
|
-
const useAccessibleComponents = config.
|
|
243
|
+
const useAccessibleComponents = config.useAccessibleConfig;
|
|
244
244
|
const useRelativePathForResources = config.siteData?.useRelativePathForResources || config.useRelativePathForResources;
|
|
245
245
|
componentFolderPath = useAccessibleComponents === true ? 'accessible-components' : 'shared-components';
|
|
246
246
|
isQuotePageOrUseRelativePath = isQuotePage === true || useRelativePathForResources === true;
|
|
@@ -250,11 +250,9 @@ export default async function(config) {
|
|
|
250
250
|
const tasks = Object.values(TASKS);
|
|
251
251
|
if (tasks.length) {
|
|
252
252
|
const getAllResources = tasks.map(async function(task) {
|
|
253
|
-
if (useAccessibleComponents
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
task.config.mapUrl = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js.map';
|
|
257
|
-
}
|
|
253
|
+
if (useAccessibleComponents && task.url.includes('abandonment.min.js')) {
|
|
254
|
+
task.url = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js';
|
|
255
|
+
task.config.mapUrl = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js.map';
|
|
258
256
|
}
|
|
259
257
|
Object.assign(task.config, { defaultSettings, config });
|
|
260
258
|
await getResource(task, fileNames);
|
package/tasks/templates.js
CHANGED
|
@@ -6,7 +6,9 @@ import merge from 'lodash.merge';
|
|
|
6
6
|
import { defaultSettings } from '../src/data/config.js';
|
|
7
7
|
import { getActiveSeasons } from '../src/scripts/utils.js';
|
|
8
8
|
|
|
9
|
-
function mergeDefaultFormFieldConfig(
|
|
9
|
+
function mergeDefaultFormFieldConfig(defaultConfig, config) {
|
|
10
|
+
const { steps } = config;
|
|
11
|
+
|
|
10
12
|
if (!steps.items) {
|
|
11
13
|
console.error('No items[ ] found in steps{}!');
|
|
12
14
|
return steps;
|
|
@@ -50,14 +52,14 @@ const getDefaultFormFieldConfig = async (config, folder = 'accessible-components
|
|
|
50
52
|
}
|
|
51
53
|
const defaultConfig = resp.data;
|
|
52
54
|
if (config.steps) {
|
|
53
|
-
config.steps = await mergeDefaultFormFieldConfig(
|
|
55
|
+
config.steps = await mergeDefaultFormFieldConfig(defaultConfig, config);
|
|
54
56
|
}
|
|
55
57
|
resolve();
|
|
56
58
|
}).catch(error => {
|
|
57
59
|
console.error(error);
|
|
58
60
|
resolve();
|
|
59
61
|
});
|
|
60
|
-
|
|
62
|
+
});
|
|
61
63
|
|
|
62
64
|
};
|
|
63
65
|
|
|
@@ -93,24 +95,24 @@ const fetchTcpaFromSitegenie = async (config) => {
|
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
export default async function(config) {
|
|
96
|
-
const { isLocal,
|
|
98
|
+
const { isLocal, nodeEnv, buildPath } = defaultSettings;
|
|
97
99
|
const { isWhiteLabel } = config;
|
|
98
|
-
const assetsPath = isWhiteLabel ? '' : (isLocal ? '/temp/assets' : `https://${
|
|
100
|
+
const assetsPath = isWhiteLabel ? '' : (isLocal ? '/temp/assets' : `https://${nodeEnv}/quote/resources/assets`);
|
|
99
101
|
const tempConfigCreated = fs.existsSync(`${defaultSettings.srcFolder}/${defaultSettings.tmpFolder}/config.json`);
|
|
100
102
|
|
|
101
103
|
const activeSeason = getActiveSeasons();
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
let tempConfig = {
|
|
104
106
|
...config,
|
|
105
107
|
...footer(config),
|
|
106
|
-
...{ isLocal,
|
|
108
|
+
...{ isLocal, nodeEnv, assetsPath, buildPath },
|
|
107
109
|
};
|
|
108
110
|
|
|
109
111
|
if (activeSeason.length) {
|
|
110
112
|
if (config.seasonalVariations) {
|
|
111
113
|
activeSeason.forEach(season => {
|
|
112
114
|
if (season in config.seasonalVariations) {
|
|
113
|
-
|
|
115
|
+
tempConfig = { ...tempConfig, ...config.seasonalVariations[season] };
|
|
114
116
|
}
|
|
115
117
|
});
|
|
116
118
|
}
|
|
@@ -133,6 +135,6 @@ export default async function(config) {
|
|
|
133
135
|
fs.mkdirSync(`${defaultSettings.srcFolder}/${defaultSettings.tmpFolder}`, { recursive: true });
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
fs.writeFileSync(`${defaultSettings.srcFolder}/${defaultSettings.tmpFolder}/config.json`, JSON.stringify(
|
|
138
|
+
fs.writeFileSync(`${defaultSettings.srcFolder}/${defaultSettings.tmpFolder}/config.json`, JSON.stringify(tempConfig, null, 2));
|
|
137
139
|
|
|
138
140
|
}
|