From ca8507d0bb162ec394438ee2b04288554711fe99 Mon Sep 17 00:00:00 2001 From: Ira Hopkinson Date: Tue, 9 Jul 2024 11:04:58 +1200 Subject: [PATCH] add CI format check (#984) - some clean-up - also removes a no longer needed work-around for macOS --- .github/assets/github-pages-index.html | 2 +- .github/workflows/test.yml | 30 +++++++++++-------- README.md | 2 +- package.json | 5 ++-- .../testing/test-buttons-panel.component.css | 4 ++- src/stories/Intro.mdx | 6 ++-- 6 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/assets/github-pages-index.html b/.github/assets/github-pages-index.html index f09a9faa20..88a56ae563 100644 --- a/.github/assets/github-pages-index.html +++ b/.github/assets/github-pages-index.html @@ -1,4 +1,4 @@ - + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e371fadf30..b83d8dc9d9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,8 +32,7 @@ jobs: - name: Install icu4c on macOS if: ${{ matrix.os == 'macos-latest' }} - run: | - sudo port -v install icu + run: sudo port -v install icu - name: Check out Git repository uses: actions/checkout@v4 @@ -58,28 +57,33 @@ jobs: - name: npm install run: npm install - - name: Install DMG license - if: ${{ matrix.os == 'macos-latest' }} - run: npm install dmg-license - - name: Build run: npm run build - - name: run dotnet unit tests + - name: dotnet unit tests run: dotnet test c-sharp-tests/c-sharp-tests.csproj + - name: npm unit tests + run: npm test + - name: check dotnet formatting - run: cd c-sharp && dotnet tool restore && dotnet csharpier --check . + run: | + cd c-sharp + dotnet tool restore + dotnet csharpier --check . + + - name: check JS/TS formatting + run: npm run format:check - - name: npm test + - name: check JS/TS linting + run: npm run lint + + - name: check packaging env: # no hardlinks so dependencies are copied USE_HARD_LINKS: false GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - npm run lint - npm test - npm run package + run: npm run package # Enable tmate debugging of manually-triggered workflows if the input option was provided - name: Setup tmate session diff --git a/README.md b/README.md index 8db73f0f46..3caad727c3 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ Formatting happens automatically when you commit. If you use VS Code with this r To check TypeScript for readability, maintainability, and functionality errors, and to check a few other files for proper formatting, run the following from the repo root (or just use VS Code with this repo's recommended extensions) ```bash -npm run prettier +npm run format npm run lint ``` diff --git a/package.json b/package.json index 872966c42a..1bcdf1af2a 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,8 @@ "editor:link": "yalc link @biblionexus-foundation/platform-editor --no-pure", "editor:update": "yalc update @biblionexus-foundation/platform-editor", "editor:unlink": "yalc remove @biblionexus-foundation/platform-editor && npm i --ignore-scripts", - "postinstall": "patch-package && tsx .erb/scripts/check-native-dep.js && electron-builder install-app-deps && npm run build:dll && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts", + "format": "prettier --write .", + "format:check": "prettier --check .", "lint": "npm run build:types && npm run lint:scripts && npm run lint:styles && cd lib/papi-dts && npm run lint && cd ../../extensions && npm run lint", "lint:scripts": "cross-env NODE_ENV=development eslint --ext .cjs,.js,.jsx,.ts,.tsx --cache .", "lint:styles": "stylelint **/*.{css,scss}", @@ -71,8 +72,8 @@ "lint:staged": "npm run build:types && lint-staged -q && cd lib/papi-dts && npm run lint:staged && cd ../../extensions && npm run lint:staged", "package": "tsx ./.erb/scripts/clean.js dist && npm run build && npm run build:extensions:production && electron-builder build --publish never && npm run build:dll", "package:debug": "cross-env DEBUG_PROD=true npm run package", + "postinstall": "patch-package && tsx .erb/scripts/check-native-dep.js && electron-builder install-app-deps && npm run build:dll && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts", "prepare": "husky install && npm run csharp:tool:restore", - "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,csj,json,css,scss,html,md,yml}\"", "rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app", "start": "tsx ./.erb/scripts/check-port-in-use.js && npm run start:renderer", "start:main": "cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .", diff --git a/src/renderer/testing/test-buttons-panel.component.css b/src/renderer/testing/test-buttons-panel.component.css index 5e859119ba..94006a27c2 100644 --- a/src/renderer/testing/test-buttons-panel.component.css +++ b/src/renderer/testing/test-buttons-panel.component.css @@ -9,7 +9,9 @@ border: 0; appearance: none; font-size: 1.3rem; - box-shadow: 0 8px 28px -6px rgba(24, 39, 75, 0.12), 0 18px 88px -4px rgba(24, 39, 75, 0.14); + box-shadow: + 0 8px 28px -6px rgba(24, 39, 75, 0.12), + 0 18px 88px -4px rgba(24, 39, 75, 0.14); transition: all ease-in 0.1s; cursor: pointer; opacity: 0.9; diff --git a/src/stories/Intro.mdx b/src/stories/Intro.mdx index 3cad10033e..0682b14c2f 100644 --- a/src/stories/Intro.mdx +++ b/src/stories/Intro.mdx @@ -88,15 +88,15 @@ import Button from './Button'; import { Story, Meta } from '@storybook/react/types-6-0'; export default { - title: 'Components/Button', - component: Button, + title: 'Components/Button', + component: Button, } as Meta; const Template: Story = (args) =>