Skip to content

Commit a250a90

Browse files
authored
Improvements and support for 3.0 syntax (#15)
1 parent 42e953f commit a250a90

File tree

15 files changed

+1476
-2881
lines changed

15 files changed

+1476
-2881
lines changed

.github/workflows/check.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v3
1616

17-
- name: Install Node.js
18-
uses: actions/setup-node@v3
19-
with:
20-
node-version: 20
17+
- name: Setup bun
18+
uses: oven-sh/setup-bun@v2
19+
with:
20+
bun-version: 1.2.21
2121

22-
- name: Install pnpm
23-
uses: pnpm/action-setup@v2
24-
with:
25-
version: 9
26-
27-
- name: Build packages
28-
run: pnpm install --frozen-lockfile && pnpm build
22+
- name: Build packages
23+
run: bun install && bun run build
2924

30-
- name: Run tests
31-
run: pnpm test
25+
- name: Run tests
26+
run: bun run test

.github/workflows/publish.yml

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,50 @@ name: Publish Packages to npmjs
33
on:
44
push:
55
tags:
6-
- '*'
6+
- "*"
77

88
jobs:
99
build:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v3
14-
15-
- name: Install Node.js
16-
uses: actions/setup-node@v3
17-
with:
18-
node-version: 20
19-
registry-url: "https://registry.npmjs.org"
20-
21-
- name: Install pnpm
22-
uses: pnpm/action-setup@v2
23-
with:
24-
version: 9
25-
26-
- name: Extract versions
27-
run: |
28-
echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
29-
echo "CM_VERSION=$(node -p "require('./packages/codemirror-surrealql/package.json').version")" >> $GITHUB_ENV
30-
echo "LZ_VERSION=$(node -p "require('./packages/lezer-surrealql/package.json').version")" >> $GITHUB_ENV
31-
32-
- name: Assert package versions
33-
run: |
34-
echo "CM_VERSION=$CM_VERSION"
35-
echo "LZ_VERSION=$LZ_VERSION"
36-
echo "GIT_TAG=$GIT_TAG"
37-
38-
if [[ "v$CM_VERSION" != "$GIT_TAG" || "v$LZ_VERSION" != "$GIT_TAG" ]]; then
39-
echo "Version mismatch! Please correct package versions"
40-
exit 1
41-
else
42-
echo "Version check complete"
43-
fi
44-
45-
- name: Build packages
46-
run: pnpm install --frozen-lockfile && pnpm build
47-
48-
- name: Run tests
49-
run: pnpm test
50-
51-
- name: Publish
52-
run: pnpm publish -r --no-git-checks --access public
53-
env:
54-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13+
- uses: actions/checkout@v3
14+
15+
- name: Setup bun
16+
uses: oven-sh/setup-bun@v2
17+
with:
18+
bun-version: 1.2.21
19+
20+
- name: Extract versions
21+
run: |
22+
echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
23+
echo "CM_VERSION=$(node -p "require('./packages/codemirror-surrealql/package.json').version")" >> $GITHUB_ENV
24+
echo "LZ_VERSION=$(node -p "require('./packages/lezer-surrealql/package.json').version")" >> $GITHUB_ENV
25+
26+
- name: Assert package versions
27+
run: |
28+
echo "CM_VERSION=$CM_VERSION"
29+
echo "LZ_VERSION=$LZ_VERSION"
30+
echo "GIT_TAG=$GIT_TAG"
31+
32+
if [[ "v$CM_VERSION" != "$GIT_TAG" || "v$LZ_VERSION" != "$GIT_TAG" ]]; then
33+
echo "Version mismatch! Please correct package versions"
34+
exit 1
35+
else
36+
echo "Version check complete"
37+
fi
38+
39+
- name: Build packages
40+
run: bun install && bun run build
41+
42+
- name: Run tests
43+
run: bun run test
44+
45+
- name: Setup NPM authentication
46+
run: |
47+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
48+
49+
- name: Publish all packages
50+
run: bun run deploy
51+
env:
52+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ dist
3636
# -----------------------------------
3737

3838
*.db
39+
.turbo/

bun.lock

Lines changed: 564 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@
33
"workspaces": ["packages/*"],
44
"private": true,
55
"scripts": {
6-
"test": "cd packages/lezer-surrealql && pnpm test",
7-
"build": "cd packages/lezer-surrealql && pnpm build && cd ../codemirror-surrealql && pnpm build",
6+
"test": "turbo run-tests",
7+
"build": "turbo build",
88
"dev": "vite",
9+
"deploy": "turbo deploy",
910
"lint:check": "biome check . --formatter-enabled=false",
1011
"lint:apply": "biome check . --formatter-enabled=false --write",
1112
"lint:apply:unsafe": "biome check . --formatter-enabled=false --write --unsafe"
1213
},
1314
"devDependencies": {
1415
"@biomejs/biome": "^1.9.4",
1516
"vite": "^5.4.11",
17+
"turbo": "^2.5.6",
1618
"@codemirror/language": "^6.10.3",
1719
"@codemirror/commands": "^6.7.1",
1820
"@codemirror/autocomplete": "^6.18.2",
1921
"@codemirror/view": "^6.34.2",
2022
"@codemirror/state": "^6.4.1",
2123
"@lezer/highlight": "^1.2.1"
22-
}
24+
},
25+
"packageManager": "bun@1.2.19"
2326
}

