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

Replace chalk by picocolors #8390

Merged
merged 17 commits into from
Jul 12, 2024

Conversation

torresgol10
Copy link
Contributor

@torresgol10 torresgol10 commented Jun 9, 2024

We replaced chalk with picocolors as it is much more optimal and smaller.

Discussions: #8341

In this PR has been the replacement in all the packages inside /packages/, I will make another one for the update of the examples, but I can also include in this same PR.

I have deleted in 2 package.json the dependency on: @types/chalk-animation as I checked and it was not being used.

Picocolors does not have the function to pass a hexadecimal colour to ASCII, to keep the colours, I have created the function and here 2 things to comment.

I have created this function in the most used place in the turbo-utils / logger, but it is also used in 1 specific place, that's why I have used the export.

  1. The implementation does not use the ‘bits’ because typescript gives error, if you see it necessary I can change the implementation.
  2. I don't know if this is the right place to put this function, do you think it's necessary to create a test?

Copy link

vercel bot commented Jun 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 12, 2024 1:05pm
rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 12, 2024 1:05pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jul 12, 2024 1:05pm

Copy link

vercel bot commented Jun 9, 2024

Someone is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@anthonyshew anthonyshew removed the needs: triage New issues get this label. Remove it after triage label Jun 15, 2024
@turbo-orchestrator turbo-orchestrator bot added the needs: triage New issues get this label. Remove it after triage label Jun 15, 2024
@ijjk
Copy link
Member

ijjk commented Jun 15, 2024

Allow CI Workflow Run

  • approve CI run for commit: d6d2c7c

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

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

Awesome! Will help my npx create-turbo that much quicker.

Going through each package to visually check behavior:

Seems like it has to do with the implementation of hex.

packages/turbo-gen/tsup.config.ts Outdated Show resolved Hide resolved
@torresgol10
Copy link
Contributor Author

torresgol10 commented Jun 16, 2024

@anthonyshew Sorry, I had a bug in the implementation so it didn't paint lines it shouldn't, also change the hex function to const to keep the same programming style, just that you had to move it up in the file to make it's calls work.

export * as logger from "./logger";

About the hex import, I modified it because I detected that all logger exports are made to logger, so I had to import logger and call hex: logger.hex.

@anthonyshew
Copy link
Contributor

Thanks! Updated list:

Once those are buildable again, I'll give them a look.

@torresgol10
Copy link
Contributor Author

torresgol10 commented Jun 25, 2024

@anthonyshew I'm sorry, I've been looking at the reason for the fault and I've managed to find out where it comes from but I can't find out why it's wrong, I don't know if you could help me.

The bug is in the @turbo/utils import, apparently this file does not know how to compile the import ts.

image

@anthonyshew
Copy link
Contributor

No worries! I think this is the dreaded ESM/CJS error. I'll do my best to find time to take a look at this when I can.

@torresgol10
Copy link
Contributor Author

@anthonyshew I have made a few changes and it compiles perfectly. 🎉

I have removed the logger import and changed the colour from purple to picocolors magenta.
I have changed the picocolors import because it also gave an error.

If the colour change is not a problem (it is a "similar" colour) I think you can continue with the tests.

Thank you very much.

@anthonyshew
Copy link
Contributor

@torresgol10, it looks like there are a few more references to do away with: https://github.com/vercel/turbo/actions/runs/9897583783/job/27342448642?pr=8390

The ones in src/commands/create/index.ts are from us making a few updates to npx create-turbo for better logging output. Sorry for adding to your work. Also, FYI, I merged main onto the branch because I was aware of that change, so sorry for messing up your history!

Once we have those cleared up, we should be good to go!

@torresgol10
Copy link
Contributor Author

@anthonyshew It's OK, it's normal to have to make changes, everything would be solved and the conflicts would be solved. Thank you very much and I would love to continue making small changes to this great project.

Copy link

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: npm/@types/[email protected]

