Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ab-testing-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Checks
defaults:
run:
working-directory: ab-testing
working-directory: ab-testing/config
env:
FASTLY_AB_TESTING_CONFIG: ${{ secrets.FASTLY_AB_TESTING_CONFIG }}
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
Expand Down Expand Up @@ -55,4 +55,4 @@ jobs:
uses: actions/upload-artifact@v5
with:
name: ab-testing-build
path: ab-testing/dist
path: ab-testing/config/dist
4 changes: 2 additions & 2 deletions .github/workflows/ab-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ab-testing
working-directory: ab-testing/config
steps:
- uses: actions/checkout@v5

Expand All @@ -33,7 +33,7 @@ jobs:
uses: actions/download-artifact@v6.0.0
with:
name: ab-testing-build
path: ab-testing/dist
path: ab-testing/config/dist

- name: Deploy
run: pnpm run deploy
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 16 additions & 4 deletions ab-testing/package.json → ab-testing/config/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@guardian/ab-testing",
"name": "@guardian/ab-testing-config",
"version": "1.0.0",
"description": "A/B test definitions and configuration",
"main": "index.ts",
Expand All @@ -8,21 +8,33 @@
"validate": "node scripts/validation/index.ts",
"deploy": "node scripts/deploy/index.ts --mvts=dist/mvts.json --ab-tests=dist/ab-tests.json",
"build": "node scripts/build/index.ts --mvts=dist/mvts.json --ab-tests=dist/ab-tests.json",
"build-ui": "pnpm --filter @guardian/ab-testing-frontend run build",
"test": "node --test",
"test": "node --test --test-reporter spec ./**/*.test.ts",
"lint": "eslint .",
"prettier:check": "prettier . --check --cache",
"prettier:fix": "prettier . --write --cache"
"prettier:fix": "prettier . --write --cache",
"lint-staged": "lint-staged"
},
"dependencies": {
"superstruct": "2.0.2"
},
"lint-staged": {
"*.ts": [
"pnpm lint --fix",
"pnpm prettier:fix"
]
},
"devDependencies": {
"@aws-sdk/client-s3": "3.931.0",
"@aws-sdk/client-ssm": "3.621.0",
"@guardian/cdk": "62.0.1",
"@guardian/eslint-config": "12.0.1",
"@guardian/tsconfig": "1.0.1",
"@types/node": "22.17.0",
"aws-cdk": "2.1030.0",
"aws-cdk-lib": "2.220.0",
"eslint": "9.39.1",
"prettier": "3.0.3",
"source-map-support": "0.5.21",
"typescript": "5.9.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { stringifyFastlySubfield } from "../../lib/fastly-subfield.ts";
import type { ABTest } from "../../types.ts";
import { stringifyFastlySubfield } from "../lib/fastly-subfield.ts";

const buildABTestGroupKeyValues = (tests: ABTest[]) =>
tests.flatMap((test) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { deepEqual, equal, throws } from "node:assert";
import { test } from "node:test";
import type { ABTest } from "../../types.ts";
import type {
AllSpace,
AudienceSpace,
FastlyTestParams,
} from "../lib/types.ts";
} from "../../lib/types.ts";
import type { ABTest } from "../../types.ts";
import {
calculateAllSpaceUpdates,
calculateSpaceUpdates,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ABTest } from "../../types.ts";
import { AUDIENCE_SPACES, MVT_COUNT } from "../lib/constants.ts";
import { AUDIENCE_SPACES, MVT_COUNT } from "../../lib/constants.ts";
import type {
AllSpace,
AudienceSpace,
FastlyTestParams,
} from "../lib/types.ts";
} from "../../lib/types.ts";
import type { ABTest } from "../../types.ts";
import { TestGroupMVTManager } from "./test-group-mvt-manager.ts";

const getTestGroupName = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { mkdir, writeFile } from "node:fs/promises";
import { dirname } from "node:path";
import { parseArgs } from "node:util";
import { activeABtests } from "../../abTests.ts";
import { getMVTGroupsFromDictionary } from "../lib/fastly-api.ts";
import { parseMVTValue, stringifyMVTValue } from "../lib/fastly-subfield.ts";
import { getMVTGroupsFromDictionary } from "../../lib/fastly-api.ts";
import { parseMVTValue, stringifyMVTValue } from "../../lib/fastly-subfield.ts";
import { buildABTestGroupKeyValues } from "./build-ab-tests-dict.ts";
import { calculateAllSpaceUpdates } from "./calculate-mvt-updates.ts";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepEqual, equal, throws } from "node:assert";
import test from "node:test";
import type { AudienceSpace } from "../lib/types.ts";
import type { AudienceSpace } from "../../lib/types.ts";
import { TestGroupMVTManager } from "./test-group-mvt-manager.ts";

