diff --git a/apps/client/config/defineAliases.ts b/apps/client/config/defineAliases.ts
new file mode 100644
index 00000000..43970617
--- /dev/null
+++ b/apps/client/config/defineAliases.ts
@@ -0,0 +1,19 @@
+import { resolve } from 'path'
+import { AliasOptions, ResolveOptions } from 'vite'
+
+type DefineAliases = ResolveOptions & { alias: AliasOptions }
+
+const resolveLibs = (...args: string[]) =>
+ resolve(__dirname, '..', '..', '..', 'libs', ...args)
+
+export const defineAliases = (): DefineAliases => {
+ return {
+ preserveSymlinks: true,
+ alias: {
+ '@code-gear/client-shared': resolve(
+ __dirname,
+ resolveLibs('client-shared', 'src', 'index.ts')
+ )
+ }
+ }
+}
diff --git a/apps/client/config/definePlugins.ts b/apps/client/config/definePlugins.ts
new file mode 100644
index 00000000..e73a347c
--- /dev/null
+++ b/apps/client/config/definePlugins.ts
@@ -0,0 +1,32 @@
+import { PluginOption } from 'vite'
+import { VitePWA } from 'vite-plugin-pwa'
+import webfontDownload from 'vite-plugin-webfont-dl'
+import viteTsConfigPaths from 'vite-tsconfig-paths'
+
+import preact from '@preact/preset-vite'
+
+export const definePlugins = (): PluginOption[] => {
+ return [
+ webfontDownload([
+ 'https://fonts.googleapis.com/css2?family=Poppins&display=swap'
+ ]),
+ preact(),
+ viteTsConfigPaths(),
+ VitePWA({
+ registerType: 'autoUpdate',
+ injectRegister: 'auto',
+ strategies: 'injectManifest',
+ srcDir: 'public',
+ filename: 'service-worker.js',
+ workbox: {
+ globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
+ clientsClaim: true,
+ skipWaiting: true
+ },
+ devOptions: {
+ enabled: false
+ },
+ includeAssets: ['**/*']
+ })
+ ]
+}
diff --git a/apps/client/config/defineVariables.ts b/apps/client/config/defineVariables.ts
new file mode 100644
index 00000000..c6a55ae4
--- /dev/null
+++ b/apps/client/config/defineVariables.ts
@@ -0,0 +1,8 @@
+import { AnyObject } from '$/client-shared'
+
+export const defineVariables = (): AnyObject => {
+ return {
+ 'process.env': process.env,
+ _isDev_: process.env.NODE_ENV === 'development'
+ }
+}
diff --git a/apps/client/config/index.ts b/apps/client/config/index.ts
new file mode 100644
index 00000000..7e367549
--- /dev/null
+++ b/apps/client/config/index.ts
@@ -0,0 +1,3 @@
+export { defineAliases } from './defineAliases'
+export { definePlugins } from './definePlugins'
+export { defineVariables } from './defineVariables'
diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts
index 77eb6112..105425a2 100644
--- a/apps/client/vite.config.ts
+++ b/apps/client/vite.config.ts
@@ -1,28 +1,13 @@
// /
// /
-import path from 'path'
import { defineConfig } from 'vite'
-import { VitePWA } from 'vite-plugin-pwa'
-import webfontDownload from 'vite-plugin-webfont-dl'
-import viteTsConfigPaths from 'vite-tsconfig-paths'
-import preact from '@preact/preset-vite'
+import { defineAliases, definePlugins, defineVariables } from './config'
export default defineConfig({
cacheDir: '../../node_modules/.vite/client',
- define: {
- 'process.env': process.env,
- _isDev_: process.env.NODE_ENV === 'development'
- },
- resolve: {
- preserveSymlinks: true,
- alias: {
- '@code-gear/client-shared': path.resolve(
- __dirname,
- '../../libs/client-shared/src/index.ts'
- )
- }
- },
+ define: defineVariables(),
+ resolve: defineAliases(),
server: {
port: 3000,
host: 'localhost',
@@ -34,39 +19,7 @@ export default defineConfig({
port: 4200,
host: 'localhost'
},
- plugins: [
- webfontDownload([
- 'https://fonts.googleapis.com/css2?family=Poppins&display=swap'
- ]),
- preact(),
- viteTsConfigPaths({
- root: '../../'
- }),
- VitePWA({
- registerType: 'autoUpdate',
- injectRegister: 'auto',
- strategies: 'injectManifest',
- srcDir: 'public',
- filename: 'service-worker.js',
- workbox: {
- globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
- clientsClaim: true,
- skipWaiting: true
- },
- devOptions: {
- enabled: false
- },
- includeAssets: ['**/*']
- })
- ],
- build: {
- rollupOptions: {
- external: ['@code-gear/client-shared']
- }
- },
- esbuild: {
- exclude: ['@code-gear/client-shared']
- },
+ plugins: definePlugins(),
test: {
globals: true,
cache: {
diff --git a/libs/config/package.json b/libs/config/package.json
index ef52b5da..c7e23e95 100644
--- a/libs/config/package.json
+++ b/libs/config/package.json
@@ -1,4 +1,11 @@
{
"name": "@code-gear/config",
- "version": "1.0.0"
+ "version": "1.0.0",
+ "main": "src/index.ts",
+ "exports": {
+ ".": {
+ "import": "./src/index.ts",
+ "require": "./src/index.ts"
+ }
+ }
}
diff --git a/package.json b/package.json
index 01d47493..afc086a1 100644
--- a/package.json
+++ b/package.json
@@ -58,6 +58,7 @@
"@types/bcryptjs": "^2.4.2",
"@types/jest": "^29.4.0",
"@types/node": "18.14.2",
+ "@types/passport": "^0",
"@types/passport-jwt": "^3.0.9",
"@types/passport-local": "^1.0.35",
"@types/react": "^18.2.14",
@@ -142,11 +143,13 @@
"bcryptjs": "^2.4.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
+ "dotenv": "^16.3.1",
"graphql": "^16.7.1",
"mobx": "^6.9.0",
"mobx-react-lite": "^3.4.3",
"moment": "^2.29.4",
"normalize.css": "^8.0.1",
+ "passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"preact-compat": "^3.19.0",
diff --git a/yarn.lock b/yarn.lock
index b0b657eb..bc4a7025 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2009,6 +2009,10 @@ __metadata:
"@code-gear/server@workspace:apps/server":
version: 0.0.0-use.local
resolution: "@code-gear/server@workspace:apps/server"
+ dependencies:
+ "@code-gear/config": "workspace:*"
+ "@types/webpack-node-externals": ^3
+ webpack-node-externals: ^3.0.0
languageName: unknown
linkType: soft
@@ -2061,6 +2065,7 @@ __metadata:
"@types/bcryptjs": ^2.4.2
"@types/jest": ^29.4.0
"@types/node": 18.14.2
+ "@types/passport": ^0
"@types/passport-jwt": ^3.0.9
"@types/passport-local": ^1.0.35
"@types/react": ^18.2.14
@@ -2086,6 +2091,7 @@ __metadata:
class-validator: ^0.14.0
concat-files: ^0.1.1
cypress: ^12.11.0
+ dotenv: ^16.3.1
eslint: ~8.41.0
eslint-config-gearonix: 1.0.2
eslint-config-google: ^0.14.0
@@ -2114,6 +2120,7 @@ __metadata:
normalize.css: ^8.0.1
nx: 16.4.0
nx-cloud: latest
+ passport: ^0.6.0
passport-jwt: ^4.0.1
passport-local: ^1.0.0
preact: ^10.15.1
@@ -5416,6 +5423,15 @@ __metadata:
languageName: node
linkType: hard
+"@types/passport@npm:^0":
+ version: 0.4.7
+ resolution: "@types/passport@npm:0.4.7"
+ dependencies:
+ "@types/express": "*"
+ checksum: c22a84226d763db30cc6d8b330022820d067ea4039dc625371825e0d2fb8e3d6e7387cf4619e79a4cc293e8c3f3420f3da3067c564da14c21fadb03b5f5c870f
+ languageName: node
+ linkType: hard
+
"@types/prop-types@npm:*":
version: 15.7.5
resolution: "@types/prop-types@npm:15.7.5"
@@ -5628,6 +5644,16 @@ __metadata:
languageName: node
linkType: hard
+"@types/webpack-node-externals@npm:^3":
+ version: 3.0.0
+ resolution: "@types/webpack-node-externals@npm:3.0.0"
+ dependencies:
+ "@types/node": "*"
+ webpack: ^5
+ checksum: ea87e99d389708ebf144e47ba1353bac2ab524f80f022b07ce683ba451f326a6cfd62acae36f0a727823a3c198e59de70baac20cf1ea9eb5cf0980ab55f758c7
+ languageName: node
+ linkType: hard
+
"@types/wicg-file-system-access@npm:^2020.9.6":
version: 2020.9.6
resolution: "@types/wicg-file-system-access@npm:2020.9.6"
@@ -8938,6 +8964,13 @@ __metadata:
languageName: node
linkType: hard
+"dotenv@npm:^16.3.1":
+ version: 16.3.1
+ resolution: "dotenv@npm:16.3.1"
+ checksum: 15d75e7279018f4bafd0ee9706593dd14455ddb71b3bcba9c52574460b7ccaf67d5cf8b2c08a5af1a9da6db36c956a04a1192b101ee102a3e0cf8817bbcf3dfd
+ languageName: node
+ linkType: hard
+
"dotenv@npm:~10.0.0":
version: 10.0.0
resolution: "dotenv@npm:10.0.0"
@@ -15069,6 +15102,17 @@ __metadata:
languageName: node
linkType: hard
+"passport@npm:^0.6.0":
+ version: 0.6.0
+ resolution: "passport@npm:0.6.0"
+ dependencies:
+ passport-strategy: 1.x.x
+ pause: 0.0.1
+ utils-merge: ^1.0.1
+ checksum: ef932ad671d50de34765c7a53cd1e058d8331a82a6df09265a9c6c1168911aee4a7b5215803d0101110ab7f317e096b4954ca7e18fb2c33b9929f0bd17dbe159
+ languageName: node
+ linkType: hard
+
"path-browserify@npm:^1.0.1":
version: 1.0.1
resolution: "path-browserify@npm:1.0.1"
@@ -15172,6 +15216,13 @@ __metadata:
languageName: node
linkType: hard
+"pause@npm:0.0.1":
+ version: 0.0.1
+ resolution: "pause@npm:0.0.1"
+ checksum: e96ee581b68085e6f2ba5adbcb4d4a41fe88e5b514061e76df2fe1905f0f65f4fe5a843b538e9551122c6b9184ff4be266c2ee0ea4614702f9a3d04466d9f462
+ languageName: node
+ linkType: hard
+
"pend@npm:~1.2.0":
version: 1.2.0
resolution: "pend@npm:1.2.0"
@@ -19185,7 +19236,7 @@ __metadata:
languageName: node
linkType: hard
-"utils-merge@npm:1.0.1":
+"utils-merge@npm:1.0.1, utils-merge@npm:^1.0.1":
version: 1.0.1
resolution: "utils-merge@npm:1.0.1"
checksum: c81095493225ecfc28add49c106ca4f09cdf56bc66731aa8dabc2edbbccb1e1bfe2de6a115e5c6a380d3ea166d1636410b62ef216bb07b3feb1cfde1d95d5080
@@ -19713,7 +19764,7 @@ __metadata:
languageName: node
linkType: hard
-"webpack@npm:^5.80.0":
+"webpack@npm:^5, webpack@npm:^5.80.0":
version: 5.88.2
resolution: "webpack@npm:5.88.2"
dependencies: