Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sync_objectscript_corpus() {

# Replace objectscript corpus with the union of source corpora.
find "$target_dir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
for src_dir in core/test/corpus udl/test/corpus objectscript_routine/test/corpus; do
for src_dir in udl/test/corpus objectscript_routine/test/corpus; do
find "$src_dir" -mindepth 1 -maxdepth 1 -exec cp -a {} "$target_dir"/ \;
done

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-2022, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v6
Expand Down
158 changes: 158 additions & 0 deletions .github/workflows/package-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: Publish package (npm)

on:
workflow_call:
inputs:
package-name:
description: The name of the package
default: ${{github.event.repository.name}}
type: string
environment-name:
description: The name of the environment
default: npm
type: string
node-version:
description: The NodeJS version
default: ${{vars.NODE_VERSION || '22'}}
type: string
emscripten-version:
description: The Emscripten version
default: ${{vars.EMSCRIPTEN_VERSION || '3.1.64'}}
type: string
generate:
description: Generate the parser artifacts
default: false
type: boolean
abi-version:
description: The tree-sitter ABI version
default: "15"
type: string
attestations:
description: Generate attestations for the package
default: false
type: boolean
secrets:
NODE_AUTH_TOKEN:
description: An authentication token for npm
required: true

defaults:
run:
shell: bash

jobs:
build_wasm:
name: Build Wasm binaries
runs-on: ubuntu-24.04
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up NodeJS
uses: actions/setup-node@v6
with:
cache: npm
node-version: ${{inputs.node-version}}
- name: Set up Emscripten
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{inputs.emscripten-version}}
- name: Install dependencies
run: npm i --omit peer --omit optional
- name: Regenerate parser
if: ${{inputs.generate}}
run: |
while read -r grammar; do
grammar_dir=$(dirname "$grammar")
cd "$grammar_dir"
npm x -- tree-sitter generate
cd - > /dev/null
done < <(find . -name grammar.js -not -path './node_modules/*' -not -path './.build/*')
env:
TREE_SITTER_ABI_VERSION: ${{inputs.abi-version}}
- name: Build Wasm binaries
run: |-
while read -r grammar; do
npm x -- tree-sitter build --wasm "${grammar%/grammar.js}"
done < <(find . -name grammar.js -not -path './node_modules/*')
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
path: "*.wasm"
name: prebuilds-wasm
retention-days: 2

build_node:
name: Build NodeJS binaries on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os:
# windows-2025 currently ships VS 2026, which node-gyp 11.x cannot detect.
- windows-2022
- windows-11-arm
- ubuntu-24.04
- ubuntu-24.04-arm
- macos-15
- macos-15-intel
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up NodeJS
uses: actions/setup-node@v6
with:
cache: npm
node-version: ${{inputs.node-version}}
- name: Install dependencies
run: npm i --omit peer --omit optional
- name: Regenerate parser
if: ${{inputs.generate}}
shell: bash
run: |
while read -r grammar; do
grammar_dir=$(dirname "$grammar")
cd "$grammar_dir"
npm x -- tree-sitter generate
cd - > /dev/null
done < <(find . -name grammar.js -not -path './node_modules/*' -not -path './.build/*')
- name: Build binary
run: npm x -- prebuildify -t 20.19.5
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
path: prebuilds/**
name: prebuilds-${{matrix.os}}
retention-days: 2

package:
name: Publish NodeJS package
needs: [build_wasm, build_node]
runs-on: ubuntu-24.04
environment:
name: ${{inputs.environment-name}}
url: https://www.npmjs.com/package/${{inputs.package-name}}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up NodeJS
uses: actions/setup-node@v6
with:
cache: npm
node-version: ${{inputs.node-version}}
registry-url: https://registry.npmjs.org/
- name: Download binaries
uses: actions/download-artifact@v5
with:
path: prebuilds
pattern: prebuilds-*
merge-multiple: true
- name: Check binaries
run: tree prebuilds
- name: Move Wasm binaries to root
continue-on-error: true
run: mv -v prebuilds/*.wasm .
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
NPM_CONFIG_PROVENANCE: ${{inputs.attestations}}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
generate: true
npm:
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@31a611b89757509757378e3d94f28a41a782d9df
uses: ./.github/workflows/package-npm.yml
with:
generate: true
secrets:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ udl/parser.lib

.tabnine/

local_tests/
temp_storing/
2 changes: 1 addition & 1 deletion CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

137 changes: 62 additions & 75 deletions bindings/python/tree_sitter_objectscript/queries/highlights.scm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading