-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: modular assembly #196
Changes from 10 commits
3f5294f
b3739c9
c4abf53
888fb5b
cdaab1e
54eef33
c4deb1a
411d654
834809d
20bdbee
21120d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ node_modules | |
|
||
# Artifacts | ||
dist | ||
dist-types | ||
|
||
.ds_store | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import {build} from 'esbuild'; | ||
|
||
build({ | ||
entryPoints: ['src/index.ts'], | ||
external: ['antlr4ng', 'antlr4-c3'], | ||
bundle: true, | ||
minify: true, | ||
keepNames: true, | ||
format: 'esm', | ||
outfile: 'dist/index.js', | ||
tsconfig: './tsconfig.build.json', | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type | ||
roberthovsepyan marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure there's no way to do write it differently? If not, at least write a comment explaining why you need to disable it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the script has been rewritten, there is no more comment |
||
(async () => { | ||
const databases = ['clickhouse', 'mysql', 'postgresql', 'yql']; | ||
|
||
for (const database of databases) { | ||
await build({ | ||
external: ['antlr4ng', 'antlr4-c3'], | ||
bundle: true, | ||
minify: true, | ||
keepNames: true, | ||
format: 'esm', | ||
tsconfig: './tsconfig.build.json', | ||
entryPoints: [`src/autocomplete/databases/${database}/index.ts`], | ||
outfile: `dist/databases/${database}/index.js`, | ||
}); | ||
} | ||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,31 @@ | |
"files": [ | ||
"dist/*" | ||
], | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
"./clickhouse": "./dist/databases/clickhouse/index.js", | ||
"./mysql": "./dist/databases/mysql/index.js", | ||
"./postgresql": "./dist/databases/postgresql/index.js", | ||
"./yql": "./dist/databases/yql/index.js" | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modular export |
||
"typesVersions": { | ||
"*": { | ||
"clickhouse": [ | ||
"./dist/types/databases/clickhouse/index.d.ts" | ||
], | ||
"mysql": [ | ||
"./dist/types/databases/mysql/index.d.ts" | ||
], | ||
"yql": [ | ||
"./dist/types/databases/yql/index.d.ts" | ||
], | ||
"postgresql": [ | ||
"./dist/types/databases/postgresql/index.d.ts" | ||
], | ||
"shared": [ | ||
"./dist/types/shared/index.d.ts" | ||
] | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=16.0" | ||
}, | ||
|
@@ -33,7 +56,7 @@ | |
"generate:clickhouse": "rimraf src/autocomplete/databases/clickhouse/generated && antlr4ng -Dlanguage=TypeScript -o src/autocomplete/databases/clickhouse/generated/ -visitor -no-listener -Xexact-output-dir src/autocomplete/databases/clickhouse/grammar/ClickHouseLexer.g4 src/autocomplete/databases/clickhouse/grammar/ClickHouseParser.g4 && bash scripts/patch-generated.sh clickhouse", | ||
"generate:yql": "rimraf src/autocomplete/databases/yql/generated && antlr4ng -Dlanguage=TypeScript -o src/autocomplete/databases/yql/generated/ -visitor -no-listener -Xexact-output-dir src/autocomplete/databases/yql/grammar/YQL.g4 && bash scripts/patch-generated.sh yql", | ||
"test": "node --experimental-vm-modules ./node_modules/.bin/jest --verbose src", | ||
"build": "rimraf dist && node build.js && tsc -p tsconfig.build.json", | ||
"build": "rimraf dist && node build.js && tsc -p tsconfig.build.json --declarationDir dist/types", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"devDependencies": { | ||
|
@@ -49,6 +72,7 @@ | |
"antlr4ng-cli": "^2.0.0", | ||
"esbuild": "^0.20.0", | ||
"eslint-plugin-filenames": "^1.3.2", | ||
"eslint-plugin-import": "^2.29.1", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"nano-staged": "^0.8.0", | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint rule for blocking cross imports