Skip to content
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

fix: fixes cli not finding codemods, but actually #498

Merged
merged 5 commits into from
Jan 14, 2021

Conversation

itsdouges
Copy link
Collaborator

@itsdouges itsdouges commented Jan 12, 2021

TODO

  • Fix local run of CLI (it doesn't find codemods anymore)

@pgmanutd
Copy link
Contributor

@Madou: Thanks for cleaning up the tests 😄. Just see if we can fix "local run of CLI (it doesn't find codemods anymore)". Looks good otherwise.

alexreardon
alexreardon previously approved these changes Jan 12, 2021
@itsdouges
Copy link
Collaborator Author

itsdouges commented Jan 13, 2021

@pgmanutd fixed (the error is just me stopping the process)

image

@pgmanutd
Copy link
Contributor

@pgmanutd fixed (the error is just me stopping the process)

image

So we have replaced process.cwd() with app-root-path 🤔. If we run it in any repo, will it refer to the repo path or path where cli is installed? I am confused after reading https://www.npmjs.com/package/app-root-path#edge-case-global-clis

@itsdouges
Copy link
Collaborator Author

🤔 i think it might handle it. i'll run a nightly and test this before merging

@pgmanutd
Copy link
Contributor

🤔 i think it might handle it. i'll run a nightly and test this before merging

No worries. Lets test this once before shipping.

pgmanutd
pgmanutd previously approved these changes Jan 14, 2021
@itsdouges
Copy link
Collaborator Author

doesn't work 😭

➜  test-compiled npx @compiled/cli@0.5.4-7e02b8a404f6056123a7cdc6fb17314e6deb8c0b.0
npx: installed 285 in 10.916s
👷 Compiled cli 👷
✔ Select which preset would you like to run? 🤔 · codemods
No codemods available right now.
➜  test-compiled npx @compiled/cli@0.5.4-7e02b8a404f6056123a7cdc6fb17314e6deb8c0b.0 --version
npx: installed 285 in 6.874s
0.5.4-7e02b8a404f6056123a7cdc6fb17314e6deb8c0b.0
➜  test-compiled

@pgmanutd
Copy link
Contributor

doesn't work 😭

➜  test-compiled npx @compiled/cli@0.5.4-7e02b8a404f6056123a7cdc6fb17314e6deb8c0b.0
npx: installed 285 in 10.916s
👷 Compiled cli 👷
✔ Select which preset would you like to run? 🤔 · codemods
No codemods available right now.
➜  test-compiled npx @compiled/cli@0.5.4-7e02b8a404f6056123a7cdc6fb17314e6deb8c0b.0 --version
npx: installed 285 in 6.874s
0.5.4-7e02b8a404f6056123a7cdc6fb17314e6deb8c0b.0
➜  test-compiled

Yeah it looked like it wont work after I read https://www.npmjs.com/package/app-root-path#edge-case-global-clis
damn!!

@pgmanutd
Copy link
Contributor

We can use dev vs prod or something. app-root-path for dev and process.cwd() for prod build.

@itsdouges
Copy link
Collaborator Author

latest works!

➜  test-compiled npx @compiled/cli@0.5.4-6ff480436f67d8e51aeadc05b9481545fd71cee4.0
npx: installed 285 in 10.902s
👷 Compiled cli 👷
✔ Select which preset would you like to run? 🤔 · codemods
? Select which codemod would you like to run? 🤔 …
emotion-to-compiled
styled-components-to-compiled

*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const isLocalRun = typeof process[Symbol.for('ts-node.register.instance')] === 'object';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe 😛. Its the same one. It works 🎉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah used ur hacks hehehe

@itsdouges itsdouges merged commit 246b4ce into master Jan 14, 2021
@itsdouges itsdouges deleted the actually-fix-codemod-cli branch January 14, 2021 06:09
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.

None yet

3 participants