packages/codemirror-surrealql/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "@surrealdb/codemirror",
3-
"version": "1.0.0-beta.21",
3+
"version": "1.0.0-beta.22",
44
"author": "SurrealDB",
55
"description": "SurrealQL language support for CodeMirror",
66
"type": "module",
77
"scripts": {
88
"build": "cm-buildhelper src/surrealql.ts",
9-
"test": "cm-runtests"
9+
"run-tests": "cm-runtests",
10+
"deploy": "bun publish --access public"
1011
},
1112
"main": "dist/index.cjs",
1213
"exports": {

packages/lezer-surrealql/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
22
"name": "@surrealdb/lezer",
3-
"version": "1.0.0-beta.21",
3+
"version": "1.0.0-beta.22",
44
"author": "SurrealDB",
55
"description": "SurrealQL grammar for Lezer",
66
"type": "module",
77
"types": "dist/typing.d.ts",
88
"module": "dist/index.js",
99
"main": "dist/index.cjs",
1010
"exports": {
11+
"types": "./dist/typing.d.ts",
1112
"import": "./dist/index.js",
12-
"require": "./dist/index.cjs",
13-
"types": "./dist/typing.d.ts"
13+
"require": "./dist/index.cjs"
1414
},
1515
"scripts": {
1616
"build": "lezer-generator src/surrealql.grammar -o src/parser.js && rollup -c",
1717
"build-debug": "lezer-generator src/surrealql.grammar -o src/parser.js --names && rollup -c",
18-
"prepack": "pnpm build",
19-
"test": "node test/test-surrealql.js"
18+
"run-tests": "bun run test/test-surrealql.js",
19+
"deploy": "bun publish --access public"
2020
},
2121
"dependencies": {
2222
"@lezer/highlight": "^1.2.1",

packages/lezer-surrealql/src/highlight.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export const surqlHighlighting = styleTags({
2222
"SyntaxDescribe": t.typeName,
2323
"Distance Filter Tokenizer Literal IndexTypeClause AnalyzerTokenizer TokenType HttpMethod!": t.literal,
2424
"RecordTbIdent RecordIdIdent RecordIdString!": t.className,
25-
"Operator! RangeOp ArrowLeft ArrowRight ArrowBoth": t.operator,
25+
"Operator! RangeOp LookupLeft LookupRight LookupBoth": t.operator,
2626
"Regex": t.regexp,
2727
});

packages/lezer-surrealql/src/parser.js

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)