Skip to content

Commit

Permalink
Merge pull request #321 from oaknational/rc-20241030-1
Browse files Browse the repository at this point in the history
build: release candidate
  • Loading branch information
mikeritson-oak authored Oct 31, 2024
2 parents 6a7b750 + 7ce6d11 commit 45e4482
Show file tree
Hide file tree
Showing 503 changed files with 5,564 additions and 4,202 deletions.
7 changes: 1 addition & 6 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: ["eslint-config-custom"],
parserOptions: {
tsconfigRootDir: __dirname,
project: [
Expand All @@ -10,9 +10,4 @@ module.exports = {
"./packages/*/tsconfig.json",
],
},
plugins: ["@typescript-eslint"],
extends: ["plugin:@typescript-eslint/recommended"],
rules: {
"no-console": "warn"
}
};
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: pnpm install

- name: Generate prisma client
run: pnpm db-generate
run: pnpm db-generate:no-engine

- name: Inject Doppler env vars
uses: dopplerhq/[email protected]
Expand All @@ -43,4 +43,4 @@ jobs:
inject-env-vars: true

- name: Run tests
run: pnpm turbo test --cache-dir=".turbo"
run: pnpm turbo test --cache-dir=".turbo" -- --maxWorkers=33%
13 changes: 12 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@
"autodocs",
"autoprefixer",
"autosize",
"backmerge",
"backticked",
"beitzah",
"bethclark",
"bugsnag",
"categorisation",
"Categorised",
"centered",
"cloudinary",
"clsx",
"codegen",
"COLOR",
"compat",
"contrib",
"cuid",
Expand All @@ -40,6 +43,7 @@
"Docgen",
"dockerized",
"dopplerhq",
"dotenv",
"EASS",
"EHRC",
"estree",
Expand Down Expand Up @@ -106,6 +110,7 @@
"ponyfill",
"popover",
"portabletext",
"postcss",
"posthog",
"postpack",
"posttest",
Expand All @@ -117,6 +122,7 @@
"psql",
"pusherapp",
"ratelimit",
"refs",
"Regen",
"remeda",
"Rerank",
Expand All @@ -128,6 +134,7 @@
"sslmode",
"SUBJ",
"superjson",
"svgs",
"tailwindcss",
"tanstack",
"testid",
Expand All @@ -143,6 +150,8 @@
"turborepo",
"uidotdev",
"unjudged",
"unsets",
"unshallow",
"unsummarised",
"untruncate",
"untruncated",
Expand All @@ -154,6 +163,7 @@
"valign",
"vars",
"vectorstores",
"vercel",
"WCAG",
"webvtt",
"zadd",
Expand Down Expand Up @@ -193,5 +203,6 @@
"yaml.schemas": {
"file:///c%3A/Users/Simon/.vscode/extensions/atlassian.atlascode-2.8.6/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml",
"https://www.artillery.io/schema.json": []
}
},
"typescript.preferences.preferTypeOnlyAutoImports": true
}
3 changes: 3 additions & 0 deletions apps/nextjs/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ module.exports = {
},
],
},
parserOptions: {
project: __dirname + "/tsconfig.json",
},
};
2 changes: 2 additions & 0 deletions apps/nextjs/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type { StorybookConfig } from "@storybook/nextjs";
import { join, dirname, resolve } from "path";
import webpack from "webpack";

process.env.NEXT_PUBLIC_DEBUG = process.env.DEBUG;

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
Expand Down
1 change: 0 additions & 1 deletion apps/nextjs/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "@fontsource/lexend/800.css";
import "@fontsource/lexend/900.css";
import { OakThemeProvider, oakDefaultTheme } from "@oaknational/oak-components";
import type { Preview, Decorator } from "@storybook/react";
import { GeistMono } from "geist/font/mono";

// ModerationProvider is coming in the main Chat.tsx refactor
//import { ModerationProvider } from "../src/components/AppComponents/Chat/Chat/ModerationProvider";
Expand Down
2 changes: 2 additions & 0 deletions apps/nextjs/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require("@testing-library/jest-dom");

process.env.NEXT_PUBLIC_DEBUG = process.env.DEBUG;

