Skip to content

feat(cli): load TypeScript config files with tsx, falling back to ts-node - #193

Merged
floydkim merged 5 commits into
masterfrom
feat/tsx-config-loader
Sep 6, 2026
Merged

feat(cli): load TypeScript config files with tsx, falling back to ts-node#193
floydkim merged 5 commits into
masterfrom
feat/tsx-config-loader

Conversation

@floyd-soomgo

@floyd-soomgo floyd-soomgo commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • Load code-push.config.ts with tsx, falling back to ts-node for projects that still use it.
  • Make tsx and ts-node optional peer dependencies, so projects install the loader they choose.
  • Resolve loaders from the project containing the config file. If neither is installed, show how to install tsx.
  • With tsx, support default exports and tsconfig paths aliases. .js config files continue to load through Node's require.
  • Add a CI smoke test for a default-export config that uses a paths alias.
  • Recommend tsx and deprecate ts-node support.
  • Warn on stderr when a config file is loaded with ts-node.

Compatibility notes

Existing ts-node projects need no changes. Installing tsx makes it the preferred loader; removing ts-node is optional.

After switching to tsx:

  • modules listed in ts-node.require no longer run
  • aliases defined only in babel.config.js are not resolved; define them in tsconfig.json paths
  • type errors in the config file no longer block the CLI, because tsx transpiles without type-checking

ts-node support is deprecated and will be removed in a future major version.

Verification

  • npm run type:cli and ESLint on changed files
  • npm run --workspace cli test: 11 suites, 102 tests
  • verified the compiled CLI with the CI fixture and RN0821, Expo55, and soomgo-mobile-app configs, including default exports and tsconfig paths aliases
  • verified ts-node fallback with a CommonJS config in a project that has ts-node but not tsx
  • verified the tsx installation hint and exit code 1 when neither loader is installed

Follow-up

Example setup scripts and apps still use ts-node; their migration is handled separately in #194.

tsx compiles the TypeScript config file and the project files it imports, and resolves
tsconfig `paths` aliases from the tsconfig.json nearest to the working directory. It ships
as a regular dependency, so a project needs no setup for a `.ts` config file.

Compared with ts-node: hooks listed in the tsconfig `ts-node.require` field no longer run,
aliases defined only in babel.config.js (babel-plugin-module-resolver) are not resolved, and
type errors in the config file no longer stop the CLI.
@floyd-soomgo
floyd-soomgo force-pushed the feat/tsx-config-loader branch from 6903c34 to 946c74a Compare September 3, 2026 15:48
@floydkim
floydkim marked this pull request as ready for review September 3, 2026 15:49
@floydkim
floydkim marked this pull request as draft September 6, 2026 12:16
…onal

Projects that already set up ts-node keep working without a change, and tsx moves from a
regular dependency to an optional peer dependency so a project adopts it when it is ready.

The loader tries tsx first and falls back to ts-node, which leaves existing ts-node projects
untouched while letting a migrating project switch by installing tsx alone. When neither is
installed, the CLI points at tsx. Both are resolved from the project the config file lives in
rather than from the CLI install.

ts-node is no longer maintained, so the README marks support for it as deprecated without
committing to a removal version.
@floyd-soomgo floyd-soomgo changed the title feat: load TypeScript config files with tsx instead of ts-node feat: load TypeScript config files with tsx, keeping ts-node as a fallback Sep 6, 2026
@floyd-soomgo floyd-soomgo changed the title feat: load TypeScript config files with tsx, keeping ts-node as a fallback feat(cli): load TypeScript config files with tsx, falling back to ts-node Sep 6, 2026
ts-node is no longer maintained, and support for it as a config loader will be removed in a
future major version. Projects still on it now see the notice on every command that reads the
config file. The warning goes to stderr, so piping a command's JSON output is unaffected.
@floydkim
floydkim marked this pull request as ready for review September 6, 2026 13:49
@floydkim
floydkim merged commit a330171 into master Sep 6, 2026
2 checks passed
@floydkim
floydkim deleted the feat/tsx-config-loader branch September 6, 2026 13:49
floyd-soomgo added a commit that referenced this pull request Sep 7, 2026
## Summary

- Run the setup scripts and e2e entry with tsx, and remove ts-node from
the root devDependencies.
- Update setup scripts to install and invoke tsx. Rename
`configure-ts-node` to `configure-tsconfig`; it now only adds
`code-push.config.ts` to `tsconfig.json`.
- Remove ts-node configuration from all 13 example apps and regenerate
the affected lockfiles.
- Delete `scripts/setupExampleApp/tsconfig.json`, which was only used by
`ts-node --project`.

Depends on #193, which adds tsx as a library dependency. Its three
commits are included in this PR until #193 merges.

## Verification

- `npm run type:scripts`, `npm run type:e2e`, and ESLint for changed
scripts
- Confirmed tsx launches both setup scripts and `e2e/run.ts` with
`--help`
- Confirmed `Examples/RN0821` syncs the local library through tsx

---------

Co-authored-by: Floyd Kim <for12gm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants