-
Notifications
You must be signed in to change notification settings - Fork 237
Add check to make sure newly compiled dts versions work in downstream projects with older typescript versions #1761
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
Draft
1egoman
wants to merge
5
commits into
main
Choose a base branch
from
uint8array-ci-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d086f62
feat: add validate-dts-against-old-typescript task to validate packag…
1egoman aedcc8b
feat: add github workflow to execute validate-dts-against-old-typescr…
1egoman d304e0f
docs: add note to top of validate-dts-against-old-typescript script
1egoman 1c76d71
fix: add recommended permissions contents read key
1egoman edb71d3
fix: make tsconfig uadjustments to get library build errors to show up
1egoman 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
25 changes: 25 additions & 0 deletions
25
.github/workflows/validate-dts-against-old-typescript.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: 'validate-dts-against-old-typescript' | ||
| permissions: | ||
| contents: read | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
| jobs: | ||
| validate-dts-against-old-typescript: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| CI_JOB_NUMBER: 1 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: pnpm/action-setup@v4 | ||
| - name: Use Node.js 24 | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24 | ||
| cache: 'pnpm' | ||
| - name: Install dependencies | ||
| run: pnpm install | ||
| - name: Validates that livekit-client can be parsed in a typescript 4.8 project | ||
| run: pnpm validate-dts-against-old-typescript 4.8 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,4 +113,7 @@ pkg/ | |
| bin/ | ||
| examples/**/build/ | ||
|
|
||
| .env.local | ||
| # dts validation task working directory | ||
| dts-validation/ | ||
|
|
||
| .env.local | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/bash | ||
| # Runs a check to make sure that a given version of livekit-client can be used in a downstream project | ||
| # which is configured with an older version typescript. | ||
| # | ||
| # In theory, downlevel-dts should handle this, but there has been at least one breaking typing | ||
| # change in the past which downlevel-dts has been unable to patch over | ||
| # (more info: https://github.com/livekit/client-sdk-js/pull/1668) so this serves as a mechanism to | ||
| # catch cases like this in the future before they are reported by users. | ||
|
|
||
| TYPESCRIPT_VERSION=${1:-"4.8"} | ||
|
|
||
| echo "# Performing clean build of livekit-client library..." | ||
| pnpm build:clean | ||
|
|
||
| echo "# Instantiating dts-validation working directory..." | ||
| rm -rf dts-validation | ||
| mkdir dts-validation | ||
| cd dts-validation | ||
|
|
||
| pnpm init | ||
| pnpm install typescript@${TYPESCRIPT_VERSION} | ||
| pnpm install ../ | ||
|
|
||
| echo "import 'livekit-client';" > index.ts | ||
| cat <<EOF > tsconfig.json | ||
| { | ||
| "compilerOptions": { | ||
| "types": ["sdp-transform", "ua-parser-js", "events", "dom-mediacapture-record"], | ||
| "target": "ES2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, | ||
| "module": "ES2020" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, | ||
| "lib": [ | ||
| "DOM", | ||
| "DOM.Iterable", | ||
| "ES2017", | ||
| "ES2018.Promise", | ||
| "ES2018.AsyncGenerator", | ||
| "ES2020.BigInt", | ||
| "ES2021.WeakRef", | ||
| "ESNext.AsyncIterable" | ||
| ], | ||
| "rootDir": "./", | ||
| "outDir": "dist", | ||
| "declaration": true, | ||
| "declarationMap": true, | ||
| "sourceMap": true, | ||
| "strict": true /* Enable all strict type-checking options. */, | ||
| "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, | ||
| "skipLibCheck": false /* Skip type checking of declaration files. */, | ||
| "noUnusedLocals": true, | ||
| "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, | ||
| "moduleResolution": "node", | ||
| "resolveJsonModule": true | ||
| }, | ||
| "include": ["index.ts"] | ||
| } | ||
| EOF | ||
|
|
||
| echo "# Running tsc against dts-validation working directory..." | ||
| npx tsc | ||
| result="$?" | ||
|
|
||
| if [[ "${result}" -eq "0" ]]; then | ||
| echo "# tsc ran successfully against demo typescript ${TYPESCRIPT_VERSION} project, PASS!" | ||
| else | ||
| echo "# tsc errored when ran against demo typescript ${TYPESCRIPT_VERSION} project, FAIL!" | ||
| fi | ||
|
|
||
| exit ${result} |
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.
Uh oh!
There was an error while loading. Please reload this page.