-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adding logic for React modules in create command #44
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.
Looks great, thanks for the Loom showcasing it!
I realize this isn't documented anywhere right now and our repos currently have a mixed state of react-modules
and jsr-modules
-- we want to move towards react-modules
broadly as "JSR" is an internal acronym and we find that "react-modules" are more a bit more clear.
Has there been any discussion around supporting I don't think every developer uses Typescript for their JSR repos right now. For example the hello world repo is still predominantly written in JSX. |
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.
Few comments, looks good.
Its a good question - I don't think there has been a ton of discussion around this -- With this particular request coming from the internal team. We should consider this. Maybe a follow up to this would be to add a question to the prompt if a React module is created to ask about it being TS or not. |
update to arrow function Co-authored-by: Jesse M <[email protected]>
…/cli-lib into ts/152-JSR-module-create
…moving the other smaller bits back in without function blocks
New issue created here for JSX module support: https://git.hubteam.com/HubSpot/hubspot-cli-issues/issues/498 |
* @param {object} metaData - an object containing the module's metadata | ||
*/ | ||
|
||
const transformFileContents = (file, metaData, getInternalVersion) => { |
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.
Is there an issue here where this function is doing async callbacky things bu there is no returned promise of async/await handling?
Closing out as the CLI was migrated to local-dev-lib and changes have been ported over there to mirror this PR |
Description and Context
With the advent of React modules being used in the CMS at HubSpot -- there is a need to include the ability to quickly scaffold a React module from the
hs create module
command.This PR adds logic so that a dev can call
hs create module
and within the creation prompt, a new question has been added for creating a React type module. If this is selected, then the command will pull from the React sample asset in thecms-sample-assets
repo.There is also some refining of the code after a React module has been downloaded to add the meta data information to the
index.tsx
file -- Additionally, if theinternal
flag is passed, there are some regex replacements that happen to include some bits of code required by our internal team, as well as some additional files downloaded from the sample asset repo that pertain more to them.Screenshots
Loom of the command: https://www.loom.com/share/ea1e16ea73d946d685af94223a522bec?sid=8b5a1ee8-ceaf-49f6-b75f-1438c0e2d647
TODO