Skip to content

Commit d5d15bf

Browse files
author
George Haberis
committed
ab test build args now only specify filenames
1 parent af0f7cb commit d5d15bf

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

ab-testing/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"tasks": {
33
"validate": "deno run scripts/validation/index.ts",
44
"deploy": "deno run --allow-read=dist --allow-env=FASTLY_AB_TESTING_CONFIG --allow-net=api.fastly.com:443 scripts/deploy/index.ts --mvts=dist/mvts.json --ab-tests=dist/ab-tests.json",
5-
"build": "deno run --allow-env=FASTLY_AB_TESTING_CONFIG,FASTLY_API_TOKEN --allow-net=api.fastly.com:443 --allow-write scripts/build/index.ts --mvts=dist/mvts.json --ab-tests=dist/ab-tests.json"
5+
"build": "deno run --allow-env=FASTLY_AB_TESTING_CONFIG,FASTLY_API_TOKEN --allow-net=api.fastly.com:443 --allow-write=dist scripts/build/index.ts --mvts=mvts.json --ab-tests=ab-tests.json"
66
},
77
"imports": {
88
"@std/assert": "jsr:@std/assert@^1.0.13",

ab-testing/scripts/build/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,22 @@ const mvtDictArray = Array.from(
3838

3939
console.log(`Writing ${mvtDictArray.length} MVT groups to ${flags['mvts']}`);
4040

41+
const distDirName = 'dist';
42+
4143
// Ensure the dist folder exists
42-
await Deno.mkdir('dist', { recursive: true });
44+
await Deno.mkdir(distDirName, { recursive: true });
45+
46+
// Build absolute output path inside dist/
47+
const abTestsPath = `${distDirName}/${flags['ab-tests']}`;
4348

4449
// write the abTestDictArray to a file
4550
await Deno.writeTextFile(
46-
flags['ab-tests'],
51+
abTestsPath,
4752
JSON.stringify(abTestGroupKeyValues, null, 2),
4853
);
4954

55+
// Build absolute output pats inside dist/
56+
const mvtsPath = `${distDirName}/${flags['mvts']}`;
57+
5058
// write the mvtKVsArray to a file
51-
await Deno.writeTextFile(flags['mvts'], JSON.stringify(mvtDictArray, null, 2));
59+
await Deno.writeTextFile(mvtsPath, JSON.stringify(mvtDictArray, null, 2));

0 commit comments

Comments
 (0)