From b7e437c602704b9759a47e847fa844b848ac7bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20G=C3=B6rlich?= <73133626+koilebeit@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:04:14 +0200 Subject: [PATCH] add ci.yml (#149) * add ci.yml * configure ref and repository * use node v22 * add .prettierignore * update ci.yml * add package-lock * add scripts to run prettier locally * format not all files --- .github/workflows/ci.yml | 29 +++++++++++++ .prettierignore | 5 +++ .prettierrc | 11 +++++ package-lock.json | 94 ++++++++++++++++++++++++++++++++++++++++ package.json | 10 +++++ 5 files changed, 149 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..00834444 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: Continuous Integration + +on: + pull_request: + branches: [main] + +jobs: + prettier: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' # Specify the Node.js version you want + + - name: Install Dependencies + run: npm ci # Using npm ci for a clean install based on package-lock.json + + - name: Check Formatting + run: npx prettier --check "**/*.{js,css,md,html}" \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..67d93db6 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +_data/** +_plugins/** +_site/** +assets/** +objects/** diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..4d83a58f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "plugins": ["@shopify/prettier-plugin-liquid"], + "overrides": [ + { + "files": "*.html", + "options": { + "parser": "liquid-html" + } + } + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..a9f328cc --- /dev/null +++ b/package-lock.json @@ -0,0 +1,94 @@ +{ + "name": "forschung.stadtgeschichtebasel.ch", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@shopify/prettier-plugin-liquid": "^1.5.0" + } + }, + "node_modules/@shopify/liquid-html-parser": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@shopify/liquid-html-parser/-/liquid-html-parser-2.0.3.tgz", + "integrity": "sha512-aIkZ5TJWG7/ztd1sZm5XNpBNTG3B+Q0gv3WN/QahmNQzm2wmKYSHiRLOA8JALAnOGTmH0uqOJ7jzdqoATcZSxw==", + "dev": true, + "dependencies": { + "line-column": "^1.0.2", + "ohm-js": "^16.3.0" + } + }, + "node_modules/@shopify/liquid-html-parser/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/@shopify/liquid-html-parser/node_modules/isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA==", + "dev": true, + "dependencies": { + "isarray": "1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@shopify/liquid-html-parser/node_modules/line-column": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/line-column/-/line-column-1.0.2.tgz", + "integrity": "sha512-Ktrjk5noGYlHsVnYWh62FLVs4hTb8A3e+vucNZMgPeAOITdshMSgv4cCZQeRDjm7+goqmo6+liZwTXo+U3sVww==", + "dev": true, + "dependencies": { + "isarray": "^1.0.0", + "isobject": "^2.0.0" + } + }, + "node_modules/@shopify/liquid-html-parser/node_modules/ohm-js": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/ohm-js/-/ohm-js-16.6.0.tgz", + "integrity": "sha512-X9P4koSGa7swgVQ0gt71UCYtkAQGOjciJPJAz74kDxWt8nXbH5HrDOQG6qBDH7SR40ktNv4x61BwpTDE9q4lRA==", + "dev": true, + "engines": { + "node": ">=0.12.1" + } + }, + "node_modules/@shopify/prettier-plugin-liquid": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@shopify/prettier-plugin-liquid/-/prettier-plugin-liquid-1.5.0.tgz", + "integrity": "sha512-CuWjUnBCvq/RTmubEa5RfwW2oP2gYfTXaJ39t4apAYm//1v5Ftvv1bbhEnoEZwCjPshaAJLhSzP9dvCel4cebw==", + "dev": true, + "dependencies": { + "@shopify/liquid-html-parser": "^2.0.3", + "html-styles": "^1.0.0" + }, + "peerDependencies": { + "prettier": "^2.0.0 || ^3.0.0" + } + }, + "node_modules/html-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/html-styles/-/html-styles-1.0.0.tgz", + "integrity": "sha512-cDl5dcj73oI4Hy0DSUNh54CAwslNLJRCCoO+RNkVo+sBrjA/0+7E/xzvj3zH/GxbbBLGJhE0hBe1eg+0FINC6w==", + "dev": true + }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "peer": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..828d8062 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "scripts": { + "check": "prettier --check '**/*.{js,css,md,html}'", + "format": "prettier --write '**/*.{js,css,md,html}'" + }, + "dependencies": { + "prettier": "^3.3.3", + "@shopify/prettier-plugin-liquid": "^1.5.0" + } +}