Skip to content

Commit

Permalink
Merge branch 'main' into fix/posthog-consistent-event-properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mantagen committed Dec 11, 2024
2 parents 2937ae4 + 071d2d1 commit b25a838
Show file tree
Hide file tree
Showing 159 changed files with 3,534 additions and 2,025 deletions.
13 changes: 0 additions & 13 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/actions/ref_from_sha/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ outputs:
description: "The number of the PR if one is found"
runs:
using: "node20"
main: "index.js"
main: "index.cjs"
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
const core = require("@actions/core");
const github = require("@actions/github");

const prFromSha = require("./pr_from_sha");
const branchFromSha = require("./branch_from_sha");
const prFromSha = require("./pr_from_sha.cjs");
const branchFromSha = require("./branch_from_sha.cjs");

async function run() {
try {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const github = require("@actions/github");

const prFromSha = require("../pr_from_sha");
const branchFromSha = require("../branch_from_sha");
const prFromSha = require("../pr_from_sha.cjs");
const branchFromSha = require("../branch_from_sha.cjs");

const githubToken = process.env.GITHUB_TOKEN;

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,15 @@ jobs:
inject-env-vars: true

- name: Run tests
run: pnpm turbo test --cache-dir=".turbo" -- --maxWorkers=33%
run: pnpm turbo test --cache-dir=".turbo" -- --maxWorkers=33% --coverage

# Run only on production branch
- name: Report coverage to SonarCloud
if: ${{ github.event.pull_request.merged == true && github.base_ref == 'production' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.javascript.lcov.reportPaths=packages/**/coverage/lcov.info,apps/nextjs/coverage/lcov.info
24 changes: 24 additions & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## [1.17.1](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.17.0...v1.17.1) (2024-12-03)


### Bug Fixes

* add linting command to db package ([#392](https://github.com/oaknational/oak-ai-lesson-assistant/issues/392)) ([d2177d5](https://github.com/oaknational/oak-ai-lesson-assistant/commit/d2177d5c061e973affd1ea52b0ef025c8c37cb29))
* address sonar major issues ([#393](https://github.com/oaknational/oak-ai-lesson-assistant/issues/393)) ([202a21f](https://github.com/oaknational/oak-ai-lesson-assistant/commit/202a21fbac0d457514c9944735b174c79dced08c))
* do not define components inline ([#413](https://github.com/oaknational/oak-ai-lesson-assistant/issues/413)) ([abda175](https://github.com/oaknational/oak-ai-lesson-assistant/commit/abda1753afecd9385b19b695767568abdd4383c1))
* do not use array index for key / use void for onSubmit ([#409](https://github.com/oaknational/oak-ai-lesson-assistant/issues/409)) ([44b5961](https://github.com/oaknational/oak-ai-lesson-assistant/commit/44b59617f3af8cad83110efdc2cb4df23d06e073))
* help page cloudflare email ([#399](https://github.com/oaknational/oak-ai-lesson-assistant/issues/399)) ([f6262f2](https://github.com/oaknational/oak-ai-lesson-assistant/commit/f6262f26d470a30ea721343bbab2cbfded77b91d))
* high and medium severity bugs on sonar cloud - AI-637 ([#379](https://github.com/oaknational/oak-ai-lesson-assistant/issues/379)) ([fb0258e](https://github.com/oaknational/oak-ai-lesson-assistant/commit/fb0258ec2f3c0d5fb79d884d3918827460cba404))
* icons in dialogs ([#398](https://github.com/oaknational/oak-ai-lesson-assistant/issues/398)) ([9700214](https://github.com/oaknational/oak-ai-lesson-assistant/commit/970021462a94b800dba270130f5ba1b1548e8745))
* intentionality of async / promise code for question generation ([#402](https://github.com/oaknational/oak-ai-lesson-assistant/issues/402)) ([65d1c5f](https://github.com/oaknational/oak-ai-lesson-assistant/commit/65d1c5f89c1b238e24315c02bde2e9eb253b4da3))
* memoize the sidebar context provider's value ([#408](https://github.com/oaknational/oak-ai-lesson-assistant/issues/408)) ([60ee010](https://github.com/oaknational/oak-ai-lesson-assistant/commit/60ee0102ea1ee733d6527c5460fd404cd7773292))
* minor sonar issues ([#390](https://github.com/oaknational/oak-ai-lesson-assistant/issues/390)) ([015cd25](https://github.com/oaknational/oak-ai-lesson-assistant/commit/015cd25984c3e5d1a545afef39fd111aa5245d58))
* prefer nullish coalescing ([#391](https://github.com/oaknational/oak-ai-lesson-assistant/issues/391)) ([b40def9](https://github.com/oaknational/oak-ai-lesson-assistant/commit/b40def9cfd3d69a0089db861a2f6ed47321a3753))
* readonly props for icons.tsx ([#389](https://github.com/oaknational/oak-ai-lesson-assistant/issues/389)) ([7b4d5bc](https://github.com/oaknational/oak-ai-lesson-assistant/commit/7b4d5bcc508b3179ea5313ec783aba90d1a7f3ae))
* revert tabindex change ([#404](https://github.com/oaknational/oak-ai-lesson-assistant/issues/404)) ([ac72713](https://github.com/oaknational/oak-ai-lesson-assistant/commit/ac72713dc54595f6bfacfd99e63899616f18b8ec))
* sonar maintain issues [#4](https://github.com/oaknational/oak-ai-lesson-assistant/issues/4) ([#405](https://github.com/oaknational/oak-ai-lesson-assistant/issues/405)) ([eca0019](https://github.com/oaknational/oak-ai-lesson-assistant/commit/eca001996a684f8d01465196c1c600d00e43a964))
* sonar maintain linting [#1](https://github.com/oaknational/oak-ai-lesson-assistant/issues/1) ([#394](https://github.com/oaknational/oak-ai-lesson-assistant/issues/394)) ([f4d95fc](https://github.com/oaknational/oak-ai-lesson-assistant/commit/f4d95fcbf39c3c43c3811f8c2022a37af363826a))
* sonar maintain linting [#2](https://github.com/oaknational/oak-ai-lesson-assistant/issues/2) ([#395](https://github.com/oaknational/oak-ai-lesson-assistant/issues/395)) ([1ed9d60](https://github.com/oaknational/oak-ai-lesson-assistant/commit/1ed9d6028713b096a68a0558d67608dc9efb812f))
* sonar maintain linting [#3](https://github.com/oaknational/oak-ai-lesson-assistant/issues/3) ([#403](https://github.com/oaknational/oak-ai-lesson-assistant/issues/403)) ([daa7efe](https://github.com/oaknational/oak-ai-lesson-assistant/commit/daa7efe6a2d5d2501f5108cd3c1ccaec86126655))
* sonar minors [#5](https://github.com/oaknational/oak-ai-lesson-assistant/issues/5) ([#414](https://github.com/oaknational/oak-ai-lesson-assistant/issues/414)) ([5f749f4](https://github.com/oaknational/oak-ai-lesson-assistant/commit/5f749f42f9f5d3d78c736438e313f4f5eff5406b))

# [1.17.0](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.16.2...v1.17.0) (2024-11-28)


Expand Down
24 changes: 0 additions & 24 deletions apps/nextjs/.eslintrc.cjs

This file was deleted.

91 changes: 91 additions & 0 deletions apps/nextjs/.storybook/chromatic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import "@storybook/csf";

type ChromaticModes = "mobile" | "mobile-wide" | "desktop" | "desktop-wide";

export function chromaticParams(modes: ChromaticModes[]) {
return {
chromatic: {
modes: {
...(modes.includes("mobile") && {
mobile: { viewport: "mobile" },
}),
...(modes.includes("mobile-wide") && {
mobile: { viewport: "mobile-wide" },
}),
...(modes.includes("desktop") && {
desktop: { viewport: "desktop" },
}),
...(modes.includes("desktop-wide") && {
"desktop-wide": { viewport: "desktopWide" },
}),
},
},
};
}

declare module "@storybook/csf" {
interface Parameters {
/**
* Parameters for chromatic
*/
chromatic?: {
/**
* Delay capture for a fixed time (in milliseconds) to allow your story to get into
* the intended state
*
* @see [delaying snapshots chromatic documentation](https://www.chromatic.com/docs/delay)
*/
delay?: number;
/**
* Override this behavior in instances where a single pixel change is not flagged by
* Chromatic but should be
*
* * @see [anti-aliasing chromatic documentation](https://www.chromatic.com/docs/threshold#anti-aliasing)
*
* @default false
*/
diffIncludeAntiAliasing?: boolean;
/**
* The diffThreshold parameter allows you to fine tune the threshold for visual change
* between snapshots before they're flagged by Chromatic. Sometimes you need assurance
* to the sub-pixel and other times you want to skip visual noise generated by
* non-deterministic rendering such as anti-aliasing.
*
* 0 is the most accurate. 1 is the least accurate.
*
* @default 0.063
*/
diffThreshold?: number;
/**
* You can omit stories entirely from Chromatic testing using the disable story parameter.
*
* @see [ignoring elements chromatic documentation](https://www.chromatic.com/docs/ignoring-elements)
*/
disable?: boolean;
/**
* Modes
*
* @see [modes chromatic documentation](https://www.chromatic.com/docs/modes)
*/
modes?: Record<
string,
{
viewport?: string | number;
theme?: "light" | "dark";
backgrounds?: { value: string };
}
>;
/**
* Define one or more viewport sizes to capture. Note, units are considered in pixels
*/
viewports?: number[];
/**
* To specify that Chromatic should pause the animation at the end instead of reseting
* them to their beginning state.
*
* @see [animations chromatic documentation](https://www.chromatic.com/docs/animations)
*/
pauseAnimationAtEnd?: boolean;
};
}
}
22 changes: 22 additions & 0 deletions apps/nextjs/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { DialogProvider } from "../src/components/AppComponents/DialogContext";
import { AnalyticsProvider } from "../src/mocks/analytics/provider";
import { ClerkDecorator } from "../src/mocks/clerk/ClerkDecorator";
import { TRPCReactProvider } from "../src/utils/trpc";
import { chromaticParams } from "./chromatic";
import { RadixThemeDecorator } from "./decorators/RadixThemeDecorator";
import "./preview.css";

Expand All @@ -28,6 +29,27 @@ const preview: Preview = {
date: /Date$/i,
},
},
viewport: {
viewports: {
mobile: {
name: "Mobile",
styles: { width: "375px", height: "800px" },
},
mobileWide: {
name: "Mobile Wide",
styles: { width: "430px", height: "930px" },
},
desktop: {
name: "Desktop",
styles: { width: "1200px", height: "1000px" },
},
desktopWide: {
name: "Desktop Wide",
styles: { width: "1400px", height: "1000px" },
},
},
},
...chromaticParams(["desktop"]),
},
loaders: [mswLoader],
};
Expand Down
18 changes: 12 additions & 6 deletions apps/nextjs/jest.config.js → apps/nextjs/jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("./tsconfig.test.json");
import { readFile } from "fs/promises";
import { pathsToModuleNameMapper } from "ts-jest";

const tsconfig = JSON.parse(
await readFile(new URL("./tsconfig.test.json", import.meta.url)),
);

/** @type {import('ts-jest').JestConfigWithTsJest} */
const config = {
Expand All @@ -9,14 +13,15 @@ const config = {
{
tsconfig: "tsconfig.test.json",
useESM: true,
isolatedModules: true,
},
],
"^.+\\.svg$": "<rootDir>/jest.svgTransform.js",
"^.+\\.svg$": "<rootDir>/jest.svgTransform.mjs",
"^.+\\.(css|scss|png|jpg|jpeg|gif|webp|avif)$": "jest-transform-stub",
},
preset: "ts-jest/presets/default-esm",
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths, {
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: "<rootDir>/src/",
}),
"^(\\.{1,2}/.*)\\.js$": "$1",
Expand All @@ -29,11 +34,12 @@ const config = {
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
rootDir: ".",
resetMocks: true,
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
setupFilesAfterEnv: ["<rootDir>/jest.setup.cjs"],
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
collectCoverage:
process.env.CI === "true" || process.env.COLLECT_TEST_COVERAGE === "true",
coverageReporters: ["lcov", "text"],
coverageDirectory: "coverage",
};

module.exports = config;
export default config;
File renamed without changes.
1 change: 1 addition & 0 deletions apps/nextjs/jest.static.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module "*.svg" {
const content: any;
export default content;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
process() {
console.log("Called jest svg transform");
return { code: "module.exports = {};" };
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
3 changes: 2 additions & 1 deletion apps/nextjs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// This file should be in Common JS format to be compatible with Next.js
const {
getAppVersion,
getReleaseStage,
RELEASE_STAGE_PRODUCTION,
RELEASE_STAGE_TESTING,
} = require("./scripts/build_config_helpers.js");
} = require("./scripts/build_config_helpers.cjs");
const path = require("path");

const { PHASE_PRODUCTION_BUILD, PHASE_TEST } = require("next/constants");
Expand Down
Loading

0 comments on commit b25a838

Please sign in to comment.