diff --git a/.gitattributes b/.gitattributes index 729d251a..74709d49 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Set default behavior to automatically normalize line endings -* text=auto +* text=auto eol=lf # The above will handle all files NOT found below *.cs text diff=csharp diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index a3572883..c5a0978e 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -44,10 +44,10 @@ jobs: run: dotnet pack --no-build --configuration Release ./DbViewer.sln - name: Build front - run: yarn --cwd db-viewer-ui build:test + run: yarn --cwd db-viewer-ui build - name: Check C# code style - run: dotnet jb cleanupcode DbViewer.sln --profile=CatalogueCleanup --exclude=./DbViewer.TestApi/Migrations/*.cs --verbosity=WARN && git diff --exit-code -- ':!db-viewer-ui' + run: dotnet jb cleanupcode DbViewer.sln --profile=CatalogueCleanup --exclude=./DbViewer.TestApi/Migrations/*.cs --verbosity=WARN && git diff --exit-code - name: Check front code run: yarn --cwd db-viewer-ui lint @@ -102,9 +102,6 @@ jobs: node-version: ${{ env.NODE_VERSION }} registry-url: ${{ env.NPM_REGISTRY }} - - name: Build front for production - run: yarn --cwd db-viewer-ui build:prod - - name: Check version run: | tagName="${{github.ref_name}}" diff --git a/db-viewer-ui/package.json b/db-viewer-ui/package.json index b401ffd5..a2cc29b7 100644 --- a/db-viewer-ui/package.json +++ b/db-viewer-ui/package.json @@ -20,13 +20,11 @@ ], "author": "Den Mukhametianov, Pavel Vostretsov", "scripts": { - "build:prod": "run-s build:prep build:vite:prod build:copy:src build:copy:meta build:patch build:pack", - "build:test": "run-s build:prep build:vite:test build:copy:test", + "build": "run-s build:prep build:vite \"build:copy:*\" build:copy:meta build:patch build:pack", "build:prep": "run-s build:types build:clean build:tsc", "build:clean": "rimraf dist ../DbViewer.TestApi/wwwroot ../DbViewer.TestApi/bin/net6.0/wwwroot", "build:tsc": "tsc --project tsconfig.prod.json", - "build:vite:test": "vite build --mode test --emptyOutDir", - "build:vite:prod": "vite build", + "build:vite": "vite build --mode test --emptyOutDir", "build:patch": "node ./patch-version", "build:copy:src": "copyfiles --up 1 \"src/**/*.js\" dist", "build:copy:meta": "copyfiles --flat package.json \"../*.md\" ../LICENSE dist", @@ -65,8 +63,8 @@ "@storybook/react": "^7.0.7", "@storybook/react-vite": "^7.4.6", "@types/lodash": "^4.14.171", - "@types/react": "^18.2.0", - "@types/react-dom": "^18.2.0", + "@types/react": "^17.0.15", + "@types/react-dom": "^17.0.15", "@types/react-router": "^5.1.16", "@types/react-router-dom": "^5.1.8", "@typescript-eslint/eslint-plugin": "^6.7.4", diff --git a/db-viewer-ui/tsconfig.json b/db-viewer-ui/tsconfig.json index 330f4ff6..bad15276 100644 --- a/db-viewer-ui/tsconfig.json +++ b/db-viewer-ui/tsconfig.json @@ -4,7 +4,7 @@ "esModuleInterop": false, "baseUrl": "./", "rootDir": "./", - "outDir": "dist", + "outDir": "./dist", "noUnusedLocals": true, "downlevelIteration": true, "importHelpers": true, @@ -30,7 +30,8 @@ "noEmit": true, "jsx": "react-jsx", "paths": { - "*": ["typings/*"] + "*": ["typings/*"], + "react": ["./node_modules/@types/react"], } }, "include": ["src", "vite.config.ts", "typings"], diff --git a/db-viewer-ui/tsconfig.prod.json b/db-viewer-ui/tsconfig.prod.json index ff48fb18..fff806a9 100644 --- a/db-viewer-ui/tsconfig.prod.json +++ b/db-viewer-ui/tsconfig.prod.json @@ -1,10 +1,11 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "rootDir": "./src" + "rootDir": "./src", + "noEmit": false }, "include": [ - "src/**/*", - "typings/**/*" + "src", + "typings" ] -} \ No newline at end of file +} diff --git a/db-viewer-ui/vite.config.ts b/db-viewer-ui/vite.config.ts index 2a0290b2..77fcbc3a 100644 --- a/db-viewer-ui/vite.config.ts +++ b/db-viewer-ui/vite.config.ts @@ -3,7 +3,6 @@ import { defineConfig } from "vite"; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { - const isTestMode = mode === "test"; const isDevMode = mode === "dev"; return { plugins: [react()], @@ -24,16 +23,14 @@ export default defineConfig(({ mode }) => { globals: false, environment: "jsdom", }, - esbuild: isTestMode - ? { - minifyIdentifiers: false, - keepNames: true, - } - : {}, + esbuild: { + minifyIdentifiers: false, + keepNames: true, + }, build: { minify: "esbuild", - outDir: isTestMode ? "../DbViewer.TestApi/wwwroot" : "./dist", - chunkSizeWarningLimit: isTestMode ? 2048 : 1024, + outDir: "../DbViewer.TestApi/wwwroot", + chunkSizeWarningLimit: 2048, }, }; }); diff --git a/db-viewer-ui/yarn.lock b/db-viewer-ui/yarn.lock index 17504912..96d19cc9 100644 --- a/db-viewer-ui/yarn.lock +++ b/db-viewer-ui/yarn.lock @@ -2659,8 +2659,8 @@ __metadata: "@storybook/react": ^7.0.7 "@storybook/react-vite": ^7.4.6 "@types/lodash": ^4.14.171 - "@types/react": ^18.2.0 - "@types/react-dom": ^18.2.0 + "@types/react": ^17.0.15 + "@types/react-dom": ^17.0.15 "@types/react-router": ^5.1.16 "@types/react-router-dom": ^5.1.8 "@typescript-eslint/eslint-plugin": ^6.7.4 @@ -3665,12 +3665,12 @@ __metadata: languageName: node linkType: hard -"@types/react-dom@npm:^18.2.0": - version: 18.2.10 - resolution: "@types/react-dom@npm:18.2.10" +"@types/react-dom@npm:^17.0.15": + version: 17.0.21 + resolution: "@types/react-dom@npm:17.0.21" dependencies: - "@types/react": "*" - checksum: ced70643d82dd9d165cd6d1a98ec7556daf77d8fdec1ed19badb744a2a2370a84cc109248667536d7f850409e85432c300ec9f8c87d46e066ad295ddf9b6ab03 + "@types/react": ^17 + checksum: a2e3f068c1374601856b63bc57f3f436cf6270c1ba5c5cef0776def6de296c8bdd31c39b5be9e9e77f4652e923bef1e71ae377a2b038f4a81bfd0fec8d10d0d0 languageName: node linkType: hard @@ -3695,7 +3695,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:^18.2.0": +"@types/react@npm:*": version: 18.2.25 resolution: "@types/react@npm:18.2.25" dependencies: @@ -3706,6 +3706,17 @@ __metadata: languageName: node linkType: hard +"@types/react@npm:^17, @types/react@npm:^17.0.15": + version: 17.0.68 + resolution: "@types/react@npm:17.0.68" + dependencies: + "@types/prop-types": "*" + "@types/scheduler": "*" + csstype: ^3.0.2 + checksum: c6ca4415b53b1abe91162b29af541a1797a56a6f462ef796e8ebda3eaa4d0609205f4f17b3fce8d9a12235d4ffd8a67c47b5e018ed85c2f3bee0fba8f54638c1 + languageName: node + linkType: hard + "@types/scheduler@npm:*": version: 0.16.4 resolution: "@types/scheduler@npm:0.16.4"