Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: release candidate #321

Merged
merged 27 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2c66e48
chore: make turbopack the default for local dev (#274)
codeincontext Oct 28, 2024
a157b9a
fix: use prisma generate --no-engine and reinstate prompts script (#282)
stefl Oct 28, 2024
647c904
fix: use browserLogger for errors in the browser (#280)
codeincontext Oct 29, 2024
3ed678f
test: prevent jest from bypassing inngest dev mode (#278)
codeincontext Oct 29, 2024
290855b
test: reduce workers for jest in CI (#277)
codeincontext Oct 29, 2024
3a1bfd4
fix: use noengine in ci (#283)
stefl Oct 29, 2024
5aaa1d9
feat: add an incrementing iteration number to the chat (#263)
stefl Oct 29, 2024
adc1efa
fix: reintroduce custom eslint (#284)
stefl Oct 29, 2024
f9c93ec
chore: ensure we follow the eslint rule to use "import type" notation…
stefl Oct 29, 2024
4e5e1f2
feat: selectively include Americanisms, RAG, analytics when instantia…
stefl Oct 29, 2024
8553fb0
chore: fix eslint import types on nextjs project (#288)
codeincontext Oct 29, 2024
bc26948
fix: set VS Code to prefer type imports (#291)
stefl Oct 29, 2024
0b2b7c5
chore: incrementally move Core not to use barrel files (#290)
stefl Oct 29, 2024
bc8ef36
chore: use DEBUG logging var on the frontend (#275)
codeincontext Oct 29, 2024
548b85d
chore: incrementally move to Aila not using barrel files (#289)
stefl Oct 29, 2024
c9cb82b
fix: await the enqueue method in web actions (#293)
stefl Oct 29, 2024
a7eaefa
fix: pages that do not load data do not need to be async (#296)
stefl Oct 29, 2024
cd35dc1
fix: rename accordian to accordion (#297)
stefl Oct 29, 2024
be79158
fix: completion and system messages do not need to be async (#294)
stefl Oct 29, 2024
730dbb9
fix: await persisting the generation (#292)
stefl Oct 29, 2024
1212eb5
fix: linting for app components (#295)
stefl Oct 29, 2024
c332717
fix: update imports (type prefixes, paths) (#298)
stefl Oct 29, 2024
f39c4ac
chore: linting strings to match the new linting rules (#302)
stefl Oct 30, 2024
5f9845c
chore: remove unused text encoder from PatchEnqueuer (#312)
stefl Oct 30, 2024
1e05c1a
fix: await the save download event call (#317)
stefl Oct 30, 2024
1824aea
fix: promisify chat API route get handler (#316)
stefl Oct 30, 2024
7ce6d11
build: temporarily disable the prompts dependency when building RCs (…
codeincontext Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
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
Loading