mod-build 4.0.12 → 4.0.13

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 4.0.13
2
+
3
+ - Making sure the abandonment.min.js gets copied to the right folder path (needs to copy to /abandonment/accessible/ if the site is indeed using the accessible version). This will ensure our shared-resource deployments trigger the files correctly.
4
+
1
5
  ## 4.0.12
2
6
 
3
7
  - Adding a handlebars helper to see if the value is an array or not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.12",
3
+ "version": "4.0.13",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -16,6 +16,7 @@ let componentFolderPath = '';
16
16
  let replacementFunctions = [];
17
17
 
18
18
  let pathSubdirectory = '';
19
+ let useAccessibleComponents = false;
19
20
 
20
21
  const axiosInstance = axios.create();
21
22
  responseInterceptor(axiosInstance);
@@ -54,11 +55,12 @@ function replaceFootAssetScripts(gulp, defaultSettings) {
54
55
  }
55
56
 
56
57
  function replaceAbandonmentJsCssSrc(gulp, defaultSettings) {
58
+ const abandonmentJsRegex = useAccessibleComponents ? /"(?:(?!"|")[\s\S])+(abandonment\/accessible\/abandonment.*?)js"/ : /"(?:(?!"|")[\s\S])+(abandonment\/abandonment.*?)js"/;
57
59
  const jsResourcePath = '/resources/scripts/abandonment/';
58
60
  const cssResourcePath = '/resources/styles/components/abandonment/';
59
61
  return new Promise((resolve) => {
60
62
  gulp.src(defaultSettings.srcFolder + '/templates/abandonment/*.html')
61
- .pipe(replace(/"(?:(?!"|")[\s\S])+(abandonment\/abandonment.*?)js"/, `"${jsResourcePath}${fileNames.abandonmentJsFileName}"`))
63
+ .pipe(replace(abandonmentJsRegex, `"${jsResourcePath}${fileNames.abandonmentJsFileName}"`))
62
64
  .pipe(replace(/"(?:(?!"|")[\s\S])+(components\/abandonment\/abandonment.*?)css"/, `"${cssResourcePath}${fileNames.abandonmentStylesFileName}"`))
63
65
  .pipe(gulp.dest(defaultSettings.srcFolder + '/templates/abandonment'))
64
66
  .on('finish', resolve);
@@ -241,7 +243,7 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
241
243
 
242
244
  export default async function(config) {
243
245
  const { isLocal } = defaultSettings;
244
- const useAccessibleComponents = config.useAccessibleConfig;
246
+ useAccessibleComponents = config.useAccessibleConfig;
245
247
  componentFolderPath = useAccessibleComponents === true ? 'accessible-components' : 'shared-components';
246
248
  const tasks = Object.values(TASKS);
247
249
  const isPathSubdirectory = config.siteData?.pathSubdirectory || config.pathSubdirectory;
@@ -251,6 +253,7 @@ export default async function(config) {
251
253
  const getAllResources = tasks.map(async function(task) {
252
254
  if (useAccessibleComponents && task.url.includes('abandonment.min.js')) {
253
255
  task.url = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js';
256
+ task.config.dest = 'scripts/abandonment/accessible';
254
257
  }
255
258
  Object.assign(task.config, { defaultSettings, config });
256
259
  await getResource(task, fileNames);