diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8fe322e1..cc355659 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,7 @@ jobs: - uses: pnpm/action-setup@v3 with: - version: 9.0.6 + version: 9.x.x - name: Setup Node.js environment uses: actions/setup-node@v4 diff --git a/package.json b/package.json index 91883163..e29c765b 100644 --- a/package.json +++ b/package.json @@ -97,21 +97,18 @@ "tsx": "^4.7.2", "typescript": "^5.4.5", "typescript-eslint": "^7.8.0", - "vite": "^5.2.11", + "vite": "^5.4.8", "vitepress": "^1.2.3", - "vitest": "^2.0.0" + "vitest": "^2.1.2" }, "type": "module", - "packageManager": "pnpm@9.4.0", + "packageManager": "pnpm@9.12.0", "volta": { - "node": "20.15.1", - "pnpm": "9.4.0" + "node": "20.18.0", + "pnpm": "9.12.0" }, "engines": { "node": ">=20.0.0", "pnpm": ">=9.0.0" - }, - "workspaces": [ - "services" - ] + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63ff3fa6..9a65d099 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -187,14 +187,14 @@ importers: specifier: ^7.8.0 version: 7.15.0(eslint@9.6.0)(typescript@5.6.2) vite: - specifier: ^5.2.11 + specifier: ^5.4.8 version: 5.4.8(@types/node@20.16.10) vitepress: specifier: ^1.2.3 version: 1.3.4(@algolia/client-search@4.24.0)(@types/node@20.16.10)(postcss@8.4.47)(search-insights@2.14.0)(typescript@5.6.2) vitest: - specifier: ^2.0.0 - version: 2.1.1(@types/node@20.16.10)(jsdom@24.1.3) + specifier: ^2.1.2 + version: 2.1.2(@types/node@20.16.10)(jsdom@24.1.3) services: dependencies: @@ -221,11 +221,20 @@ importers: version: 3.23.8 devDependencies: vite: - specifier: ^5.2.11 + specifier: ^5.4.8 version: 5.4.8(@types/node@20.16.10) vitest: - specifier: ^2.0.0 - version: 2.1.1(@types/node@20.16.10)(jsdom@24.1.3) + specifier: ^2.1.2 + version: 2.1.2(@types/node@20.16.10)(jsdom@24.1.3) + + shared: + devDependencies: + vite: + specifier: ^5.4.8 + version: 5.4.8(@types/node@20.16.10) + vitest: + specifier: ^2.1.2 + version: 2.1.2(@types/node@20.16.10)(jsdom@24.1.3) packages: @@ -1230,13 +1239,13 @@ packages: vite: ^5.0.0 vue: ^3.2.25 - '@vitest/expect@2.1.1': - resolution: {integrity: sha512-YeueunS0HiHiQxk+KEOnq/QMzlUuOzbU1Go+PgAsHvvv3tUkJPm9xWt+6ITNTlzsMXUjmgm5T+U7KBPK2qQV6w==} + '@vitest/expect@2.1.2': + resolution: {integrity: sha512-FEgtlN8mIUSEAAnlvn7mP8vzaWhEaAEvhSXCqrsijM7K6QqjB11qoRZYEd4AKSCDz8p0/+yH5LzhZ47qt+EyPg==} - '@vitest/mocker@2.1.1': - resolution: {integrity: sha512-LNN5VwOEdJqCmJ/2XJBywB11DLlkbY0ooDJW3uRX5cZyYCrc4PI/ePX0iQhE3BiEGiQmK4GE7Q/PqCkkaiPnrA==} + '@vitest/mocker@2.1.2': + resolution: {integrity: sha512-ExElkCGMS13JAJy+812fw1aCv2QO/LBK6CyO4WOPAzLTmve50gydOlWhgdBJPx2ztbADUq3JVI0C5U+bShaeEA==} peerDependencies: - '@vitest/spy': 2.1.1 + '@vitest/spy': 2.1.2 msw: ^2.3.5 vite: ^5.0.0 peerDependenciesMeta: @@ -1245,20 +1254,20 @@ packages: vite: optional: true - '@vitest/pretty-format@2.1.1': - resolution: {integrity: sha512-SjxPFOtuINDUW8/UkElJYQSFtnWX7tMksSGW0vfjxMneFqxVr8YJ979QpMbDW7g+BIiq88RAGDjf7en6rvLPPQ==} + '@vitest/pretty-format@2.1.2': + resolution: {integrity: sha512-FIoglbHrSUlOJPDGIrh2bjX1sNars5HbxlcsFKCtKzu4+5lpsRhOCVcuzp0fEhAGHkPZRIXVNzPcpSlkoZ3LuA==} - '@vitest/runner@2.1.1': - resolution: {integrity: sha512-uTPuY6PWOYitIkLPidaY5L3t0JJITdGTSwBtwMjKzo5O6RCOEncz9PUN+0pDidX8kTHYjO0EwUIvhlGpnGpxmA==} + '@vitest/runner@2.1.2': + resolution: {integrity: sha512-UCsPtvluHO3u7jdoONGjOSil+uON5SSvU9buQh3lP7GgUXHp78guN1wRmZDX4wGK6J10f9NUtP6pO+SFquoMlw==} - '@vitest/snapshot@2.1.1': - resolution: {integrity: sha512-BnSku1WFy7r4mm96ha2FzN99AZJgpZOWrAhtQfoxjUU5YMRpq1zmHRq7a5K9/NjqonebO7iVDla+VvZS8BOWMw==} + '@vitest/snapshot@2.1.2': + resolution: {integrity: sha512-xtAeNsZ++aRIYIUsek7VHzry/9AcxeULlegBvsdLncLmNCR6tR8SRjn8BbDP4naxtccvzTqZ+L1ltZlRCfBZFA==} - '@vitest/spy@2.1.1': - resolution: {integrity: sha512-ZM39BnZ9t/xZ/nF4UwRH5il0Sw93QnZXd9NAZGRpIgj0yvVwPpLd702s/Cx955rGaMlyBQkZJ2Ir7qyY48VZ+g==} + '@vitest/spy@2.1.2': + resolution: {integrity: sha512-GSUi5zoy+abNRJwmFhBDC0yRuVUn8WMlQscvnbbXdKLXX9dE59YbfwXxuJ/mth6eeqIzofU8BB5XDo/Ns/qK2A==} - '@vitest/utils@2.1.1': - resolution: {integrity: sha512-Y6Q9TsI+qJ2CC0ZKj6VBb+T8UPz593N113nnUykqwANqhgf3QkZeHFlusgKLTqrnVHbj/XDKZcDHol+dxVT+rQ==} + '@vitest/utils@2.1.2': + resolution: {integrity: sha512-zMO2KdYy6mx56btx9JvAqAZ6EyS3g49krMPPrgOp1yxGZiA93HumGk+bZ5jIZtOg5/VBYl5eBmGRQHqq4FG6uQ==} '@vue/compiler-core@3.4.38': resolution: {integrity: sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==} @@ -3826,8 +3835,8 @@ packages: resolution: {integrity: sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==} engines: {node: '>= 0.10'} - vite-node@2.1.1: - resolution: {integrity: sha512-N/mGckI1suG/5wQI35XeR9rsMsPqKXzq1CdUndzVstBj/HvyxxGctwnK6WX43NGt5L3Z5tcRf83g4TITKJhPrA==} + vite-node@2.1.2: + resolution: {integrity: sha512-HPcGNN5g/7I2OtPjLqgOtCRu/qhVvBxTUD3qzitmL0SrG1cWFzxzhMDWussxSbrRYWqnKf8P2jiNhPMSN+ymsQ==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -3882,15 +3891,15 @@ packages: postcss: optional: true - vitest@2.1.1: - resolution: {integrity: sha512-97We7/VC0e9X5zBVkvt7SGQMGrRtn3KtySFQG5fpaMlS+l62eeXRQO633AYhSTC3z7IMebnPPNjGXVGNRFlxBA==} + vitest@2.1.2: + resolution: {integrity: sha512-veNjLizOMkRrJ6xxb+pvxN6/QAWg95mzcRjtmkepXdN87FNfxAss9RKe2far/G9cQpipfgP2taqg0KiWsquj8A==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 2.1.1 - '@vitest/ui': 2.1.1 + '@vitest/browser': 2.1.2 + '@vitest/ui': 2.1.2 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -4919,43 +4928,43 @@ snapshots: vite: 5.4.8(@types/node@20.16.10) vue: 3.4.38(typescript@5.6.2) - '@vitest/expect@2.1.1': + '@vitest/expect@2.1.2': dependencies: - '@vitest/spy': 2.1.1 - '@vitest/utils': 2.1.1 + '@vitest/spy': 2.1.2 + '@vitest/utils': 2.1.2 chai: 5.1.1 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.1(@vitest/spy@2.1.1)(vite@5.4.8(@types/node@20.16.10))': + '@vitest/mocker@2.1.2(@vitest/spy@2.1.2)(vite@5.4.8(@types/node@20.16.10))': dependencies: - '@vitest/spy': 2.1.1 + '@vitest/spy': 2.1.2 estree-walker: 3.0.3 magic-string: 0.30.11 optionalDependencies: vite: 5.4.8(@types/node@20.16.10) - '@vitest/pretty-format@2.1.1': + '@vitest/pretty-format@2.1.2': dependencies: tinyrainbow: 1.2.0 - '@vitest/runner@2.1.1': + '@vitest/runner@2.1.2': dependencies: - '@vitest/utils': 2.1.1 + '@vitest/utils': 2.1.2 pathe: 1.1.2 - '@vitest/snapshot@2.1.1': + '@vitest/snapshot@2.1.2': dependencies: - '@vitest/pretty-format': 2.1.1 + '@vitest/pretty-format': 2.1.2 magic-string: 0.30.11 pathe: 1.1.2 - '@vitest/spy@2.1.1': + '@vitest/spy@2.1.2': dependencies: tinyspy: 3.0.2 - '@vitest/utils@2.1.1': + '@vitest/utils@2.1.2': dependencies: - '@vitest/pretty-format': 2.1.1 + '@vitest/pretty-format': 2.1.2 loupe: 3.1.1 tinyrainbow: 1.2.0 @@ -7647,7 +7656,7 @@ snapshots: validator@13.12.0: optional: true - vite-node@2.1.1(@types/node@20.16.10): + vite-node@2.1.2(@types/node@20.16.10): dependencies: cac: 6.7.14 debug: 4.3.7 @@ -7725,15 +7734,15 @@ snapshots: - typescript - universal-cookie - vitest@2.1.1(@types/node@20.16.10)(jsdom@24.1.3): + vitest@2.1.2(@types/node@20.16.10)(jsdom@24.1.3): dependencies: - '@vitest/expect': 2.1.1 - '@vitest/mocker': 2.1.1(@vitest/spy@2.1.1)(vite@5.4.8(@types/node@20.16.10)) - '@vitest/pretty-format': 2.1.1 - '@vitest/runner': 2.1.1 - '@vitest/snapshot': 2.1.1 - '@vitest/spy': 2.1.1 - '@vitest/utils': 2.1.1 + '@vitest/expect': 2.1.2 + '@vitest/mocker': 2.1.2(@vitest/spy@2.1.2)(vite@5.4.8(@types/node@20.16.10)) + '@vitest/pretty-format': 2.1.2 + '@vitest/runner': 2.1.2 + '@vitest/snapshot': 2.1.2 + '@vitest/spy': 2.1.2 + '@vitest/utils': 2.1.2 chai: 5.1.1 debug: 4.3.7 magic-string: 0.30.11 @@ -7744,7 +7753,7 @@ snapshots: tinypool: 1.0.1 tinyrainbow: 1.2.0 vite: 5.4.8(@types/node@20.16.10) - vite-node: 2.1.1(@types/node@20.16.10) + vite-node: 2.1.2(@types/node@20.16.10) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 20.16.10 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index c778da07..02bf9f59 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,2 +1,3 @@ packages: - "services" + - "shared" diff --git a/services/package.json b/services/package.json index 28000a92..1a5e1d20 100644 --- a/services/package.json +++ b/services/package.json @@ -10,8 +10,8 @@ "zod": "^3.23.5" }, "devDependencies": { - "vite": "^5.2.11", - "vitest": "^2.0.0" + "vite": "^5.4.8", + "vitest": "^2.1.2" }, "type": "module" } diff --git a/services/src/project/project-service.ts b/services/src/project/project-service.ts index 3f7b6449..e020fc77 100644 --- a/services/src/project/project-service.ts +++ b/services/src/project/project-service.ts @@ -1,5 +1,5 @@ import type { CreateProjectFormSchema } from '$components/container/projects/create-project-schema' -import { createSlug } from '../util/slug/slug-service' +import { createSlug } from 'shared/utils/slug/slug-service' import { CreateProjectNameNotUniqueError } from '../error' import * as repository from './project-repository' import { SqliteError } from 'better-sqlite3' diff --git a/services/src/project/project-service.unit.test.ts b/services/src/project/project-service.unit.test.ts index 4db65798..230e624f 100644 --- a/services/src/project/project-service.unit.test.ts +++ b/services/src/project/project-service.unit.test.ts @@ -4,14 +4,14 @@ import * as repository from './project-repository' import { CreateProjectNameNotUniqueError } from '../error' import { SqliteError } from 'better-sqlite3' import type { CreateProjectFormSchema } from '$components/container/projects/create-project-schema' -import { createSlug } from '../util/slug/slug-service' +import { createSlug } from 'shared/utils/slug/slug-service' vi.mock('./project-repository', () => ({ createProject: vi.fn(), getAllProjects: vi.fn() })) -vi.mock('../util/slug/slug-service', () => ({ +vi.mock('shared/utils/slug/slug-service', () => ({ createSlug: vi.fn() })) diff --git a/shared/package.json b/shared/package.json new file mode 100644 index 00000000..695ec8b4 --- /dev/null +++ b/shared/package.json @@ -0,0 +1,9 @@ +{ + "name": "shared", + "dependencies": {}, + "devDependencies": { + "vite": "^5.4.8", + "vitest": "^2.1.2" + }, + "type": "module" +} diff --git a/services/src/util/slug/slug-service.ts b/shared/utils/slug/slug-service.ts similarity index 100% rename from services/src/util/slug/slug-service.ts rename to shared/utils/slug/slug-service.ts diff --git a/services/src/util/slug/slug-service.unit.test.ts b/shared/utils/slug/slug-service.unit.test.ts similarity index 100% rename from services/src/util/slug/slug-service.unit.test.ts rename to shared/utils/slug/slug-service.unit.test.ts diff --git a/src/components/container/projects/create-project-schema.ts b/src/components/container/projects/create-project-schema.ts index 80a61f87..719873fa 100644 --- a/src/components/container/projects/create-project-schema.ts +++ b/src/components/container/projects/create-project-schema.ts @@ -1,4 +1,4 @@ -import { createSlug } from 'services/util/slug/slug-service' +import { createSlug } from 'shared/utils/slug/slug-service' import { z } from 'zod' import { type LanguageCode, availableLanguages } from '../language/languages' diff --git a/src/components/container/projects/slug-display.svelte b/src/components/container/projects/slug-display.svelte index 20e3fd91..9b4d0222 100644 --- a/src/components/container/projects/slug-display.svelte +++ b/src/components/container/projects/slug-display.svelte @@ -1,5 +1,5 @@ diff --git a/svelte.config.js b/svelte.config.js index 1205b935..26e2b6fe 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -16,7 +16,8 @@ const config = { $components: 'src/components', $models: 'src/models', $utils: 'src/utils', - services: 'services/src' + services: 'services/src', + shared: 'shared' } } } diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 1b128e96..61185dd6 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -13,6 +13,7 @@ "src/**/*.svelte", "tests/**/*.ts", "services/**/*.ts", + "shared/**/*.ts", "./*.ts", "./*.js", "services", diff --git a/vite.config.ts b/vite.config.ts index 6f0fd1f3..ed7299d9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,9 +3,6 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ plugins: [sveltekit()], - test: { - include: ['src/**/*.{test,spec}.{js,ts}', 'services/**/*.{test,spec}.{js,ts}'] - }, - server: { port: 3000, fs: { allow: ['services/src/util/slug'] } }, // Add shared workspace and move slug to shared + server: { port: 3000, fs: { allow: ['shared'] } }, preview: { port: 3000 } }) diff --git a/vitest.workspace.js b/vitest.workspace.js index 8b09986e..332b956d 100644 --- a/vitest.workspace.js +++ b/vitest.workspace.js @@ -3,6 +3,7 @@ import { defineWorkspace } from 'vitest/config' // defineWorkspace provides a nice type hinting DX export default defineWorkspace([ { + extends: './vite.config.ts', test: { include: ['src/**/*.unit.test.ts', 'services/**/*.unit.test.ts'], name: 'unit' @@ -11,7 +12,11 @@ export default defineWorkspace([ { extends: './vite.config.ts', test: { - include: ['src/**/*.integration.test.ts', 'services/**/*.integration.test.ts'], + include: [ + 'src/**/*.integration.test.ts', + 'services/**/*.integration.test.ts', + 'shared/**/*.integration.test.ts' + ], name: 'integration' } }