Skip to content

Commit

Permalink
use new cfl package (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos authored Jun 6, 2024
1 parent 6ea918c commit 7bd3620
Show file tree
Hide file tree
Showing 14 changed files with 802 additions and 780 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
],
"message": "Please use pre-typed versions from `src/app/hooks.ts` instead."
}
],
"patterns": [
{
"group": [
"codeforlife/src"
],
"message": "Please use `codeforlife` instead of `codeforlife/src`."
}
]
}
]
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@
"lint:fix": "eslint --fix .",
"type-check": "tsc --noEmit"
},
"//": "🚫 Don't add `dependencies` below that are inherited from the CFL package.",
"dependencies": {
"@reduxjs/toolkit": "^2.0.1",
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v1.27.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^9.1.0",
"react-router-dom": "^6.23.1",
"serve": "^14.2.3"
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.0.0"
},
"//": "✅ Do add `devDependencies` below that are `peerDependencies` in the CFL package.",
"devDependencies": {
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"@types/js-cookie": "^3.0.3",
"@types/qs": "^6.9.7",
"@types/node": "^20.14.2",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
4 changes: 2 additions & 2 deletions src/api/authFactor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urls, type AuthFactor } from "codeforlife/lib/esm/api"
import { urls, type AuthFactor } from "codeforlife/api"
import {
buildUrl,
tagData,
Expand All @@ -8,7 +8,7 @@ import {
type DestroyResult,
type ListArg,
type ListResult,
} from "codeforlife/lib/esm/helpers/rtkQuery"
} from "codeforlife/utils/rtkQuery"

import api from "."

Expand Down
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"
import { tagTypes } from "codeforlife/lib/esm/api"
import { tagTypes } from "codeforlife/api"

const api = createApi({
baseQuery: fetchBaseQuery({
Expand Down
4 changes: 2 additions & 2 deletions src/api/klass.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urls, type Class } from "codeforlife/lib/esm/api"
import { urls, type Class } from "codeforlife/api"
import {
buildUrl,
tagData,
Expand All @@ -12,7 +12,7 @@ import {
type RetrieveResult,
type UpdateArg,
type UpdateResult,
} from "codeforlife/lib/esm/helpers/rtkQuery"
} from "codeforlife/utils/rtkQuery"

import api from "."

Expand Down
2 changes: 1 addition & 1 deletion src/api/otpBypassToken.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urls } from "codeforlife/lib/esm/api"
import { urls } from "codeforlife/api"

import api from "."

Expand Down
4 changes: 2 additions & 2 deletions src/api/school.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urls, type School } from "codeforlife/lib/esm/api"
import { urls, type School } from "codeforlife/api"
import {
buildUrl,
tagData,
Expand All @@ -8,7 +8,7 @@ import {
type RetrieveResult,
type UpdateArg,
type UpdateResult,
} from "codeforlife/lib/esm/helpers/rtkQuery"
} from "codeforlife/utils/rtkQuery"

import api from "."

Expand Down
4 changes: 2 additions & 2 deletions src/api/schoolTeacherInvitation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type User } from "codeforlife/lib/esm/api"
import { type User } from "codeforlife/api"
import {
buildUrl,
tagData,
Expand All @@ -14,7 +14,7 @@ import {
type RetrieveResult,
type UpdateArg,
type UpdateResult,
} from "codeforlife/lib/esm/helpers/rtkQuery"
} from "codeforlife/utils/rtkQuery"

import api from "."

Expand Down
4 changes: 2 additions & 2 deletions src/api/student.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urls, type Student, type User } from "codeforlife/lib/esm/api"
import { urls, type Student, type User } from "codeforlife/api"
import {
tagData,
type Arg,
Expand All @@ -8,7 +8,7 @@ import {
type BulkDestroyResult,
type BulkUpdateArg,
type BulkUpdateResult,
} from "codeforlife/lib/esm/helpers/rtkQuery"
} from "codeforlife/utils/rtkQuery"

import api from "."

Expand Down
4 changes: 2 additions & 2 deletions src/api/teacher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urls, type Teacher, type User } from "codeforlife/lib/esm/api"
import { urls, type Teacher, type User } from "codeforlife/api"
import {
buildUrl,
tagData,
Expand All @@ -8,7 +8,7 @@ import {
type DestroyResult,
type UpdateArg,
type UpdateResult,
} from "codeforlife/lib/esm/helpers/rtkQuery"
} from "codeforlife/utils/rtkQuery"

import api from "."

Expand Down
4 changes: 2 additions & 2 deletions src/api/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { urls, type User } from "codeforlife/lib/esm/api"
import { urls, type User } from "codeforlife/api"
import {
buildUrl,
tagData,
Expand All @@ -13,7 +13,7 @@ import {
type RetrieveResult,
type UpdateArg,
type UpdateResult,
} from "codeforlife/lib/esm/helpers/rtkQuery"
} from "codeforlife/utils/rtkQuery"

import api from "."

Expand Down
10 changes: 8 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@
"noEmit": true,
"jsx": "react-jsx",
"types": [
"vitest/globals"
]
"vitest/globals",
"node"
],
"paths": {
"codeforlife/*": [
"./node_modules/codeforlife/src/*"
]
}
},
"references": [
{
Expand Down
6 changes: 6 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import react from "@vitejs/plugin-react"
import path from "path"
import { defineConfig } from "vitest/config"

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
codeforlife: path.resolve(__dirname, "./node_modules/codeforlife/src"),
},
},
server: {
open: true,
},
Expand Down
Loading

0 comments on commit 7bd3620

Please sign in to comment.