Build with tsc instead of tsup#842
Merged
nene merged 4 commits intosql-formatter-org:masterfrom Mar 18, 2025
Merged
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Collaborator
|
Thanks a whole lot. This looks mighty promising. Too tired today to check
it out. Hopefully will manage tomorrow.
…On Sun, Mar 16, 2025, 19:32 codesandbox-ci[bot] ***@***.***> wrote:
This pull request is automatically built and testable in CodeSandbox
<https://codesandbox.io>.
To see build info of the built libraries, click here
<https://ci.codesandbox.io/status/sql-formatter-org/sql-formatter/pr/842/builds/597741>
or the icon next to each commit SHA.
—
Reply to this email directly, view it on GitHub
<#842 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA43OIPIOMNV6SKEWPUYDT2UWYR5AVCNFSM6AAAAABZD3SD32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRXGU2TKMJZGM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
[image: codesandbox-ci[bot]]*codesandbox-ci[bot]* left a comment
(sql-formatter-org/sql-formatter#842)
<#842 (comment)>
This pull request is automatically built and testable in CodeSandbox
<https://codesandbox.io>.
To see build info of the built libraries, click here
<https://ci.codesandbox.io/status/sql-formatter-org/sql-formatter/pr/842/builds/597741>
or the icon next to each commit SHA.
—
Reply to this email directly, view it on GitHub
<#842 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA43OIPIOMNV6SKEWPUYDT2UWYR5AVCNFSM6AAAAABZD3SD32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRXGU2TKMJZGM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
[ { ***@***.***": "http://schema.org", ***@***.***": "EmailMessage",
"potentialAction": { ***@***.***": "ViewAction", "target": "
#842 (comment)",
"url": "
#842 (comment)",
"name": "View Pull Request" }, "description": "View this Pull Request on
GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "
https://github.com" } } ]
|
nene
reviewed
Mar 18, 2025
| "pre-commit": "npm-run-all --parallel ts:changes lint:changes", | ||
| "grammar": "nearleyc src/parser/grammar.ne -o src/parser/grammar.ts", | ||
| "build:tsup": "tsup src/index.ts --format cjs,esm --sourcemap --dts", | ||
| "build:cjs": "tsc -p tsconfig.cjs.json && echo \"{\"type\": \"commonjs\"}\" > dist/cjs/package.json", |
Collaborator
There was a problem hiding this comment.
Hmm... I think this doesn't work quite as intended. I generates a file containing:
{type: commonjs}
which isn't valid JSON. I tweaked it a bit: 14e5daf
Contributor
Author
There was a problem hiding this comment.
Great catch! Sorry about that.
Collaborator
|
So I merged this in and released as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As reported in #836 (comment), my previous changes from #670 broke the ability for this package to be tree-shaken.
This PR takes the other approach I had proposed in #604: it runs
tsctwice, once to produce a CJS build and once to produce an ESM one. It writes apackage.jsonfile containing{"type": "commonjs"}todist/cjs/package.jsonso that the files in that directory are treated as CJS.Since #670 introduced an
exportsfield, the internal changes to paths shouldn't be visible to consumers, so this should be safe to release as a patch or minor version. That said, I wouldn't blame you if you wanted to release this as a major version to play it safe.