Fix cli breaking change and setup fixed entrypoint to prevent future cases from happening#1410
Merged
timotheeguerin merged 7 commits intoDec 9, 2022
Conversation
timotheeguerin
requested review from
allenjzhang,
bterlson,
daviwil,
markcowl and
nguerrera
as code owners
December 9, 2022 19:33
nguerrera
reviewed
Dec 9, 2022
| } | ||
| const scriptUrl = url.pathToFileURL(script).toString(); | ||
| import(scriptUrl); | ||
| await import(scriptUrl); |
Contributor
There was a problem hiding this comment.
Good catch. I wonder why eslint didn't find this one.
nguerrera
approved these changes
Dec 9, 2022
…into fix/cli-tool
timotheeguerin
added a commit
that referenced
this pull request
Dec 16, 2022
* HotFix: Scalar migration script and scalar in namespace (#1401) * Bump versions (#1403) * Fix cli breaking change and setup fixed entrypoint to prevent future cases from happening (#1410) * Fix: `constants` is not available in `fs/promises` in node 16 (#1414) * Fix: auth.cadl invalid doc comment causing ide to not show errors (#1438) * HotFix: `--arg` not being picked up (#1445) * . Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
timotheeguerin
added a commit
to timotheeguerin/typespec
that referenced
this pull request
Dec 19, 2022
* HotFix: Scalar migration script and scalar in namespace (microsoft#1401) * Bump versions (microsoft#1403) * Fix cli breaking change and setup fixed entrypoint to prevent future cases from happening (microsoft#1410) * Fix: `constants` is not available in `fs/promises` in node 16 (microsoft#1414) * Fix: auth.cadl invalid doc comment causing ide to not show errors (microsoft#1438) * HotFix: `--arg` not being picked up (microsoft#1445) * HotFix: Emitter not found is a warning (microsoft#1460) * Refdoc Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
chidozieononiwu
pushed a commit
to chidozieononiwu/typespec
that referenced
this pull request
Jul 20, 2026
…osoft#11312) ## Summary Removes the unused `backupPath` fallback argument from the internal `runScript` helper (`packages/compiler/src/runner.ts`) and its two callers. `runScript(relativePath, backupPath)` used to fall back to `backupPath` when `relativePath` did not exist under the resolved package root. Both call sites (`cmd/tsp.js`, `cmd/tsp-server.js`) always pass a `relativePath` that exists, so the fallback (and its `checkFileExists` helper + `access` import) is dead code. This is a pure, self-contained cleanup extracted out of microsoft#11299 (standalone SEA rewrite) so that PR stays focused on the feature. The standalone CLI does not use `runScript`. ## History / why it is safe to remove The `backupPath` fallback was added in microsoft#1410 and shipped in `@cadl-lang/compiler` **0.38.2** (Dec 2022) as a patch: _"Revert breaking change to global cli usage."_ That PR introduced the stable indirection entrypoints `entrypoints/cli.js` and `entrypoints/server.js`. Before 0.38.2 the global CLI booted the compiler directly at `dist/core/cli/cli.js` (and `dist/server/server.js`). Because a **globally-installed** CLI resolves and runs the **locally-installed** compiler, a global 0.38.2 CLI could hit an older local compiler that did not yet have the `entrypoints/` files. The `backupPath` (`dist/core/cli/cli.js` / `dist/server/server.js`) was the fallback so the global CLI could still boot those pre-0.38.2 local installs. Every supported compiler version has shipped `entrypoints/cli.js` / `entrypoints/server.js` since 0.38.2, so the fallback branch is now unreachable dead code. ## Changes - `runner.ts`: `runScript(relativePath)` — dropped `backupPath` param, `checkFileExists`, and the now-unused `access` import. - `cmd/tsp.js` / `cmd/tsp-server.js`: drop the second argument. ## Validation - `tsc -p packages/compiler/tsconfig.build.json` passes.
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.
No description provided.