question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't seem to work with monorepos

See original GitHub issue

I am trying to convert https://github.com/vega/vega/tree/master/packages/vega-util, which is a package in a monorepo and already has typings. Running npx ts-migrate-full packages/vega-util from the root results in the following logs and no changes to the files. Am I using the tool incorrectly or is it not intended for my use case?

Welcome to TS Migrate! :D

This script will migrate a frontend folder to a compiling (or almost compiling) TS project.

It is recommended that you take the following steps before continuing...

1. Make sure you have a clean git slate.
   Run `git status` to make sure you have no local changes that may get lost.
   Check in or stash your changes, then re-run this script.

2. Check out a new branch for the migration.
   For example, `git checkout -b dominik--ts-migrate` if you're migrating several folders or
   `git checkout -b dominik--ts-migrate-vega-util` if you're just migrating packages/vega-util.

3. Make sure you're on the latest, clean master.
   `git fetch origin master && git reset --hard origin/master`

4. Make sure you have the latest npm modules installed.
   `npm install` or `yarn install`

If you need help or have feedback, please file an issue on Github!

Continue? (y/N) y
Set a custom path for the typescript compiler. (It's an optional step. Skip if you don't need it. Default path is ./node_modules/.bin/tsc.):
Your default tsc path is ./node_modules/.bin/tsc.

[Step 1 of 4] Initializing ts-config for the "packages/vega-util"...

[dom/ts 39342f6e] [ts-migrate][vega-util] Init tsconfig.json file
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 packages/vega-util/.eslintrc
/Users/dominik/Code/vega

[Step 2 of 4] Renaming files from JS/JSX to TS/TSX and updating project.json\...

No JS/JSX files to rename.
/Users/dominik/Code/vega

[Step 3 of 4] Fixing TypeScript errors...

forkTSServer
Logs in /var/folders/_s/gz7fn52j6g5_nfm3rq23jv1w0000gn/T/ts-migrate-log-y6wsPC
TypeScript version: 3.9.7
Initialized tsserver project in 189.054ms.
Start...
[strip-ts-ignore] Plugin 1 of 12. Start...
[strip-ts-ignore] Finished in 0.058ms.
[hoist-class-statics] Plugin 2 of 12. Start...
[hoist-class-statics] Finished in 0.046ms.
[react-props] Plugin 3 of 12. Start...
[react-props] Finished in 0.022ms.
[react-class-state] Plugin 4 of 12. Start...
[react-class-state] Finished in 0.027ms.
[react-class-lifecycle-methods] Plugin 5 of 12. Start...
[react-class-lifecycle-methods] Finished in 0.031ms.
[react-default-props] Plugin 6 of 12. Start...
[react-default-props] Finished in 0.029ms.
[react-shape] Plugin 7 of 12. Start...
[react-shape] Finished in 0.044ms.
[declare-missing-class-properties] Plugin 8 of 12. Start...
[declare-missing-class-properties] Finished in 0.016ms.
[explicit-any] Plugin 9 of 12. Start...
[explicit-any] Finished in 0.020ms.
[eslint-fix] Plugin 10 of 12. Start...
[eslint-fix] Finished in 0.020ms.
[ts-ignore] Plugin 11 of 12. Start...
[ts-ignore] Finished in 0.016ms.
[eslint-fix] Plugin 12 of 12. Start...
[eslint-fix] Finished in 0.014ms.
Finished in 0.880ms, for 12 plugin(s).
Writing 0 updated file(s)...
Wrote 0 updated file(s) in 0.019ms.
[dom/ts 0ddeacf8] [ts-migrate][vega-util] Run TS Migrate
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 packages/vega-util/.eslintrc
/Users/dominik/Code/vega

[Step 4 of 4] Checking for TS compilation errors (there shouldn't be any).

./node_modules/.bin/tsc -p packages/vega-util/tsconfig.json

---
All done!

The recommended next steps are...

1. Sanity check your changes locally by inspecting the commits and loading the affected pages.

2. Push your changes with `git push`.

3. Open a PR!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Rudegcommented, Aug 19, 2020

@domoritz your tsconfig.json file doesn’t include src and test files. That’s why the ts-migrate cannot change any files (we’re getting a list of the files to convert from tsconfig). Try to include src and test files to the tsconfig.json file of the vega-util package:

"include": [
  "src", "test"
],

and run ts-migrate once again from the root.

1reaction
Rudegcommented, Aug 19, 2020

@domoritz I’m not aware of any of these tools 😦 https://github.com/typescript-cheatsheets/react/blob/master/docs/migration/from-js.md#automated-js-to-ts-conversion here is a good list of the existing tools, but as far as I know, none of them doing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The issue with Monorepos - Squash
Therefore, team members across an organization work in the same place. This results in a lowered sense of ownership and blurred boundaries.
Read more >
Monorepos: Please don't! - Medium
Theoretical benefit 1: Easier collaboration and code sharing​​ Monorepo proponents will argue that when all code is present within a single ...
Read more >
What is monorepo? (and should you use it?) - Semaphore CI
Monorepos can foster rapid development workflows. In this post, we'll examine if they are the right fit for you and your company.
Read more >
Benefits and challenges of monorepo development practices
Although polyrepos seem to be the natural choice for microservices, a monorepo with unified and automated build and deploy pipelines can ...
Read more >
A Guide to Monorepos for Front-end Code - Toptal
A monorepository is a code management and architectural concept whereby you keep all your isolated bits of code in one super repository instead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found