// Helper function to create mock AudienceSpace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MVT_COUNT } from "../lib/constants.ts";
import type { AudienceSpace } from "../lib/types.ts";
import { MVT_COUNT } from "../../lib/constants.ts";
import type { AudienceSpace } from "../../lib/types.ts";

/**
* A class to manage MVTs for test groups in a test space.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
calculateUpdates,
getABTestGroupsFromDictionary,
updateABTestGroups,
} from "../lib/fastly-api.ts";
} from "../../lib/fastly-api.ts";
import { getUpdatedABTestGroups } from "./read-built-dictionaries.ts";

const deployABTests = async (filePath: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
calculateUpdates,
getMVTGroupsFromDictionary,
updateMVTGroups,
} from "../lib/fastly-api.ts";
} from "../../lib/fastly-api.ts";
import { getMVTGroups } from "./read-built-dictionaries.ts";

const deployMVTs = async (filePath: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
mvtDictionaryName,
serviceId,
serviceName,
} from "../lib/config.ts";
import { getService, verifyDictionaryName } from "../lib/fastly-api.ts";
} from "../../lib/config.ts";
import { getService, verifyDictionaryName } from "../../lib/fastly-api.ts";
import { deployABTests } from "./deploy-ab-tests.ts";
import { deployMVTs } from "./deploy-mvts.ts";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { equal, throws } from "node:assert";
import test from "node:test";
import { MAX_SERVER_SIDE_TESTS } from "../../lib/constants.ts";
import type { ABTest } from "../../types.ts";
import { MAX_SERVER_SIDE_TESTS } from "../lib/constants.ts";
import { limitServerSideTests } from "./limitServerSide.ts";

test("limitServerSideTests - throws if the amount of tests exceeds the limit", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MAX_SERVER_SIDE_TESTS } from "../../lib/constants.ts";
import type { ABTest } from "../../types.ts";
import { MAX_SERVER_SIDE_TESTS } from "../lib/constants.ts";

export function limitServerSideTests(tests: ABTest[]) {
const serverSideTests = tests.filter((test) => test.type === "server");
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ab-testing/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import guardian from "@guardian/eslint-config";
import { defineConfig, globalIgnores } from "eslint/config";

export default defineConfig([
globalIgnores(["frontend", "eslint.config.mjs", "index.ts"]),
globalIgnores(["frontend", "eslint.config.mjs", "config/index.ts"]),
...guardian.configs.recommended,
{
languageOptions: {
Expand Down
2 changes: 1 addition & 1 deletion ab-testing/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@guardian/ab-testing": "workspace:ab-testing",
"@guardian/ab-testing-config": "workspace:ab-testing-config",
"@sveltejs/adapter-auto": "^6.0.0",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/kit": "^2.16.0",
Expand Down
2 changes: 1 addition & 1 deletion ab-testing/frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { allABTests, activeABtests } from "@guardian/ab-testing";
import { allABTests, activeABtests } from "@guardian/ab-testing-config";
import Table from "$lib/components/TableFixed.svelte";
import AudienceBreakdown from "$lib/components/AudienceBreakdown.svelte";
</script>
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@emotion/react": "11.14.0",
"@emotion/server": "11.11.0",
"@guardian/ab-core": "8.0.0",
"@guardian/ab-testing": "workspace:ab-testing",
"@guardian/ab-testing-config": "workspace:ab-testing-config",
"@guardian/braze-components": "22.2.0",
"@guardian/bridget": "8.7.0",
"@guardian/browserslist-config": "6.1.0",
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/components/Metrics.importable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ABTest, ABTestAPI } from '@guardian/ab-core';
import { activeABtests } from '@guardian/ab-testing';
import { activeABtests } from '@guardian/ab-testing-config';
import {
bypassCommercialMetricsSampling,
EventTimer,
Expand Down
Loading
Loading