-
Notifications
You must be signed in to change notification settings - Fork 0
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
build: add Chakra CLI #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of thoughts...
@@ -3,7 +3,8 @@ | |||
"version": "8.0.0", | |||
"private": true, | |||
"scripts": { | |||
"dev": "next dev", | |||
"dev": "npx concurrently \"yarn next dev\" \"yarn theme:watch\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very much a personal preference. concurrently
is not added to the project as a dev dependency, but run remotely. The only requirement that would be prompted in the console is for the user to install it to their local machine. (This package is used in Chakra projects)
This command ensures that the dev environment and the Chakra CLI run in parallel without the user needing to remember an extra step.
Can certainly revert this if this is too much.
"theme": "chakra-cli tokens ./src/@chakra-ui/theme.ts --strict-token-types --strict-component-types", | ||
"theme:watch": "chakra-cli tokens ./src/@chakra-ui/theme.ts --strict-token-types --strict-component-types --watch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The strict-token-types
and strict-component-types
flags are used to constrain the typing, so that a combination of the string
and {}
primitives are not part of the type unions.
At the moment, this can aid in auto-completion. When talking with a member of the Chakra team, we recognized two issues (one kinda related):
- If we have a component that is taking is props that are typed with a shape from Chakra (i.e. StackProps) and you spread them into a component (i.e. Stack), you lose typing if you also directly add props to the component
<Stack
color="blue.500" // Typing lost here
{...props}
/>
- I would expect that with strict typing of the themes that TypeScript would throw an error if a typo or invalid token exists. This unfortunately does not seem to be the case.
@@ -1,6 +1,6 @@ | |||
{ | |||
"compilerOptions": { | |||
"target": "es5", | |||
"target": "ESNext", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise an error throws with es5
:
Transforming object literal extensions to the configured target environment ("es5") is not supported yet
feat: add year and banner to translathathon page
Update page-staking.json
Description
This PR adds back in the Chakra CLI to generate typing based on the custom theme configuration. This is helpful for IDE auto-completion to be able to recognize the correct tokens.
yarn install
has runconcurrently
command remotely to runnext dev
andyarn theme:watch
at the same time.Related Issue
N/A