Skip to content

Commit

Permalink
Add eslint and migrate to yarn (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
drebrez authored Jun 8, 2024
1 parent 2854f73 commit 0d2140f
Show file tree
Hide file tree
Showing 49 changed files with 4,075 additions and 6,271 deletions.
8 changes: 4 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ indent_size = 4
indent_style = tab

# XML Project Files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,esproj}]
indent_size = 2

# Configuration Files
[*.{json,xml,yml,config,props,targets,nuspec,resx,ruleset}]
indent_size = 4
[*.{json,xml,yml,config,props,targets,nuspec,resx,ruleset,js}]
indent_size = 2

# .NET Config Files
[*.{config}]
Expand All @@ -43,7 +43,7 @@ charset = utf-8-bom
trim_trailing_whitespace = false

# Web Files
[*.{htm,html,js,ts,css,scss,less}]
[*.{htm,html,ts,css,scss,less}]
indent_size = 4
insert_final_newline = true

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
microsoft_sql:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
RunDockerTests: true
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
files: SQLSchemaCompare.Test/TestResults/*.trx

my_sql:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
RunDockerTests: true
Expand Down Expand Up @@ -81,6 +83,7 @@ jobs:
files: SQLSchemaCompare.Test/TestResults/*.trx

postgre_sql:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
RunDockerTests: true
Expand Down Expand Up @@ -121,6 +124,7 @@ jobs:
files: SQLSchemaCompare.Test/TestResults/*.trx

maria_db:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
RunDockerTests: true
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
dotnet-version: 8.0.x
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Install npm dependencies
run: npm install
working-directory: SQLSchemaCompare

- name: Restore win-x64 dependencies
run: dotnet restore -r win-x64
Expand Down Expand Up @@ -86,7 +83,7 @@ jobs:
name: publish-win
path: .publish
- name: Create installer
run: npm run dist-win-x64
run: yarn dist-win-x64
working-directory: SQLSchemaCompare
- name: Upload installer to release
uses: svenstaro/upload-release-action@v2
Expand Down Expand Up @@ -123,7 +120,7 @@ jobs:
chmod +x .publish/TiCodeX.SQLSchemaCompare.UI
chmod +x .publish/TiCodeX.SQLSchemaCompare.CLI
- name: Create installer
run: npm run dist-linux-x64
run: yarn dist-linux-x64
working-directory: SQLSchemaCompare
- name: Upload installer to release
uses: svenstaro/upload-release-action@v2
Expand Down Expand Up @@ -160,7 +157,7 @@ jobs:
chmod +x .publish/TiCodeX.SQLSchemaCompare.UI
chmod +x .publish/TiCodeX.SQLSchemaCompare.CLI
- name: Create installer
run: npm run dist-osx-x64
run: yarn dist-osx-x64
working-directory: SQLSchemaCompare
- name: Upload installer to release
uses: svenstaro/upload-release-action@v2
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
unit_tests:
if: github.event.pull_request.draft == false
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -18,9 +19,6 @@ jobs:
uses: microsoft/setup-msbuild@v1.0.2
- name: Restore dependencies
run: dotnet restore
- name: Install npm dependencies
run: npm install
working-directory: SQLSchemaCompare
- name: Build
run: msbuild SQLSchemaCompare.sln /p:Configuration=Release
- name: Test
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# ESLint
.eslintcache

# Custom rules
SQLSchemaCompare/app.js
SQLSchemaCompare/app.js.map
Expand Down
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"EditorConfig.EditorConfig",
"dbaeumer.vscode-eslint",
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.formatOnSave": true,
"eslint.enable": true,
"eslint.format.enable": true,
"eslint.validate": [
"typescript",
],
"eslint.experimental.useFlatConfig": true,
"eslint.workingDirectories": [{ "mode": "auto" }],
"eslint.options": {
"overrideConfigFile": "./eslint.config.js"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
17 changes: 10 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@
"group": {
"kind": "build"
},
"problemMatcher": {
"base": "$tsc",
"fileLocation": [
"relative",
"${workspaceFolder}/SQLSchemaCompare"
]
}
"problemMatcher": [
"$eslint-stylish",
{
"base": "$tsc",
"fileLocation": [
"relative",
"${workspaceFolder}/SQLSchemaCompare"
]
}
]
},
{
"label": "Build CLI",
Expand Down
24 changes: 11 additions & 13 deletions CreateInstallerCommon.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

REM Bring dev tools into the PATH.
set "VsDevCmdPath=C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat"
if not exist "%VsDevCmdPath%" (
set "VsDevCmdPath=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
)
if not exist "%VsDevCmdPath%" (
set "VsDevCmdPath=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat"
)
Expand Down Expand Up @@ -40,18 +43,13 @@ if ERRORLEVEL 1 exit /b %ERRORLEVEL%

echo.
echo ___________________________
echo /\ \
echo \_^| Building ^|
echo ^| SQLSchemaCompare ^|
echo ^| _______________________^|_
echo /\ \
echo \_^| Building ^|
echo ^| SQLSchemaCompare ^|
echo ^| _______________________^|_
echo \_/_________________________/
echo.

pushd %~dp0\SQLSchemaCompare
rd /Q /S node_modules
call npm install
popd

dotnet restore -r %targetdotnet%
if ERRORLEVEL 1 exit /b %ERRORLEVEL%

Expand All @@ -60,10 +58,10 @@ if ERRORLEVEL 1 exit /b %ERRORLEVEL%

echo.
echo ____________________________
echo /\ \
echo \_^| Publishing ^|
echo ^| SQLSchemaCompare ^|
echo ^| _______________________^|_
echo /\ \
echo \_^| Publishing ^|
echo ^| SQLSchemaCompare ^|
echo ^| _______________________^|_
echo \_/_________________________/
echo.

Expand Down
2 changes: 1 addition & 1 deletion CreateInstallerLinux.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ docker run --rm^
--env ELECTRON_CACHE="/root/.cache/electron"^
--env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder"^
electronuserland/builder^
npm run dist-%target%
yarn dist-%target%

if ERRORLEVEL 1 goto:error

Expand Down
20 changes: 10 additions & 10 deletions CreateInstallerOSX.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ if ERRORLEVEL 1 goto:error

echo.
echo _____________________
echo /\ \
echo \_^| Preparing ^|
echo ^| OSX ^|
echo ^| _________________^|_
echo /\ \
echo \_^| Preparing ^|
echo ^| OSX ^|
echo ^| _________________^|_
echo \_/___________________/
echo.

Expand All @@ -37,11 +37,11 @@ if ERRORLEVEL 1 goto:error

echo.
echo _____________________
echo /\ \
echo \_^| Packaging ^|
echo ^| electron ^|
echo ^| OSX ^|
echo ^| _________________^|_
echo /\ \
echo \_^| Packaging ^|
echo ^| electron ^|
echo ^| OSX ^|
echo ^| _________________^|_
echo \_/___________________/
echo.

Expand All @@ -51,7 +51,7 @@ plink -pw %remotePass% %remoteUser%@%remoteIp% (^
cd %remoteDir%/SQLSchemaCompare;^
chmod -R a+rwx ./node_modules;^
chmod +x ../.publish/TiCodeX.SQLSchemaCompare.UI;^
npm run dist-%target%;^
yarn dist-%target%;^
)

if ERRORLEVEL 1 goto:error
Expand Down
10 changes: 5 additions & 5 deletions CreateInstallerWin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ if ERRORLEVEL 1 goto:error

echo.
echo _____________________
echo /\ \
echo \_^| Packaging ^|
echo ^| electron ^|
echo ^| _________________^|_
echo /\ \
echo \_^| Packaging ^|
echo ^| electron ^|
echo ^| _________________^|_
echo \_/___________________/
echo.

REM Cleanup folders
if exist %~dp0\installer\win-unpacked ( rmdir /S /Q %~dp0\installer\win-unpacked )

call npm --prefix SQLSchemaCompare run dist-%target%
call yarn --cwd SQLSchemaCompare dist-%target%

if ERRORLEVEL 1 goto:error

Expand Down
Loading

0 comments on commit 0d2140f

Please sign in to comment.