Skip to content

Commit 9bf78af

Browse files
committed
Generate ts antlr code and create a new npm workspace package for it
1 parent 6e6f6ba commit 9bf78af

File tree

6 files changed

+199
-3
lines changed

6 files changed

+199
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ frontend/.postinstall
4444
lib/gen/*/*/*.go
4545
lib/gen/*/*/*.ts
4646
lib/gen/featuresearch/**
47+
lib/gen/antlrv4/ts-antlrv4/antlr/**
4748

4849
# Ignore coverage files
4950
coverage

Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,17 @@ node-test: playwright-install
247247
################################
248248
# ANTLR
249249
################################
250-
antlr-gen: clean-antlr
250+
antlr-gen: clean-antlr antlr-gen-go antlr-gen-ts
251+
252+
antlr-gen-go:
251253
java -jar /usr/local/lib/antlr-$${ANTLR4_VERSION}-complete.jar -Dlanguage=Go -o lib/gen/featuresearch/parser -visitor -no-listener antlr/FeatureSearch.g4
252254

255+
antlr-gen-ts:
256+
java -jar /usr/local/lib/antlr-$${ANTLR4_VERSION}-complete.jar -Dlanguage=TypeScript -o lib/gen/antlrv4/ts-antlrv4 -visitor antlr/FeatureSearch.g4
257+
253258
clean-antlr:
254259
rm -rf lib/gen/featuresearch/parser
260+
rm -rf lib/gen/antlrv4/ts-antlrv4/antlr
255261

256262
################################
257263
# License
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@webstatus.dev/ts-antlrv4",
3+
"version": "1.0.0",
4+
"description": "TypeScript ANTLR4 generated code for webstatus.dev",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"license": "Apache-2.0",
8+
"scripts": {
9+
"build": "tsc",
10+
"clean": "rimraf dist"
11+
},
12+
"dependencies": {
13+
"antlr4": "^4.13.1"
14+
},
15+
"devDependencies": {
16+
"@types/antlr4": "^4.9.3",
17+
"typescript": "^5.0.0",
18+
"rimraf": "^5.0.0"
19+
}
20+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "ES2020",
5+
"moduleResolution": "node",
6+
"declaration": true,
7+
"outDir": "./dist",
8+
"strict": true,
9+
"esModuleInterop": true,
10+
"skipLibCheck": true,
11+
"forceConsistentCasingInFileNames": true
12+
},
13+
"include": [
14+
"antlr/**/*.ts"
15+
],
16+
"exclude": [
17+
"node_modules",
18+
"dist"
19+
]
20+
}

package-lock.json

+149-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"license": "Apache-2.0",
1010
"workspaces": [
1111
"frontend",
12-
"lib/gen/openapi/ts-webstatus.dev-backend-types"
12+
"lib/gen/openapi/ts-webstatus.dev-backend-types",
13+
"lib/gen/antlrv4/ts-antlrv4"
1314
],
1415
"devDependencies": {
1516
"@playwright/test": "^1.50.1",

0 commit comments

Comments
 (0)