Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
**/*.min.js
dist/**
src/alasqlparser.js
6 changes: 6 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: "CodeQL config"

paths-ignore:
- examples/
- modules/
- test/
42 changes: 18 additions & 24 deletions .github/workflows/Build and test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ jobs:

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Node
uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
with:
node-version: '24.x'
- name: Setup Bun
uses: useblacksmith/setup-bun@main

- name: Install dependencies
run: yarn install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Verify formatting
run: yarn test-format-all
run: bun test-format

build:
name: Build from source files
Expand All @@ -47,16 +45,14 @@ jobs:

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Node
uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
with:
node-version: '24.x'
- name: Setup Bun
uses: useblacksmith/setup-bun@main

- name: Install dependencies
run: yarn install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Build project
run: yarn build-only
run: bun run build

- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
Expand All @@ -77,9 +73,6 @@ jobs:
contents: read
needs: [build, verify-formatting]
runs-on: blacksmith-4vcpu-ubuntu-2204
strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x, 24.x] # Dropped '23.x' (EOL) and 'latest' for stability
steps:
- name: Harden Runner
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
Expand All @@ -88,10 +81,8 @@ jobs:

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Node
uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
with:
node-version: ${{ matrix.node-version }}
- name: Setup Bun
uses: useblacksmith/setup-bun@main

- uses: actions/download-artifact@f093f21ca4cfa7c75ccbbc2be54da76a0c7e1f05 # master
with:
Expand All @@ -107,7 +98,7 @@ jobs:
run: tar -xvf node_modules.tar

- name: Run test suite
run: yarn test-only
run: bun test-only

test-suite-browser:
name: Test suite for Browser
Expand All @@ -132,7 +123,7 @@ jobs:
run: echo '::warning ::Not able to automate browser tests yet'

- name: Run browser tests (disabled)
run: '# yarn test-browser-ci'
run: '# yabunrn test-browser-ci'

verify-parser:
name: Verify grammar vs generated parser
Expand All @@ -146,6 +137,9 @@ jobs:
with:
egress-policy: audit

- name: Setup Bun
uses: useblacksmith/setup-bun@main

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
Expand All @@ -160,9 +154,9 @@ jobs:
# This step only runs if the jison file changed
if: steps.detect-changes.outputs.any_changed == 'true'
run: |
yarn install --frozen-lockfile
yarn jison
yarn test
bun install --frozen-lockfile
bun run jison
bun run test

- name: Check generated parser for changes
if: steps.detect-changes.outputs.any_changed == 'true'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: github/codeql-action/init@1d9f357d018e5801d9d25e32220badc298aa1c17
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml

- name: Autobuild
uses: github/codeql-action/autobuild@1d9f357d018e5801d9d25e32220badc298aa1c17
Expand Down
57 changes: 57 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"formatter": {
"formatWithErrors": true,
"indentStyle": "tab",
"lineWidth": 100,
"bracketSpacing": false
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "es5",
"arrowParentheses": "asNeeded"
}
},
"json": {
"formatter": { "indentStyle": "tab" }
},
"linter": {
"enabled": true,
"rules": {
"correctness": {
"recommended": true
},
"suspicious": {
"recommended": true
},
"style": {
"recommended": true
},
"complexity": {
"recommended": true
}
}
},
"files": {
"include": [
"src/**/*.js",
"src/**/*.ts",
"test/**/*.js",
"test/**/*.ts",
"package.json",
"tsconfig.json",
"biome.json"
],
"ignore": [
"dist/",
"node_modules",
"test/coverage/",
"test/lib/",
"modules/",
"*start.js",
"*finish.js",
"97saveas.js",
"alasqlparser.js"
]
}
}
26 changes: 6 additions & 20 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
#!/bin/sh

rm -fr dist/
mkdir dist/

if ! command -v "rexreplace" > /dev/null 2>&1; then
echo "\nSpeed up the process by having rexreplace installed globally"
echo "> npm install -g rexreplace"
fi

if ! command -v "esbuild" > /dev/null 2>&1; then
echo "\nSpeed up the process by having esbuild installed globally"
echo "> npm install -g esbuild"
fi


# Run comands via x to avoid npx overhead if the command is installed globally (3.27x slower)
x() {
local cmd="$1"
shift
if command -v "$cmd" > /dev/null 2>&1; then
"$cmd" "$@" # Run the command with all remaining arguments
else
npx "$cmd" "$@" # Use npx to run the command with all remaining arguments
fi
bun --bun run "./node_modules/.bin/$cmd" "$@"
}

branch=$(git rev-parse --abbrev-ref HEAD | rexreplace '[^0-9a-z-]' '.' | rexreplace '^[^0-9a-z]+|[^0-9a-z]+$' '')
Expand Down Expand Up @@ -162,7 +148,7 @@ x rexreplace '/*only-for-browser/*' '//*only-for-browser/*' -L -q $outfile
echo '# Support "use strict in jison output" ' # https://github.com/zaach/jison/pull/373
x rexreplace 'function locateNearestErrorRecoveryRule(state) {' 'var locateNearestErrorRecoveryRule = function (state) {' -L -q $outfile

x esbuild --minify --outfile="$outfile_min" "$outfile" --allow-overwrite
bun build --minify --outfile="$outfile_min" "$outfile" --external '*'

#first_line=$(head -n 1 $outfile)
#x rexreplace '^' "c = 'first_line'; c.match(/^\/\//) ? c : ''" -j -M $outfile_min
Expand All @@ -176,7 +162,7 @@ echo '\nBuild precompile files'
mkdir -p dist/precompile

echo '# Copy precompile module'
x esbuild --outfile="dist/precompile/index.js" "src/precompile/index.js" --format=cjs
bun build --outfile="dist/precompile/index.js" "src/precompile/index.js" --format=cjs --external '*'



Expand All @@ -200,7 +186,7 @@ echo '# Inject build version'
x rexreplace 'BUILD_VERSION' "['$branch','$commit'].filter(Boolean).join('-')" -j -q $outfile

echo '# Prepare min version'
x esbuild --minify --outfile="$outfile_min" "$outfile" --allow-overwrite
bun build --minify --outfile="$outfile_min" "$outfile" --external '*'

#first_line=$(head -n 1 $outfile)
#x rexreplace '^' "c = 'first_line'; c.match(/^\/\//) ? c : ''" -j -M $outfile_min
Expand Down
Loading
Loading