From 46ab14a8dfed162f30a74dd77b98c91022323491 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 27 Oct 2024 23:32:25 +0100 Subject: [PATCH] Check formatting in CI --- .github/workflows/ci.yml | 38 +++++++++++++------------- .github/workflows/npm-publish.yml | 44 +++++++++++++++---------------- .prettierrc | 8 +++++- .vscode/settings.json | 3 +++ package-lock.json | 2 +- package.json | 4 ++- 6 files changed, 55 insertions(+), 44 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8965629..5319898 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,24 +1,24 @@ name: CI on: - push: - branches: [master] - pull_request: - branches: [master] + push: + branches: [master] + pull_request: + branches: [master] jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install Dependencies - run: npm ci - - name: Check - run: npm run check - - name: Package - run: npm run package - - name: Build Example Site - run: npm run build + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install Dependencies + run: npm ci + - name: Check + run: npm run check + - name: Package + run: npm run package + - name: Build Example Site + run: npm run build diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 8b5a890..06dda42 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,27 +1,27 @@ name: Release to npm on: - release: - types: [created] + release: + types: [created] jobs: - publish-npm: - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - - run: cd packages/svader - - name: Install Dependencies - run: npm ci - - name: Package - run: npm run package - - name: Publish - run: npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + publish-npm: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: cd packages/svader + - name: Install Dependencies + run: npm ci + - name: Package + run: npm run package + - name: Publish + run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.prettierrc b/.prettierrc index ed5987a..0557f6f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -8,5 +8,11 @@ "trailingComma": "all", "bracketSpacing": true, "arrowParens": "avoid", - "endOfLine": "auto" + "endOfLine": "auto", + "overrides": [ + { + "files": "*.yml", + "options": { "tabWidth": 2 } + } + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f89ed5f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.formatOnSave": true +} diff --git a/package-lock.json b/package-lock.json index 3d82a05..5b38e4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "devDependencies": { "@playwright/test": "^1.48.1", "@types/node": "^22.7.9", + "prettier": "^3.3.3", "prettier-plugin-svelte": "^3.2.7" } }, @@ -1691,7 +1692,6 @@ "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "license": "MIT", - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, diff --git a/package.json b/package.json index 456225f..ee9078d 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "package": "cd packages/svader && npm run package", "dev:v4": "npm run package && cd packages/tests-svelte4 && npm run dev", "preview:v4": "npm run package && cd packages/tests-svelte4 && npm run preview", - "check": "npm run package && npm run check:svader && npm run check:tests-svelte4", + "check": "npm run package && npm run check:formatting && npm run check:svader && npm run check:tests-svelte4", + "check:formatting": "prettier . --check", "check:svader": "cd packages/svader && npm run check", "check:tests-svelte4": "cd packages/tests-svelte4 && npm run check", "build": "npm run package && npm run build:tests-svelte4", @@ -18,6 +19,7 @@ "devDependencies": { "@playwright/test": "^1.48.1", "@types/node": "^22.7.9", + "prettier": "^3.3.3", "prettier-plugin-svelte": "^3.2.7" } }