View full report↗︎

@torresgol10
Copy link
Contributor Author

@anthonyshew I don't know if I did it right, but I saw an error in the "Formating" and I fixed it by making a new commit.

@anthonyshew anthonyshew merged commit be67cfd into vercel:main Jul 12, 2024
62 of 64 checks passed
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
We replaced chalk with picocolors as it is much more optimal and
smaller.

Discussions: vercel/turborepo#8341

In this PR has been the replacement in all the packages inside
/packages/, I will make another one for the update of the examples, but
I can also include in this same PR.

I have deleted in 2 package.json the dependency on:
@types/chalk-animation as I checked and it was not being used.

Picocolors does not have the function to pass a hexadecimal colour to
ASCII, to keep the colours, I have created the function and here 2
things to comment.

I have created this function in the most used place in the turbo-utils /
logger, but it is also used in 1 specific place, that's why I have used
the export.

1. The implementation does not use the ‘bits’ because typescript gives
error, if you see it necessary I can change the implementation.
2. I don't know if this is the right place to put this function, do you
think it's necessary to create a test?

---------

Co-authored-by: torresgol10.itd <[email protected]>
Co-authored-by: Anthony Shew <[email protected]>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
We replaced chalk with picocolors as it is much more optimal and
smaller.

Discussions: vercel/turborepo#8341

In this PR has been the replacement in all the packages inside
/packages/, I will make another one for the update of the examples, but
I can also include in this same PR.

I have deleted in 2 package.json the dependency on:
@types/chalk-animation as I checked and it was not being used.

Picocolors does not have the function to pass a hexadecimal colour to
ASCII, to keep the colours, I have created the function and here 2
things to comment.

I have created this function in the most used place in the turbo-utils /
logger, but it is also used in 1 specific place, that's why I have used
the export.

1. The implementation does not use the ‘bits’ because typescript gives
error, if you see it necessary I can change the implementation.
2. I don't know if this is the right place to put this function, do you
think it's necessary to create a test?

---------

Co-authored-by: torresgol10.itd <[email protected]>
Co-authored-by: Anthony Shew <[email protected]>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
We replaced chalk with picocolors as it is much more optimal and
smaller.

Discussions: vercel/turborepo#8341

In this PR has been the replacement in all the packages inside
/packages/, I will make another one for the update of the examples, but
I can also include in this same PR.

I have deleted in 2 package.json the dependency on:
@types/chalk-animation as I checked and it was not being used.

Picocolors does not have the function to pass a hexadecimal colour to
ASCII, to keep the colours, I have created the function and here 2
things to comment.

I have created this function in the most used place in the turbo-utils /
logger, but it is also used in 1 specific place, that's why I have used
the export.

1. The implementation does not use the ‘bits’ because typescript gives
error, if you see it necessary I can change the implementation.
2. I don't know if this is the right place to put this function, do you
think it's necessary to create a test?

---------

Co-authored-by: torresgol10.itd <[email protected]>
Co-authored-by: Anthony Shew <[email protected]>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
We replaced chalk with picocolors as it is much more optimal and
smaller.

Discussions: vercel/turborepo#8341

In this PR has been the replacement in all the packages inside
/packages/, I will make another one for the update of the examples, but
I can also include in this same PR.

I have deleted in 2 package.json the dependency on:
@types/chalk-animation as I checked and it was not being used.

Picocolors does not have the function to pass a hexadecimal colour to
ASCII, to keep the colours, I have created the function and here 2
things to comment.

I have created this function in the most used place in the turbo-utils /
logger, but it is also used in 1 specific place, that's why I have used
the export.

1. The implementation does not use the ‘bits’ because typescript gives
error, if you see it necessary I can change the implementation.
2. I don't know if this is the right place to put this function, do you
think it's necessary to create a test?

---------

Co-authored-by: torresgol10.itd <[email protected]>
Co-authored-by: Anthony Shew <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants