From ed6cbfd0ad72e9ff2f54b5b465a5a174a7af72eb Mon Sep 17 00:00:00 2001 From: qvalentin Date: Tue, 14 Jan 2025 11:45:16 +0100 Subject: [PATCH 1/4] ci: fail if generated files do not match --- .github/workflows/ci.yaml | 44 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e9ca1fe..759e2ae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,23 +1,27 @@ name: Build/test on: - push: - branches: - - "master" - pull_request: + push: + branches: + - 'master' + pull_request: jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: [macos-latest, ubuntu-latest] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - uses: actions/setup-node@v3 - with: - node-version: '18' - - run: npm install - - run: npm test + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [macos-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - uses: actions/setup-node@v3 + with: + node-version: '18' + - run: npm install + - name: generate grammar + run: npm run build + - name: check for uncommited changes + run: git diff --exit-code + - run: npm test From b0f5b4df63b8550d8b385ee514a7abdc11311bcc Mon Sep 17 00:00:00 2001 From: qvalentin Date: Wed, 15 Jan 2025 20:03:01 +0100 Subject: [PATCH 2/4] ci: add prettier --- package-lock.json | 17 +++++++++++++++++ package.json | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index c9b7433..9bfcc97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "nan": "^2.22.0" }, "devDependencies": { + "prettier": "^3.4.2", "tree-sitter-cli": "^0.24.7" } }, @@ -21,6 +22,22 @@ "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==", "license": "MIT" }, + "node_modules/prettier": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/tree-sitter-cli": { "version": "0.24.7", "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.24.7.tgz", diff --git a/package.json b/package.json index 3da5959..da9b1d7 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "nan": "^2.22.0" }, "devDependencies": { - "tree-sitter-cli": "^0.24.7" + "tree-sitter-cli": "^0.24.7", + "prettier": "^3.4.2" }, "scripts": { "build": "tree-sitter generate && node-gyp build && npm run build-helm", From 4a12a251a7becb0573be3bf5a2c2939103f7289c Mon Sep 17 00:00:00 2001 From: qvalentin Date: Tue, 14 Jan 2025 17:30:07 +0100 Subject: [PATCH 3/4] ci: add prettier --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 759e2ae..62ecfa6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,3 +25,8 @@ jobs: - name: check for uncommited changes run: git diff --exit-code - run: npm test + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: npx prettier --check *.js From a0acee24a60e542bce537c139412220577928863 Mon Sep 17 00:00:00 2001 From: qvalentin Date: Tue, 14 Jan 2025 17:31:28 +0100 Subject: [PATCH 4/4] chore: format grammar.js --- grammar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grammar.js b/grammar.js index 3617a7d..bfd33d1 100644 --- a/grammar.js +++ b/grammar.js @@ -1,3 +1,3 @@ -const make_grammar = require('./make_grammar'); +const make_grammar = require('./make_grammar') -module.exports = make_grammar('gotmpl'); +module.exports = make_grammar('gotmpl')