@idevconn/create-icore 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +56 -0
- package/dist/cli.js +300 -0
- package/dist/index.cjs +303 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +265 -0
- package/package.json +72 -0
- package/templates/.husky/pre-commit +56 -0
- package/templates/.nvmrc +1 -0
- package/templates/.prettierignore +7 -0
- package/templates/.prettierrc +7 -0
- package/templates/.yarnrc.yml +7 -0
- package/templates/apps/api/.env.example +19 -0
- package/templates/apps/api/eslint.config.mjs +23 -0
- package/templates/apps/api/package.json +20 -0
- package/templates/apps/api/project.json +76 -0
- package/templates/apps/api/src/app/abilities/__tests__/ability.guard.unit.test.ts +49 -0
- package/templates/apps/api/src/app/abilities/abilities.module.ts +10 -0
- package/templates/apps/api/src/app/abilities/ability.factory.ts +13 -0
- package/templates/apps/api/src/app/abilities/ability.guard.ts +29 -0
- package/templates/apps/api/src/app/abilities/check-ability.decorator.ts +12 -0
- package/templates/apps/api/src/app/app.module.ts +19 -0
- package/templates/apps/api/src/app/auth/__tests__/auth.guard.unit.test.ts +66 -0
- package/templates/apps/api/src/app/auth/auth.controller.ts +62 -0
- package/templates/apps/api/src/app/auth/auth.guard.ts +42 -0
- package/templates/apps/api/src/app/auth/auth.module.ts +17 -0
- package/templates/apps/api/src/app/auth/public.decorator.ts +4 -0
- package/templates/apps/api/src/app/profile/profile.controller.ts +15 -0
- package/templates/apps/api/src/app/profile/profile.module.ts +5 -0
- package/templates/apps/api/src/app/storage/__tests__/assert-ownership.unit.test.ts +28 -0
- package/templates/apps/api/src/app/storage/assert-ownership.ts +8 -0
- package/templates/apps/api/src/app/storage/storage.controller.ts +108 -0
- package/templates/apps/api/src/app/storage/storage.module.ts +10 -0
- package/templates/apps/api/src/assets/.gitkeep +0 -0
- package/templates/apps/api/src/main.ts +43 -0
- package/templates/apps/api/tsconfig.app.json +13 -0
- package/templates/apps/api/tsconfig.json +16 -0
- package/templates/apps/api/tsconfig.spec.json +16 -0
- package/templates/apps/api/vitest.config.mts +21 -0
- package/templates/apps/api/webpack.config.js +25 -0
- package/templates/apps/microservices/auth/.env.example +38 -0
- package/templates/apps/microservices/auth/package.json +19 -0
- package/templates/apps/microservices/auth/project.json +65 -0
- package/templates/apps/microservices/auth/src/app/__tests__/auth.controller.firebase.integration.unit.test.ts +53 -0
- package/templates/apps/microservices/auth/src/app/__tests__/auth.controller.supabase.integration.unit.test.ts +47 -0
- package/templates/apps/microservices/auth/src/app/__tests__/auth.controller.unit.test.ts +87 -0
- package/templates/apps/microservices/auth/src/app/app.module.ts +66 -0
- package/templates/apps/microservices/auth/src/app/auth.controller.ts +60 -0
- package/templates/apps/microservices/auth/src/assets/.gitkeep +0 -0
- package/templates/apps/microservices/auth/src/main.ts +28 -0
- package/templates/apps/microservices/auth/tsconfig.app.json +13 -0
- package/templates/apps/microservices/auth/tsconfig.json +16 -0
- package/templates/apps/microservices/auth/tsconfig.spec.json +16 -0
- package/templates/apps/microservices/auth/vitest.config.mts +21 -0
- package/templates/apps/microservices/auth/webpack.config.js +25 -0
- package/templates/apps/microservices/upload/.env.example +30 -0
- package/templates/apps/microservices/upload/package.json +21 -0
- package/templates/apps/microservices/upload/project.json +65 -0
- package/templates/apps/microservices/upload/src/app/__tests__/storage.controller.unit.test.ts +49 -0
- package/templates/apps/microservices/upload/src/app/app.module.ts +117 -0
- package/templates/apps/microservices/upload/src/app/storage.controller.ts +51 -0
- package/templates/apps/microservices/upload/src/assets/.gitkeep +0 -0
- package/templates/apps/microservices/upload/src/main.ts +28 -0
- package/templates/apps/microservices/upload/tsconfig.app.json +13 -0
- package/templates/apps/microservices/upload/tsconfig.json +16 -0
- package/templates/apps/microservices/upload/tsconfig.spec.json +16 -0
- package/templates/apps/microservices/upload/vitest.config.mts +22 -0
- package/templates/apps/microservices/upload/webpack.config.js +25 -0
- package/templates/apps/templates/client-shadcn/.env.example +2 -0
- package/templates/apps/templates/client-shadcn/eslint.config.mjs +10 -0
- package/templates/apps/templates/client-shadcn/index.html +17 -0
- package/templates/apps/templates/client-shadcn/project.json +9 -0
- package/templates/apps/templates/client-shadcn/public/favicon.ico +0 -0
- package/templates/apps/templates/client-shadcn/src/app/app.module.css +1 -0
- package/templates/apps/templates/client-shadcn/src/app/app.spec.tsx +9 -0
- package/templates/apps/templates/client-shadcn/src/app/app.tsx +7 -0
- package/templates/apps/templates/client-shadcn/src/assets/.gitkeep +0 -0
- package/templates/apps/templates/client-shadcn/src/components/AccessDeniedPage.tsx +15 -0
- package/templates/apps/templates/client-shadcn/src/components/PageLayout.tsx +55 -0
- package/templates/apps/templates/client-shadcn/src/components/layout/LayoutFooter.tsx +8 -0
- package/templates/apps/templates/client-shadcn/src/components/layout/LayoutHeader.tsx +57 -0
- package/templates/apps/templates/client-shadcn/src/components/layout/LayoutSider.tsx +44 -0
- package/templates/apps/templates/client-shadcn/src/components/ui/button.tsx +50 -0
- package/templates/apps/templates/client-shadcn/src/components/ui/card.tsx +63 -0
- package/templates/apps/templates/client-shadcn/src/components/ui/input.tsx +23 -0
- package/templates/apps/templates/client-shadcn/src/components/ui/label.tsx +18 -0
- package/templates/apps/templates/client-shadcn/src/globals.css +27 -0
- package/templates/apps/templates/client-shadcn/src/layouts/MainLayout.tsx +17 -0
- package/templates/apps/templates/client-shadcn/src/lib/notify.ts +15 -0
- package/templates/apps/templates/client-shadcn/src/lib/utils.ts +6 -0
- package/templates/apps/templates/client-shadcn/src/main.tsx +50 -0
- package/templates/apps/templates/client-shadcn/src/routeTree.gen.ts +136 -0
- package/templates/apps/templates/client-shadcn/src/routes/__root.tsx +5 -0
- package/templates/apps/templates/client-shadcn/src/routes/_dashboard/dashboard.tsx +33 -0
- package/templates/apps/templates/client-shadcn/src/routes/_dashboard/profile.tsx +88 -0
- package/templates/apps/templates/client-shadcn/src/routes/_dashboard.tsx +16 -0
- package/templates/apps/templates/client-shadcn/src/routes/index.tsx +33 -0
- package/templates/apps/templates/client-shadcn/src/routes/login.tsx +93 -0
- package/templates/apps/templates/client-shadcn/src/styles.css +1 -0
- package/templates/apps/templates/client-shadcn/tsconfig.app.json +27 -0
- package/templates/apps/templates/client-shadcn/tsconfig.json +21 -0
- package/templates/apps/templates/client-shadcn/tsconfig.spec.json +30 -0
- package/templates/apps/templates/client-shadcn/vite.config.mts +92 -0
- package/templates/apps/templates/client-shadcn-e2e/eslint.config.mjs +12 -0
- package/templates/apps/templates/client-shadcn-e2e/playwright.config.ts +69 -0
- package/templates/apps/templates/client-shadcn-e2e/project.json +10 -0
- package/templates/apps/templates/client-shadcn-e2e/src/icore.spec.ts +27 -0
- package/templates/apps/templates/client-shadcn-e2e/tsconfig.json +19 -0
- package/templates/eslint.config.mjs +20 -0
- package/templates/libs/auth-client/README.md +11 -0
- package/templates/libs/auth-client/eslint.config.mjs +22 -0
- package/templates/libs/auth-client/package.json +15 -0
- package/templates/libs/auth-client/project.json +19 -0
- package/templates/libs/auth-client/src/index.ts +2 -0
- package/templates/libs/auth-client/src/lib/auth-client.module.ts +25 -0
- package/templates/libs/auth-client/src/lib/auth-client.service.ts +30 -0
- package/templates/libs/auth-client/tsconfig.json +24 -0
- package/templates/libs/auth-client/tsconfig.lib.json +26 -0
- package/templates/libs/auth-client/tsconfig.spec.json +22 -0
- package/templates/libs/auth-client/vitest.config.mts +22 -0
- package/templates/libs/auth-strategies/firebase/README.md +11 -0
- package/templates/libs/auth-strategies/firebase/eslint.config.mjs +22 -0
- package/templates/libs/auth-strategies/firebase/package.json +15 -0
- package/templates/libs/auth-strategies/firebase/project.json +19 -0
- package/templates/libs/auth-strategies/firebase/src/index.ts +4 -0
- package/templates/libs/auth-strategies/firebase/src/lib/__tests__/firebase-auth.contract.unit.test.ts +13 -0
- package/templates/libs/auth-strategies/firebase/src/lib/firebase-auth.strategy.ts +77 -0
- package/templates/libs/auth-strategies/firebase/src/lib/identity-toolkit.client.ts +72 -0
- package/templates/libs/auth-strategies/firebase/src/lib/testing/mock-admin-auth.ts +41 -0
- package/templates/libs/auth-strategies/firebase/src/lib/testing/mock-identity-toolkit.ts +76 -0
- package/templates/libs/auth-strategies/firebase/tsconfig.json +24 -0
- package/templates/libs/auth-strategies/firebase/tsconfig.lib.json +23 -0
- package/templates/libs/auth-strategies/firebase/tsconfig.spec.json +22 -0
- package/templates/libs/auth-strategies/firebase/vitest.config.mts +22 -0
- package/templates/libs/auth-strategies/supabase/README.md +11 -0
- package/templates/libs/auth-strategies/supabase/eslint.config.mjs +22 -0
- package/templates/libs/auth-strategies/supabase/package.json +16 -0
- package/templates/libs/auth-strategies/supabase/project.json +19 -0
- package/templates/libs/auth-strategies/supabase/src/index.ts +2 -0
- package/templates/libs/auth-strategies/supabase/src/lib/__tests__/supabase-auth.contract.unit.test.ts +8 -0
- package/templates/libs/auth-strategies/supabase/src/lib/supabase-auth.strategy.ts +79 -0
- package/templates/libs/auth-strategies/supabase/src/lib/testing/mock-supabase.ts +107 -0
- package/templates/libs/auth-strategies/supabase/tsconfig.json +24 -0
- package/templates/libs/auth-strategies/supabase/tsconfig.lib.json +23 -0
- package/templates/libs/auth-strategies/supabase/tsconfig.spec.json +22 -0
- package/templates/libs/auth-strategies/supabase/vitest.config.mts +22 -0
- package/templates/libs/shared/README.md +11 -0
- package/templates/libs/shared/eslint.config.mjs +24 -0
- package/templates/libs/shared/package.json +14 -0
- package/templates/libs/shared/project.json +19 -0
- package/templates/libs/shared/src/__tests__/transport.unit.test.ts +58 -0
- package/templates/libs/shared/src/abilities/__tests__/ability.unit.test.ts +28 -0
- package/templates/libs/shared/src/abilities/ability.ts +21 -0
- package/templates/libs/shared/src/abilities/index.ts +2 -0
- package/templates/libs/shared/src/abilities/subjects.ts +2 -0
- package/templates/libs/shared/src/index.ts +3 -0
- package/templates/libs/shared/src/strategies/__tests__/fake-auth.contract.unit.test.ts +4 -0
- package/templates/libs/shared/src/strategies/__tests__/fake-storage.contract.unit.test.ts +4 -0
- package/templates/libs/shared/src/strategies/auth.ts +21 -0
- package/templates/libs/shared/src/strategies/contract/auth-contract.ts +66 -0
- package/templates/libs/shared/src/strategies/contract/storage-contract.ts +58 -0
- package/templates/libs/shared/src/strategies/fakes/fake-auth.ts +73 -0
- package/templates/libs/shared/src/strategies/fakes/fake-storage.ts +51 -0
- package/templates/libs/shared/src/strategies/fakes/index.ts +2 -0
- package/templates/libs/shared/src/strategies/index.ts +5 -0
- package/templates/libs/shared/src/strategies/storage.ts +17 -0
- package/templates/libs/shared/src/transport.ts +55 -0
- package/templates/libs/shared/tsconfig.json +24 -0
- package/templates/libs/shared/tsconfig.lib.json +23 -0
- package/templates/libs/shared/tsconfig.spec.json +22 -0
- package/templates/libs/shared/vitest.config.mts +21 -0
- package/templates/libs/storage-strategies/cloudinary/README.md +11 -0
- package/templates/libs/storage-strategies/cloudinary/eslint.config.mjs +23 -0
- package/templates/libs/storage-strategies/cloudinary/package.json +15 -0
- package/templates/libs/storage-strategies/cloudinary/project.json +19 -0
- package/templates/libs/storage-strategies/cloudinary/src/index.ts +2 -0
- package/templates/libs/storage-strategies/cloudinary/src/lib/__tests__/cloudinary-storage.contract.unit.test.ts +8 -0
- package/templates/libs/storage-strategies/cloudinary/src/lib/cloudinary-storage.strategy.ts +75 -0
- package/templates/libs/storage-strategies/cloudinary/src/lib/testing/mock-cloudinary.ts +36 -0
- package/templates/libs/storage-strategies/cloudinary/tsconfig.json +24 -0
- package/templates/libs/storage-strategies/cloudinary/tsconfig.lib.json +23 -0
- package/templates/libs/storage-strategies/cloudinary/tsconfig.spec.json +22 -0
- package/templates/libs/storage-strategies/cloudinary/vitest.config.mts +22 -0
- package/templates/libs/storage-strategies/firebase/README.md +11 -0
- package/templates/libs/storage-strategies/firebase/eslint.config.mjs +23 -0
- package/templates/libs/storage-strategies/firebase/package.json +15 -0
- package/templates/libs/storage-strategies/firebase/project.json +19 -0
- package/templates/libs/storage-strategies/firebase/src/index.ts +2 -0
- package/templates/libs/storage-strategies/firebase/src/lib/__tests__/firebase-storage.contract.unit.test.ts +8 -0
- package/templates/libs/storage-strategies/firebase/src/lib/firebase-storage.strategy.ts +63 -0
- package/templates/libs/storage-strategies/firebase/src/lib/testing/mock-firebase-storage.ts +43 -0
- package/templates/libs/storage-strategies/firebase/tsconfig.json +24 -0
- package/templates/libs/storage-strategies/firebase/tsconfig.lib.json +23 -0
- package/templates/libs/storage-strategies/firebase/tsconfig.spec.json +22 -0
- package/templates/libs/storage-strategies/firebase/vitest.config.mts +22 -0
- package/templates/libs/storage-strategies/supabase/README.md +11 -0
- package/templates/libs/storage-strategies/supabase/eslint.config.mjs +22 -0
- package/templates/libs/storage-strategies/supabase/package.json +16 -0
- package/templates/libs/storage-strategies/supabase/project.json +19 -0
- package/templates/libs/storage-strategies/supabase/src/index.ts +2 -0
- package/templates/libs/storage-strategies/supabase/src/lib/__tests__/supabase-storage.contract.unit.test.ts +8 -0
- package/templates/libs/storage-strategies/supabase/src/lib/supabase-storage.strategy.ts +53 -0
- package/templates/libs/storage-strategies/supabase/src/lib/testing/mock-supabase-storage.ts +78 -0
- package/templates/libs/storage-strategies/supabase/tsconfig.json +24 -0
- package/templates/libs/storage-strategies/supabase/tsconfig.lib.json +23 -0
- package/templates/libs/storage-strategies/supabase/tsconfig.spec.json +22 -0
- package/templates/libs/storage-strategies/supabase/vitest.config.mts +22 -0
- package/templates/libs/template-shared/README.md +11 -0
- package/templates/libs/template-shared/eslint.config.mjs +23 -0
- package/templates/libs/template-shared/package.json +22 -0
- package/templates/libs/template-shared/project.json +19 -0
- package/templates/libs/template-shared/src/index.ts +9 -0
- package/templates/libs/template-shared/src/lib/abilities/ability-provider.tsx +19 -0
- package/templates/libs/template-shared/src/lib/api/create-api.ts +20 -0
- package/templates/libs/template-shared/src/lib/draft/index.ts +1 -0
- package/templates/libs/template-shared/src/lib/i18n/create-i18n.ts +42 -0
- package/templates/libs/template-shared/src/lib/i18n/keys.ts +30 -0
- package/templates/libs/template-shared/src/lib/landing/LandingPage.tsx +68 -0
- package/templates/libs/template-shared/src/lib/notify/use-notify.ts +26 -0
- package/templates/libs/template-shared/src/lib/stores/auth.store.ts +29 -0
- package/templates/libs/template-shared/src/lib/stores/loading.store.ts +13 -0
- package/templates/libs/template-shared/tsconfig.json +24 -0
- package/templates/libs/template-shared/tsconfig.lib.json +25 -0
- package/templates/libs/template-shared/tsconfig.spec.json +22 -0
- package/templates/libs/template-shared/vitest.config.mts +22 -0
- package/templates/libs/upload-client/README.md +11 -0
- package/templates/libs/upload-client/eslint.config.mjs +22 -0
- package/templates/libs/upload-client/package.json +15 -0
- package/templates/libs/upload-client/project.json +19 -0
- package/templates/libs/upload-client/src/index.ts +2 -0
- package/templates/libs/upload-client/src/lib/upload-client.module.ts +25 -0
- package/templates/libs/upload-client/src/lib/upload-client.service.ts +38 -0
- package/templates/libs/upload-client/tsconfig.json +24 -0
- package/templates/libs/upload-client/tsconfig.lib.json +26 -0
- package/templates/libs/upload-client/tsconfig.spec.json +22 -0
- package/templates/libs/upload-client/vitest.config.mts +22 -0
- package/templates/nx.json +113 -0
- package/templates/package.json +24 -0
- package/templates/tools/create-icore/_template-shell/package.json +24 -0
- package/templates/tsconfig.base.json +29 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-shared",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "libs/template-shared/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/js:tsc",
|
|
10
|
+
"outputs": ["{options.outputPath}"],
|
|
11
|
+
"options": {
|
|
12
|
+
"outputPath": "dist/libs/template-shared",
|
|
13
|
+
"main": "libs/template-shared/src/index.ts",
|
|
14
|
+
"tsConfig": "libs/template-shared/tsconfig.lib.json",
|
|
15
|
+
"assets": ["libs/template-shared/*.md"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './lib/api/create-api.js';
|
|
2
|
+
export * from './lib/stores/auth.store.js';
|
|
3
|
+
export * from './lib/stores/loading.store.js';
|
|
4
|
+
export * from './lib/abilities/ability-provider.js';
|
|
5
|
+
export * from './lib/i18n/create-i18n.js';
|
|
6
|
+
export * from './lib/i18n/keys.js';
|
|
7
|
+
export * from './lib/notify/use-notify.js';
|
|
8
|
+
export * from './lib/draft/index.js';
|
|
9
|
+
export * from './lib/landing/LandingPage.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AbilityProvider as CaslAbilityProvider, Can } from '@casl/react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { defineAbilitiesFor, type AppAbility } from '@icore/shared';
|
|
5
|
+
import { useAuthStore } from '../stores/auth.store.js';
|
|
6
|
+
|
|
7
|
+
export { Can };
|
|
8
|
+
|
|
9
|
+
export function AbilityProvider({ children }: { children: ReactNode }) {
|
|
10
|
+
const user = useAuthStore((s) => s.user);
|
|
11
|
+
const ability = useMemo<AppAbility>(
|
|
12
|
+
() =>
|
|
13
|
+
user
|
|
14
|
+
? defineAbilitiesFor({ id: user.id, role: user.role === 'admin' ? 'admin' : 'user' })
|
|
15
|
+
: defineAbilitiesFor(null),
|
|
16
|
+
[user],
|
|
17
|
+
);
|
|
18
|
+
return <CaslAbilityProvider value={ability}>{children}</CaslAbilityProvider>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createApiClient } from '@idevconn/api-client';
|
|
2
|
+
import { useAuthStore } from '../stores/auth.store.js';
|
|
3
|
+
|
|
4
|
+
export function createIcoreApi(opts: { baseUrl: string; onUnauthorized?: () => void }) {
|
|
5
|
+
return createApiClient({
|
|
6
|
+
baseUrl: opts.baseUrl,
|
|
7
|
+
getAccessToken: () => useAuthStore.getState().accessToken,
|
|
8
|
+
getRefreshToken: () => useAuthStore.getState().refreshToken,
|
|
9
|
+
onTokenRefreshed: ({ accessToken, refreshToken }) => {
|
|
10
|
+
const user = useAuthStore.getState().user;
|
|
11
|
+
if (user) useAuthStore.getState().setAuth({ accessToken, refreshToken, user });
|
|
12
|
+
},
|
|
13
|
+
onUnauthorized: () => {
|
|
14
|
+
useAuthStore.getState().logout();
|
|
15
|
+
opts.onUnauthorized?.();
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { ApiError } from '@idevconn/api-client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDraft, useDraftStore } from '@idevconn/use-draft';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import i18next, { type Resource } from 'i18next';
|
|
2
|
+
import { initReactI18next } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
const STORAGE_KEY = 'icore-lang';
|
|
5
|
+
|
|
6
|
+
export type IcoreLocale = 'en' | 'ru' | 'he';
|
|
7
|
+
const RTL_LOCALES: ReadonlySet<IcoreLocale> = new Set(['he']);
|
|
8
|
+
|
|
9
|
+
export function getStoredLocale(fallback: IcoreLocale = 'en'): IcoreLocale {
|
|
10
|
+
if (typeof window === 'undefined') return fallback;
|
|
11
|
+
const v = window.localStorage.getItem(STORAGE_KEY);
|
|
12
|
+
return v === 'en' || v === 'ru' || v === 'he' ? v : fallback;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function setStoredLocale(loc: IcoreLocale): void {
|
|
16
|
+
if (typeof window === 'undefined') return;
|
|
17
|
+
window.localStorage.setItem(STORAGE_KEY, loc);
|
|
18
|
+
document.documentElement.dir = RTL_LOCALES.has(loc) ? 'rtl' : 'ltr';
|
|
19
|
+
document.documentElement.lang = loc;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CreateIcoreI18nOpts {
|
|
23
|
+
resources: Resource;
|
|
24
|
+
defaultLocale?: IcoreLocale;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createIcoreI18n(opts: CreateIcoreI18nOpts) {
|
|
28
|
+
const lng = getStoredLocale(opts.defaultLocale ?? 'en');
|
|
29
|
+
void i18next.use(initReactI18next).init({
|
|
30
|
+
resources: opts.resources,
|
|
31
|
+
lng,
|
|
32
|
+
fallbackLng: 'en',
|
|
33
|
+
interpolation: { escapeValue: false },
|
|
34
|
+
});
|
|
35
|
+
if (typeof document !== 'undefined') {
|
|
36
|
+
document.documentElement.dir = RTL_LOCALES.has(lng) ? 'rtl' : 'ltr';
|
|
37
|
+
document.documentElement.lang = lng;
|
|
38
|
+
}
|
|
39
|
+
return i18next;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { i18next };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const ICORE_LOCALES = {
|
|
2
|
+
en: {
|
|
3
|
+
common: {
|
|
4
|
+
loading: 'Loading…',
|
|
5
|
+
save: 'Save',
|
|
6
|
+
cancel: 'Cancel',
|
|
7
|
+
logout: 'Log out',
|
|
8
|
+
},
|
|
9
|
+
auth: {
|
|
10
|
+
email: 'Email',
|
|
11
|
+
password: 'Password',
|
|
12
|
+
login: 'Log in',
|
|
13
|
+
register: 'Sign up',
|
|
14
|
+
switchToLogin: 'Have an account? Log in',
|
|
15
|
+
switchToRegister: 'No account yet? Sign up',
|
|
16
|
+
},
|
|
17
|
+
nav: {
|
|
18
|
+
dashboard: 'Dashboard',
|
|
19
|
+
profile: 'Profile',
|
|
20
|
+
},
|
|
21
|
+
profile: {
|
|
22
|
+
title: 'Profile',
|
|
23
|
+
hint: 'Edit your account details.',
|
|
24
|
+
},
|
|
25
|
+
error: {
|
|
26
|
+
accessDenied: 'Access denied',
|
|
27
|
+
unknown: 'Something went wrong.',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
} as const;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface LandingPageDep {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface LandingPageProps {
|
|
10
|
+
coreVersion: string;
|
|
11
|
+
uiLibrary: 'shadcn' | 'antd' | 'mui';
|
|
12
|
+
deps: LandingPageDep[];
|
|
13
|
+
ctaHref?: string;
|
|
14
|
+
ctaLabel?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function LandingPage(props: LandingPageProps) {
|
|
18
|
+
return (
|
|
19
|
+
<main
|
|
20
|
+
style={{
|
|
21
|
+
maxWidth: 720,
|
|
22
|
+
margin: '4rem auto',
|
|
23
|
+
padding: '2rem',
|
|
24
|
+
fontFamily: 'ui-sans-serif, system-ui, sans-serif',
|
|
25
|
+
lineHeight: 1.5,
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<h1 style={{ marginBottom: '0.25rem' }}>icore v{props.coreVersion}</h1>
|
|
29
|
+
<p style={{ color: '#666' }}>
|
|
30
|
+
Bootstrap scaffold built with <strong>{props.uiLibrary}</strong>.
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<h2 style={{ marginTop: '2rem' }}>Installed packages</h2>
|
|
34
|
+
<ul style={{ listStyle: 'none', padding: 0 }}>
|
|
35
|
+
{props.deps.map((d) => (
|
|
36
|
+
<li
|
|
37
|
+
key={d.name}
|
|
38
|
+
style={{
|
|
39
|
+
padding: '0.5rem 0',
|
|
40
|
+
borderBottom: '1px solid #eee',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
justifyContent: 'space-between',
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<span>
|
|
46
|
+
{d.url ? (
|
|
47
|
+
<a href={d.url} target="_blank" rel="noreferrer noopener">
|
|
48
|
+
{d.name}
|
|
49
|
+
</a>
|
|
50
|
+
) : (
|
|
51
|
+
d.name
|
|
52
|
+
)}
|
|
53
|
+
</span>
|
|
54
|
+
<code style={{ color: '#888' }}>{d.version}</code>
|
|
55
|
+
</li>
|
|
56
|
+
))}
|
|
57
|
+
</ul>
|
|
58
|
+
|
|
59
|
+
{props.ctaHref ? (
|
|
60
|
+
<p style={{ marginTop: '2rem' }}>
|
|
61
|
+
<a href={props.ctaHref} style={{ fontWeight: 600 }}>
|
|
62
|
+
{props.ctaLabel ?? 'Continue →'}
|
|
63
|
+
</a>
|
|
64
|
+
</p>
|
|
65
|
+
) : null}
|
|
66
|
+
</main>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface NotifyOptions {
|
|
2
|
+
description?: string;
|
|
3
|
+
duration?: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface Notifier {
|
|
7
|
+
success(title: string, opts?: NotifyOptions): void;
|
|
8
|
+
error(title: string, opts?: NotifyOptions): void;
|
|
9
|
+
info(title: string, opts?: NotifyOptions): void;
|
|
10
|
+
warning(title: string, opts?: NotifyOptions): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let active: Notifier = {
|
|
14
|
+
success: () => undefined,
|
|
15
|
+
error: () => undefined,
|
|
16
|
+
info: () => undefined,
|
|
17
|
+
warning: () => undefined,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function setNotifier(n: Notifier): void {
|
|
21
|
+
active = n;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function useNotify(): Notifier {
|
|
25
|
+
return active;
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { persist } from 'zustand/middleware';
|
|
3
|
+
|
|
4
|
+
export interface AuthUser {
|
|
5
|
+
id: string;
|
|
6
|
+
email: string;
|
|
7
|
+
role?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface AuthState {
|
|
11
|
+
accessToken: string | null;
|
|
12
|
+
refreshToken: string | null;
|
|
13
|
+
user: AuthUser | null;
|
|
14
|
+
setAuth: (a: { accessToken: string; refreshToken: string; user: AuthUser }) => void;
|
|
15
|
+
logout: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const useAuthStore = create<AuthState>()(
|
|
19
|
+
persist(
|
|
20
|
+
(set) => ({
|
|
21
|
+
accessToken: null,
|
|
22
|
+
refreshToken: null,
|
|
23
|
+
user: null,
|
|
24
|
+
setAuth: ({ accessToken, refreshToken, user }) => set({ accessToken, refreshToken, user }),
|
|
25
|
+
logout: () => set({ accessToken: null, refreshToken: null, user: null }),
|
|
26
|
+
}),
|
|
27
|
+
{ name: 'icore-auth' },
|
|
28
|
+
),
|
|
29
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
|
|
3
|
+
interface LoadingState {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
setLoading: (v: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const useLoadingStore = create<LoadingState>((set) => ({
|
|
9
|
+
loading: false,
|
|
10
|
+
setLoading: (loading) => set({ loading }),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
export const useLoading = () => useLoadingStore((s) => s.loading);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"importHelpers": true,
|
|
9
|
+
"noImplicitOverride": true,
|
|
10
|
+
"noImplicitReturns": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"noPropertyAccessFromIndexSignature": true
|
|
13
|
+
},
|
|
14
|
+
"files": [],
|
|
15
|
+
"include": [],
|
|
16
|
+
"references": [
|
|
17
|
+
{
|
|
18
|
+
"path": "./tsconfig.lib.json"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "./tsconfig.spec.json"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"lib": ["ES2022", "DOM"],
|
|
7
|
+
"types": ["node", "react", "react-dom"],
|
|
8
|
+
"jsx": "react-jsx"
|
|
9
|
+
},
|
|
10
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
11
|
+
"exclude": [
|
|
12
|
+
"vite.config.ts",
|
|
13
|
+
"vite.config.mts",
|
|
14
|
+
"vitest.config.ts",
|
|
15
|
+
"vitest.config.mts",
|
|
16
|
+
"src/**/*.test.ts",
|
|
17
|
+
"src/**/*.spec.ts",
|
|
18
|
+
"src/**/*.test.tsx",
|
|
19
|
+
"src/**/*.spec.tsx",
|
|
20
|
+
"src/**/*.test.js",
|
|
21
|
+
"src/**/*.spec.js",
|
|
22
|
+
"src/**/*.test.jsx",
|
|
23
|
+
"src/**/*.spec.jsx"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"]
|
|
6
|
+
},
|
|
7
|
+
"include": [
|
|
8
|
+
"vite.config.ts",
|
|
9
|
+
"vite.config.mts",
|
|
10
|
+
"vitest.config.ts",
|
|
11
|
+
"vitest.config.mts",
|
|
12
|
+
"src/**/*.test.ts",
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.test.tsx",
|
|
15
|
+
"src/**/*.spec.tsx",
|
|
16
|
+
"src/**/*.test.js",
|
|
17
|
+
"src/**/*.spec.js",
|
|
18
|
+
"src/**/*.test.jsx",
|
|
19
|
+
"src/**/*.spec.jsx",
|
|
20
|
+
"src/**/*.d.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
3
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
4
|
+
|
|
5
|
+
export default defineConfig(() => ({
|
|
6
|
+
root: __dirname,
|
|
7
|
+
cacheDir: '../../node_modules/.vite/libs/template-shared',
|
|
8
|
+
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
9
|
+
test: {
|
|
10
|
+
name: 'template-shared',
|
|
11
|
+
watch: false,
|
|
12
|
+
globals: true,
|
|
13
|
+
environment: 'node',
|
|
14
|
+
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
15
|
+
passWithNoTests: true,
|
|
16
|
+
reporters: ['default'],
|
|
17
|
+
coverage: {
|
|
18
|
+
reportsDirectory: '../../coverage/libs/template-shared',
|
|
19
|
+
provider: 'v8' as const,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# upload-client
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
Run `nx build upload-client` to build the library.
|
|
8
|
+
|
|
9
|
+
## Running unit tests
|
|
10
|
+
|
|
11
|
+
Run `nx test upload-client` to execute the unit tests via [Vitest](https://vitest.dev/).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import baseConfig from '../../eslint.config.mjs';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...baseConfig,
|
|
5
|
+
{
|
|
6
|
+
files: ['**/*.json'],
|
|
7
|
+
rules: {
|
|
8
|
+
'@nx/dependency-checks': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
ignoredFiles: [
|
|
12
|
+
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
|
|
13
|
+
'{projectRoot}/vitest.config.{js,ts,mjs,mts}',
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
languageOptions: {
|
|
19
|
+
parser: await import('jsonc-eslint-parser'),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@icore/upload-client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"types": "./src/index.d.ts",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@icore/shared": "*",
|
|
10
|
+
"@nestjs/common": "^11.1.24",
|
|
11
|
+
"@nestjs/microservices": "^11.1.24",
|
|
12
|
+
"rxjs": "^7.8.2",
|
|
13
|
+
"tslib": "^2.3.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "upload-client",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "libs/upload-client/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/js:tsc",
|
|
10
|
+
"outputs": ["{options.outputPath}"],
|
|
11
|
+
"options": {
|
|
12
|
+
"outputPath": "dist/libs/upload-client",
|
|
13
|
+
"main": "libs/upload-client/src/index.ts",
|
|
14
|
+
"tsConfig": "libs/upload-client/tsconfig.lib.json",
|
|
15
|
+
"assets": ["libs/upload-client/*.md"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DynamicModule, Module } from '@nestjs/common';
|
|
2
|
+
import { ClientsModule } from '@nestjs/microservices';
|
|
3
|
+
import { buildTransport } from '@icore/shared';
|
|
4
|
+
import { UploadClientService } from './upload-client.service';
|
|
5
|
+
|
|
6
|
+
export const UPLOAD_CLIENT = 'UPLOAD_CLIENT';
|
|
7
|
+
|
|
8
|
+
@Module({})
|
|
9
|
+
export class UploadClientModule {
|
|
10
|
+
static forRoot(): DynamicModule {
|
|
11
|
+
return {
|
|
12
|
+
module: UploadClientModule,
|
|
13
|
+
imports: [
|
|
14
|
+
ClientsModule.registerAsync([
|
|
15
|
+
{
|
|
16
|
+
name: UPLOAD_CLIENT,
|
|
17
|
+
useFactory: () => buildTransport('UPLOAD'),
|
|
18
|
+
},
|
|
19
|
+
]),
|
|
20
|
+
],
|
|
21
|
+
providers: [UploadClientService],
|
|
22
|
+
exports: [UploadClientService],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Inject, Injectable } from '@nestjs/common';
|
|
2
|
+
import { ClientProxy } from '@nestjs/microservices';
|
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
|
4
|
+
import type { StorageRef } from '@icore/shared';
|
|
5
|
+
import { UPLOAD_CLIENT } from './upload-client.module';
|
|
6
|
+
|
|
7
|
+
@Injectable()
|
|
8
|
+
export class UploadClientService {
|
|
9
|
+
constructor(@Inject(UPLOAD_CLIENT) private readonly client: ClientProxy) {}
|
|
10
|
+
|
|
11
|
+
upload(
|
|
12
|
+
userId: string,
|
|
13
|
+
file: { buffer: Buffer; filename: string; mimeType: string },
|
|
14
|
+
): Promise<StorageRef> {
|
|
15
|
+
return firstValueFrom(
|
|
16
|
+
this.client.send<StorageRef>('storage.upload', {
|
|
17
|
+
userId,
|
|
18
|
+
file: {
|
|
19
|
+
buffer: file.buffer.toString('base64'),
|
|
20
|
+
filename: file.filename,
|
|
21
|
+
mimeType: file.mimeType,
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
remove(userId: string, ref: StorageRef): Promise<void> {
|
|
28
|
+
return firstValueFrom(this.client.send<void>('storage.remove', { userId, ref }));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
signedUrl(userId: string, ref: StorageRef, ttlSec?: number): Promise<string> {
|
|
32
|
+
return firstValueFrom(this.client.send<string>('storage.signedUrl', { userId, ref, ttlSec }));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
list(userId: string, prefix?: string): Promise<StorageRef[]> {
|
|
36
|
+
return firstValueFrom(this.client.send<StorageRef[]>('storage.list', { userId, prefix }));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "node16",
|
|
5
|
+
"moduleResolution": "node16",
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"importHelpers": true,
|
|
9
|
+
"noImplicitOverride": true,
|
|
10
|
+
"noImplicitReturns": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"noPropertyAccessFromIndexSignature": true
|
|
13
|
+
},
|
|
14
|
+
"files": [],
|
|
15
|
+
"include": [],
|
|
16
|
+
"references": [
|
|
17
|
+
{
|
|
18
|
+
"path": "./tsconfig.lib.json"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "./tsconfig.spec.json"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"types": ["node"],
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"emitDecoratorMetadata": true,
|
|
9
|
+
"target": "es2021"
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*.ts"],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"vite.config.ts",
|
|
14
|
+
"vite.config.mts",
|
|
15
|
+
"vitest.config.ts",
|
|
16
|
+
"vitest.config.mts",
|
|
17
|
+
"src/**/*.test.ts",
|
|
18
|
+
"src/**/*.spec.ts",
|
|
19
|
+
"src/**/*.test.tsx",
|
|
20
|
+
"src/**/*.spec.tsx",
|
|
21
|
+
"src/**/*.test.js",
|
|
22
|
+
"src/**/*.spec.js",
|
|
23
|
+
"src/**/*.test.jsx",
|
|
24
|
+
"src/**/*.spec.jsx"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"]
|
|
6
|
+
},
|
|
7
|
+
"include": [
|
|
8
|
+
"vite.config.ts",
|
|
9
|
+
"vite.config.mts",
|
|
10
|
+
"vitest.config.ts",
|
|
11
|
+
"vitest.config.mts",
|
|
12
|
+
"src/**/*.test.ts",
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.test.tsx",
|
|
15
|
+
"src/**/*.spec.tsx",
|
|
16
|
+
"src/**/*.test.js",
|
|
17
|
+
"src/**/*.spec.js",
|
|
18
|
+
"src/**/*.test.jsx",
|
|
19
|
+
"src/**/*.spec.jsx",
|
|
20
|
+
"src/**/*.d.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
3
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
4
|
+
|
|
5
|
+
export default defineConfig(() => ({
|
|
6
|
+
root: __dirname,
|
|
7
|
+
cacheDir: '../../node_modules/.vite/libs/upload-client',
|
|
8
|
+
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
9
|
+
test: {
|
|
10
|
+
name: 'upload-client',
|
|
11
|
+
watch: false,
|
|
12
|
+
globals: true,
|
|
13
|
+
environment: 'node',
|
|
14
|
+
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
15
|
+
passWithNoTests: true,
|
|
16
|
+
reporters: ['default'],
|
|
17
|
+
coverage: {
|
|
18
|
+
reportsDirectory: '../../coverage/libs/upload-client',
|
|
19
|
+
provider: 'v8' as const,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}));
|