Skip to content

Conversation

fi3ework
Copy link
Member

@fi3ework fi3ework commented Oct 23, 2024

Summary

Programmatically generate templates

  • The generated template path is in pattern of [${template}]-[${(tools ? Object.keys(tools) : []).sort()}]-${lang}.
  • Add new tools step (support vitest and storybook for now), vitest is applicable for all templates and storybook is applicable for UI related template (react).

Add React template

  • React (and other UI frameworks) is applicable with tool Storybook.

Templates tweak

  • Adding typescript dependency and dts: true for JS projects: Emitting dts for JS templates. It's acceptable to write non-TS project sometimes, but dts is recommended to emit and enable partial type check when needed.

TODO

  • As the templates getting more complex, I wonder does the tools step merge into create-rstack?
  • Is adding TS stuff to JS project also applicable for Rsbuild JS projects?

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@fi3ework fi3ework marked this pull request as draft October 23, 2024 16:01
Copy link

netlify bot commented Oct 23, 2024

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit 71530f9
🔍 Latest deploy log https://app.netlify.com/sites/rslib/deploys/671f89fec734560007a48a3f
😎 Deploy Preview https://deploy-preview-326--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codspeed-hq bot commented Oct 23, 2024

CodSpeed Performance Report

Merging #326 will not alter performance

Comparing react-template (d2443db) with main (f017d90)

Summary

✅ 5 untouched benchmarks

@fi3ework fi3ework force-pushed the react-template branch 10 times, most recently from 0cc4afa to 2d7d078 Compare October 29, 2024 09:36
@fi3ework fi3ework marked this pull request as ready for review October 29, 2024 09:36
@chenjiahan
Copy link
Member

Is adding TS stuff to JS project also applicable for Rsbuild JS projects?

I think developers of JS projects may not want to use TypeScript

@chenjiahan
Copy link
Member

I wonder does the tools step merge into create-rstack?

It depends on the contents of tools. For example, Biome and ESLint templates are suitable for all projects (Rspack, Rsbuild, Rslib...), so we keep them in the create-rstack repo.

For Storybook or Vitest, the config file might be different for Rspack, Rsbuild or Rslib.

@Timeless0911
Copy link
Contributor

The PR title can be more precise🥹

@fi3ework fi3ework changed the title feat(create-rslib): react template feat(create-rslib): add react template and tools(storybook/vitest) Oct 29, 2024
@fi3ework
Copy link
Member Author

I think developers of JS projects may not want to use TypeScript

I was wrong, I forget TS can't only check part of the file. Will remove TS check.

@fi3ework
Copy link
Member Author

The generated template files are numerous and may continue to grow. We can generate these template files during the create-rslib publish or postinstall stages. However, we need more testing to ensure this approach works. For now, we will keep the template files in the repository to assist with code reviews.

@fi3ework fi3ework merged commit d931c23 into main Oct 30, 2024
20 checks passed
@fi3ework fi3ework deleted the react-template branch October 30, 2024 03:08
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