-
Notifications
You must be signed in to change notification settings - Fork 119
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: add bundling/build-cjs.ts
#469
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
462d5a1
build: add `bundling/build-cjs.ts`
wojpawlik 96585d7
refactor: avoid regex
KnorpelSenf 4b1b585
chore: fix ci
KnorpelSenf 83e899d
Merge branch 'main' of github.com:grammyjs/grammY into build-cjs
wojpawlik 8beaebc
chore: update ci
wojpawlik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env -S deno run --no-prompt --allow-read=. --allow-write=out/ | ||
import { | ||
Context, | ||
deno2node, | ||
emit, | ||
ts, | ||
} from "https://deno.land/x/[email protected]/src/mod.ts"; | ||
|
||
const compilerOptions: ts.CompilerOptions = { | ||
"forceConsistentCasingInFileNames": true, | ||
"newLine": ts.NewLineKind.LineFeed, | ||
"noImplicitReturns": true, | ||
"noUnusedParameters": true, | ||
"rootDir": "src/", | ||
"strict": true, | ||
"declaration": true, | ||
"module": ts.ModuleKind.CommonJS, | ||
"outDir": "out/", | ||
"skipLibCheck": true, | ||
"target": ts.ScriptTarget.ES2019, | ||
}; | ||
|
||
const ctx = new Context({ compilerOptions }); | ||
ctx.config = { shim: "src/shim.node.ts" }; | ||
|
||
console.time("Loading source files"); | ||
ctx.project.addSourceFilesAtPaths(Deno.args); | ||
ctx.project.resolveSourceFileDependencies(); | ||
console.timeEnd("Loading source files"); | ||
|
||
await deno2node(ctx); | ||
|
||
console.time("Emitting"); | ||
const diagnostics = await emit(ctx.project); | ||
console.timeEnd("Emitting"); | ||
|
||
if (diagnostics.length !== 0) { | ||
console.info(ctx.project.formatDiagnosticsWithColorAndContext(diagnostics)); | ||
console.info("TypeScript", ts.version); | ||
console.info(`Found ${diagnostics.length} errors.`); | ||
Deno.exit(1); | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,13 @@ | |
"lock": false, | ||
"tasks": { | ||
"check": "deno cache --check=all src/mod.ts", | ||
"backport": "deno run --no-prompt --allow-read=. --allow-write=. https://deno.land/x/[email protected]/src/cli.ts tsconfig.json", | ||
"contribs": "npx --yes all-contributors-cli@6", | ||
"backport": "deno run --no-prompt --allow-read=. --allow-write=out/ bundling/build-cjs.ts src/mod.ts", | ||
"test": "deno test --seed=123456 --parallel ./test/", | ||
"dev": "deno fmt && deno lint && deno task test && deno task check", | ||
"coverage": "rm -rf ./test/cov_profile && deno task test --coverage=./test/cov_profile && deno coverage --lcov --output=./coverage.lcov ./test/cov_profile", | ||
"report": "genhtml ./coverage.lcov --output-directory ./test/coverage/ && echo 'Point your browser to test/coverage/index.html to see the test coverage report.'", | ||
"bundle": "cd bundling && ./bundle-all.sh", | ||
"bundle-web": "mkdir -p out deno_cache && cd bundling && DENO_DIR=$PWD/../deno_cache deno run --unstable --quiet --allow-net --allow-read --allow-env=DENO_DIR,XDG_CACHE_HOME,HOME,DENO_AUTH_TOKENS --allow-write=../out,$PWD/../deno_cache bundle-web.ts dev ../src/mod.ts", | ||
"contribs": "deno run --allow-env --allow-read --allow-write=. --allow-net=api.github.com npm:all-contributors-cli" | ||
"bundle-web": "mkdir -p out deno_cache && deno run --quiet --allow-net --allow-read --allow-env=DENO_DIR,XDG_CACHE_HOME,HOME,DENO_AUTH_TOKENS--allow-write=out/,deno_cache/ bundling/bundle-web.ts dev src/mod.ts" | ||
}, | ||
"fmt": { | ||
"indentWidth": 4, | ||
|
@@ -19,7 +18,6 @@ | |
"./node_modules/", | ||
"./out/", | ||
"./package-lock.json", | ||
"./bundling/bundles", | ||
"./test/cov_profile" | ||
] | ||
}, | ||
|
@@ -28,8 +26,7 @@ | |
"./deno_cache/", | ||
"./node_modules/", | ||
"./out/", | ||
"./package-lock.json", | ||
"./bundling/bundles" | ||
"./package-lock.json" | ||
] | ||
} | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Accidentally removed this while resolving conflicts 🙈 pin to a major release and tighten permission when restoring.