Skip to content

Commit

Permalink
Fix build options & add .gitattributes
Browse files Browse the repository at this point in the history
  • Loading branch information
semkedaniil committed Oct 12, 2023
1 parent 790a977 commit 892060d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}}"
Expand Down
10 changes: 4 additions & 6 deletions db-viewer-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions db-viewer-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"esModuleInterop": false,
"baseUrl": "./",
"rootDir": "./",
"outDir": "dist",
"outDir": "./dist",
"noUnusedLocals": true,
"downlevelIteration": true,
"importHelpers": true,
Expand All @@ -30,7 +30,8 @@
"noEmit": true,
"jsx": "react-jsx",
"paths": {
"*": ["typings/*"]
"*": ["typings/*"],
"react": ["./node_modules/@types/react"],
}
},
"include": ["src", "vite.config.ts", "typings"],
Expand Down
9 changes: 5 additions & 4 deletions db-viewer-ui/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src"
"rootDir": "./src",
"noEmit": false
},
"include": [
"src/**/*",
"typings/**/*"
"src",
"typings"
]
}
}
15 changes: 6 additions & 9 deletions db-viewer-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand All @@ -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,
},
};
});
27 changes: 19 additions & 8 deletions db-viewer-ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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:
Expand All @@ -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"
Expand Down

0 comments on commit 892060d

Please sign in to comment.