// Mock Next.js Image component
jest.mock("next/image", () => ({
__esModule: true,
Expand Down
58 changes: 27 additions & 31 deletions apps/nextjs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const {
RELEASE_STAGE_TESTING,
} = require("./scripts/build_config_helpers.js");
const path = require("path");
const Sentry = require("@sentry/nextjs");

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

Expand Down Expand Up @@ -89,6 +88,7 @@ const getConfig = async (phase) => {
env: {
NEXT_PUBLIC_APP_VERSION: appVersion,
NEXT_PUBLIC_RELEASE_STAGE: releaseStage,
NEXT_PUBLIC_DEBUG: process.env.DEBUG,
},

productionBrowserSourceMaps: true,
Expand Down Expand Up @@ -155,41 +155,37 @@ const getConfig = async (phase) => {

module.exports = getConfig;

if (!process.env.TURBOPACK) {
module.exports = withSentryConfig(module.exports, {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
module.exports = withSentryConfig(module.exports, {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,

// Only print logs for uploading source maps in CI
silent: !process.env.CI,
// Only print logs for uploading source maps in CI
silent: !process.env.CI,

// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: "/monitoring",
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: "/monitoring",

// Hides source maps from generated client bundles
hideSourceMaps: true,
// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,

// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
});
}

module.exports.onRequestError = Sentry.captureRequestError;
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
});
10 changes: 4 additions & 6 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"build:dev": "pnpm with-env next build",
"check": "tsc --noEmit",
"clean": "rm -rf .next .turbo node_modules",
"dev": "FORCE_COLOR=1 concurrently \"pnpm dev-server\" \"node scripts/local-dev.mjs\"",
"dev-turbo": "FORCE_COLOR=1 concurrently \"pnpm dev-server-turbo\" \"node scripts/local-dev.mjs\"",
"dev-server-turbo": "FORCE_COLOR=1 pnpm with-env node scripts/increase-listeners.js next dev --port 2525 --turbo | pino-pretty -C",
"dev-server": "FORCE_COLOR=1 pnpm with-env node scripts/increase-listeners.js next dev --port 2525 | pino-pretty -C",
"dev": "FORCE_COLOR=1 SENTRY_SUPPRESS_TURBOPACK_WARNING=1 pnpm with-env node scripts/increase-listeners.js next dev --port 2525 --turbo | pino-pretty -C",
"dev:sentry": "FORCE_COLOR=1 pnpm with-env node scripts/increase-listeners.js next dev --port 2525 | pino-pretty -C",
"dev-trace-deprecation": "NODE_OPTIONS=\"--trace-deprecation\" next dev --port 2525 | pino-pretty -C",
"lint": "next lint",
"lint-fix": "next lint --fix",
Expand Down Expand Up @@ -56,7 +54,7 @@
"@radix-ui/react-tooltip": "^1.0.7",
"@radix-ui/themes": "^1.0.0",
"@sanity/client": "^6.21.3",
"@sentry/nextjs": "^8.19.0",
"@sentry/nextjs": "^8.35.0",
"@storybook/testing-react": "^2.0.1",
"@tanstack/react-query": "^4.16.1",
"@testing-library/jest-dom": "^6.4.8",
Expand Down Expand Up @@ -151,7 +149,7 @@
"concurrently": "^8.2.2",
"dotenv-cli": "^6.0.0",
"eslint": "^8.56.0",
"eslint-config-next": "14.0.4",
"eslint-config-next": "15.0.1",
"eslint-plugin-storybook": "^0.8.0",
"graphql": "^16.9.0",
"jest": "^29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/scripts/aila-cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Aila } from "@oakai/aila";
import { Aila } from "@oakai/aila/src/core/Aila";
import { AilaPlugin } from "@oakai/aila/src/core/plugins";

const cliPlugin: AilaPlugin = {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/nextjs/src/ai-apps/common/getSessionOutput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Apps } from "@oakai/core";
import { Apps } from "@oakai/core/src/models/apps";
import { prisma } from "@oakai/db";
import { outputSchema } from "ai-apps/generations/types";

Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/ai-apps/common/parseLocalStorageData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { aiLogger } from "@oakai/logger";
import * as Sentry from "@sentry/nextjs";
import { z } from "zod";
import type { z } from "zod";

const log = aiLogger("ui");

Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/src/ai-apps/common/state/create-parts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
import type {
GenerationPart,
GenerationPartAIGenerated,
GenerationPartType,
GenerationPartUserTweaked,
} from "@oakai/core/src/types";
import { GenerationPartType } from "@oakai/core/src/types";

export function createAIGeneratedPart<Value>(
value: Value,
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/ai-apps/common/state/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GenerationPart } from "@oakai/core/src/types";
import type { GenerationPart } from "@oakai/core/src/types";

/**
* Apply the `updater` function to the item
Expand Down
10 changes: 5 additions & 5 deletions apps/nextjs/src/ai-apps/lesson-planner/state/actions.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { RateLimitInfo } from "@oakai/api/src/types";
import { KeyStageName, SubjectName } from "@oakai/core";
import {
import type { RateLimitInfo } from "@oakai/api/src/types";
import type { KeyStageName, SubjectName } from "@oakai/core";
import type {
QuizAppQuestion,
QuizAppStateQuestion,
} from "ai-apps/quiz-designer/state/types";

import { DeepPartial } from "@/utils/types/DeepPartial";
import type { DeepPartial } from "@/utils/types/DeepPartial";

import {
import type {
LPKeyLearningPoint,
LPKeyword,
LPMisconception,
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/ai-apps/quiz-designer/convertToCSV.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExportableQuizAppState } from "@oakai/exports/src/schema/input.schema";
import type { ExportableQuizAppState } from "@oakai/exports/src/schema/input.schema";

export function convertQuizToCSV(data: ExportableQuizAppState) {
// Define the headers for your CSV
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/src/ai-apps/quiz-designer/convertToGIFTFormat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
ExportableQuizAppState,
ExportableQuizQuestion,
} from "@oakai/exports/src/schema/input.schema";
Expand Down Expand Up @@ -29,7 +29,7 @@ export function convertToGIFTFormat(
}
}

giftString += `\n}\n`;
giftString += "\n}\n";
}

return giftString;
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/src/ai-apps/quiz-designer/export-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
import type {
ExportableQuizAppState,
ExportableQuizQuestion,
} from "@oakai/exports/src/schema/input.schema";
import { getGenerationPartValue } from "ai-apps/common/state/helpers";

import { sortAlphabetically } from "@/utils/alphabetiseArray";

import {
import type {
QuizAppQuestion,
QuizAppState,
QuizAppStateQuestion,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QuizAppState, QuizAppStateQuestion } from "./state/types";
import type { QuizAppState, QuizAppStateQuestion } from "./state/types";

type OtherQuestionForPromptPropos = {
state: QuizAppState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { GenerationPart } from "@oakai/core/src/types";
import type { GenerationPart } from "@oakai/core/src/types";

import { getAgesFromKeyStage } from "@/utils/getAgesFromKeyStage";

import { extraQuizPromptInfo } from "./extraQuizPromptInfo";
import { QuizAppState, QuizAppStateQuestion } from "./state/types";
import type { QuizAppState, QuizAppStateQuestion } from "./state/types";

type RequestionGenerationInputs = {
lastGenerationId: string | null;
Expand Down
8 changes: 4 additions & 4 deletions apps/nextjs/src/ai-apps/quiz-designer/state/actions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RateLimitInfo } from "@oakai/api/src/types";
import { KeyStageName, SubjectName } from "@oakai/core";
import { PotentialQuestionsType } from "hooks/useSuggestedQuestions";
import type { RateLimitInfo } from "@oakai/api/src/types";
import type { KeyStageName, SubjectName } from "@oakai/core";
import type { PotentialQuestionsType } from "hooks/useSuggestedQuestions";

import { QuizAppState, QuizQuestionType } from "./types";
import type { QuizAppState, QuizQuestionType } from "./types";

/**
* Our action types are declared as a const enum with string values
Expand Down
Loading

0 comments on commit 45e4482

Please sign in to comment.