mod-build 3.6.89-beta.1 → 3.6.89-beta.2

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 3.6.89
4
4
 
5
- - Updating `fetchTcpaFromSitegenie()` to no longer have any use-cases of QuinStreet as the company name; should be Modernize all the time.
5
+ - Updated the `add-path-subdirectories` task to include path replacements for `../` or any variation of `../` in the src value.
6
6
 
7
7
  ## 3.6.88
8
8
 
@@ -6,35 +6,25 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
6
6
  if (isPathSubdirectory) {
7
7
  const pathSubdirectory = isPathSubdirectory;
8
8
 
9
+ const replacePath = (match, path, attribute) => {
10
+ if (new RegExp(`^${attribute}="(\.\.\/)+`).test(path)) {
11
+ const subdirectoryLevels = (path.match(/\.\.\//g) || []).length;
12
+ const correctedPath = `${pathSubdirectory}${path.slice((attribute.length + 2) + 3 * subdirectoryLevels)}`;
13
+ return `${attribute}="${correctedPath}`;
14
+ } else {
15
+ return `${attribute}="${pathSubdirectory}${path.slice((attribute.length + 2))}`;
16
+ }
17
+ };
18
+
9
19
  return gulp.src(siteSettings.distFolder + '/**/*.html')
10
20
  .pipe(replace(/(href="favicon.ico")/g, function(match, path) {
11
21
  return `href="${pathSubdirectory}favicon.ico"`;
12
22
  }))
13
- .pipe(replace(/((src=")(resources|images|scripts|videos|shared-components|accessible-components)\/[^"]+")/g, function(match, path) {
14
- if (path.startsWith('src="resources') || path.startsWith('src="images') || path.startsWith('src="scripts') || path.startsWith('src="videos') || path.startsWith('src="shared-components') || path.startsWith('src="accessible-components')) {
15
- return `src="${pathSubdirectory}${path.slice(5)}`;
16
- }
17
- return match;
18
- }))
19
- .pipe(replace(/((srcset="images)\/[^"]+")/g, function(match, path) {
20
- if (path.startsWith('srcset="images')) {
21
- return `srcset="${pathSubdirectory}${path.slice(8)}`;
22
- }
23
- return match;
24
- }))
25
- .pipe(replace(/((poster="images)\/[^"]+")/g, function(match, path) {
26
- if (path.startsWith('poster="images')) {
27
- return `poster="${pathSubdirectory}${path.slice(8)}`;
28
- }
29
- return match;
30
- }))
31
- .pipe(replace(/((href=")(images|styles|shared-components|accessible-components)\/[^"]+")/g, function(match, path) {
32
- if (path.startsWith('href="images') || path.startsWith('href="styles') || path.startsWith('href="shared-components') || path.startsWith('src="accessible-components')) {
33
- return `href="${pathSubdirectory}${path.slice(6)}`;
34
- }
35
- return match;
36
- }))
23
+ .pipe(replace(/((src="(\.\.\/)*)(resources|images|scripts|videos|shared-components|accessible-components)\/[^"]+")/g, (match, path) => replacePath(match, path, 'src')))
24
+ .pipe(replace(/((srcset="(\.\.\/)*images)\/[^"]+")/g, (match, path) => replacePath(match, path, 'srcset')))
25
+ .pipe(replace(/((poster="(\.\.\/)*images)\/[^"]+")/g, (match, path) => replacePath(match, path, 'poster')))
26
+ .pipe(replace(/((href="(\.\.\/)*)(images|styles|shared-components|accessible-components)\/[^"]+")/g, (match, path) => replacePath(match, path, 'href')))
37
27
  .pipe(gulp.dest(siteSettings.distFolder));
38
28
  }
39
- }
29
+ };
40
30
  };
@@ -240,6 +240,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
240
240
  };
241
241
 
242
242
  var fetchTcpaFromSitegenie = async function() {
243
+ const company = templatesData.company_name;
243
244
  const website = templatesData.website_name;
244
245
  const c_level = templatesData.cLevel ? templatesData.cLevel : 'default';
245
246
  const affiliateKey = templatesData.affiliateKey ? templatesData.affiliateKey : 0;
@@ -258,7 +259,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
258
259
  throw new Error(`${xhr.statusCode}: Error while fetching TCPA`);
259
260
  }
260
261
  const responseJson = await JSON.parse(response);
261
- let finalTCPA = await responseJson.tcpa.replace(/QuinStreet/g, 'Modernize');
262
+ let finalTCPA = await (company === 'Modernize' || templatesData.useModernizeInTCPA) ? responseJson.tcpa.replace(/QuinStreet/g, 'Modernize') : responseJson.tcpa;
262
263
  const removeInlineStyleRegex = / style="[^"]*"/g;
263
264
  finalTCPA = finalTCPA.replace(removeInlineStyleRegex, '');
264
265
  templatesData.tcpaText = await finalTCPA;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.89-beta.1",
3
+ "version": "3.6.89-beta.2",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",