mod-build 4.0.50-beta.1 → 4.0.50-beta.3
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/serve.js +0 -2
- package/tasks/setupDevOpsTrackingId.js +14 -13
- package/tasks/templates.js +5 -0
package/package.json
CHANGED
package/tasks/serve.js
CHANGED
|
@@ -4,7 +4,6 @@ import grabSharedScripts from './grab-shared-scripts.js';
|
|
|
4
4
|
import grabCdn from './grab-cdn.js';
|
|
5
5
|
import getDefaultTradeQuestions from './get-default-trade-questions.js';
|
|
6
6
|
import grabFormHelpers from './grab-form-helpers.js';
|
|
7
|
-
import setupDevOpsTrackingId from './setupDevOpsTrackingId.js';
|
|
8
7
|
import templates from './templates.js';
|
|
9
8
|
import { createStylelintFile, updateConfig } from '../src/scripts/plugins.js';
|
|
10
9
|
|
|
@@ -19,7 +18,6 @@ export async function startModBuild(config) {
|
|
|
19
18
|
templates(config)
|
|
20
19
|
]).then(async () => {
|
|
21
20
|
await grabSharedScripts(config);
|
|
22
|
-
setupDevOpsTrackingId(config);
|
|
23
21
|
});
|
|
24
22
|
await updateConfig(config);
|
|
25
23
|
}
|
|
@@ -3,26 +3,27 @@ import gulp from 'gulp';
|
|
|
3
3
|
import replace from 'gulp-replace';
|
|
4
4
|
|
|
5
5
|
async function generateDevOpsTrackingId(config) {
|
|
6
|
-
|
|
6
|
+
const { website_name } = config,
|
|
7
7
|
pathSubdirectory = config?.pathSubdirectory || config?.siteData?.pathSubdirectory,
|
|
8
8
|
website = website_name.replace(/\.(com|org).*/, ''),
|
|
9
9
|
sharedIdentifier = pathSubdirectory?.replace(/\/+$/, '').split('/').pop(),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
trackingId = sharedIdentifier ? `${website}_${sharedIdentifier}` : website;
|
|
11
|
+
|
|
12
|
+
return trackingId.toUpperCase();
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async function appendTrackingIdToBody(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
async function appendTrackingIdToBody() {
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
gulp.src(`${defaultSettings.srcFolder}/pages/**/*.hbs`)
|
|
18
|
+
.pipe(replace(/<body([^>]*?)\sdata-devops-id="[^"]*"([^>]*?)>/, '<body$1 data-devops-id="{{this.devOpsTrackingId}}"$2>'))
|
|
19
|
+
.pipe(replace(/<body(?![^>]*data-devops-id)([^>]*)>/, '<body data-devops-id="{{this.devOpsTrackingId}}"$1>'))
|
|
20
|
+
.pipe(gulp.dest(`${defaultSettings.srcFolder}/pages`))
|
|
21
|
+
.on('finish', resolve);
|
|
22
|
+
});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export default async function(config) {
|
|
26
26
|
const trackingId = await generateDevOpsTrackingId(config);
|
|
27
|
-
|
|
27
|
+
config.devOpsTrackingId = trackingId;
|
|
28
|
+
await appendTrackingIdToBody();
|
|
28
29
|
}
|
package/tasks/templates.js
CHANGED
|
@@ -7,6 +7,8 @@ import { responseInterceptor } from '../src/scripts/retry-axios.js';
|
|
|
7
7
|
import { defaultSettings } from '../src/data/config.js';
|
|
8
8
|
import { getActiveSeasons } from '../src/scripts/utils.js';
|
|
9
9
|
|
|
10
|
+
import setupDevOpsTrackingId from './setupDevOpsTrackingId.js';
|
|
11
|
+
|
|
10
12
|
const axiosInstance = axios.create();
|
|
11
13
|
const tcpaAxiosInstance = axios.create();
|
|
12
14
|
const consentCaptureAxiosInstance = axios.create();
|
|
@@ -328,6 +330,9 @@ export default async function(config) {
|
|
|
328
330
|
if (!config.consentCapture && !tempConfigCreated) {
|
|
329
331
|
await getConsentCaptureLanguage(config, tempConfig);
|
|
330
332
|
}
|
|
333
|
+
if (!config.devOpsTrackingId && !tempConfigCreated) {
|
|
334
|
+
await setupDevOpsTrackingId(config);
|
|
335
|
+
}
|
|
331
336
|
}
|
|
332
337
|
|
|
333
338
|
if (!tempConfigCreated) {
|