@techhoruser/react-accordion-component v0.0.2
โก Using this Vite template
- Create your project based on this template:
- a) If you want to create a GitHub repository, we would recommend to use the GitHub "Use this template" button and clone your newly created repository
- b) If you prefer to just create a local project, you can use degit:
npx degit TechHoruser/typescript-react-library-template#main my-app
- Update your project meta-information:
- Update the
package.json:- Specify proper values for the
name,authorandlicenseproperties - Specify the file name for the
mainandmoduleproperties - If you wish to expose multiple entry points, follow this structure:
{ "name": "my-component", "type": "module", "files": ["dist"], "main": "./dist/my-component.cjs", "module": "./dist/my-component.js", "exports": { ".": { "import": "./dist/my-component.js", "require": "./dist/my-component.cjs" }, "./secondary": { "import": "./dist/secondary.js", "require": "./dist/secondary.cjs" } } } - Specify proper values for the
- Change the
nameandfileNameinvite.config.tsto match the file name specified in thepackage.json - Change the author in
LICENSE - Clean up this
README.md
- Update the
- Set up your GitHub Actions workflow:
- If you do not wish to publish to npm, you can delete the
.github/workflows/publish.yml - If you do wish to publish to npm, you can delete the
.github/workflows/CI.ymland set up your token following the instructions below.
- If you do not wish to publish to npm, you can delete the
- Run your library:
cd my-library: Move to your project root directorynpm install: Install all the project dependenciesnpm run docs: Start the Storybook dev mode on localhost:6006
๐ Documentation
npm run docs: Run Storybook documentation in dev modenpm run build:docs: Build Storybook documentation
โ Testing
This template comes with both Jest and Cypress component testing. Since this is a template for a component library, we feel it doesn't make sense to use the e2e Cypress option, but feel free to change it to your needs.
Unit tests
npm run test: Run unit tests with Jest and React Testing Library
npm run test:watch: Run unit tests on watch mode
Component tests
npm run cy:open: Open Cypress in dev mode
npm run cy:run: Execute Cypress in CLI๐ฆ Linting
npm run lint: Run linternpm run lint:fix: Fix lint issues
๐ CI and Publishing
This template comes with a GitHub Actions workflow to automatically publish on any push to main when the package.json version number differs from the latest on npm. Please note that you need to create the package on NPM first.
For it to work you will need to add an NPM_TOKEN secret to your repo:
- Create an automation token in NPM
- Documentation on npm tokens and how to create them
- Go to your GitHub Repository Settings / Secrets / Actions
- Click on the "New repository secret" button
- Fill in the form:
- Name:
NPM_TOKEN - Secret: the NPM token value
- Name:
Read the full documentation on the npm-publish action.
๐ Tech Stack
- TypeScript
- Storybook
- ESLint and Prettier already configured
- Jest with React Testing Library for the unit tests
- Cypress with Testing Library for acceptance/component tests
- GitHub Action Workflows set up to run tests and linting on push
- Makefile for standardize how to run projects
- Sass to supercharge CSS with nested classes and more fun
- .editorconfig for sharing the IDE config
๐ค FAQ
๐ป Why not adding .vscode or .idea to the .gitignore template
These are folders created due to personal environment preferences. We should ignore these personal development environment preferences to be ignored using your global .gitignore file and leave the project .gitignore file as clean as possible, that is, only containing the project specific rules.
You can create a .gitignore_global file with rules that will apply to all your repositories with:
touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global๐ Codely Code Quality Standards
Publishing this package we are committing ourselves to the following code quality standards:
- ๐ค Respect Semantic Versioning: No breaking changes in patch or minor versions
- ๐ค No surprises in transitive dependencies: Use the bare minimum dependencies needed to meet the purpose
- ๐ฏ One specific purpose to meet without having to carry a bunch of unnecessary other utilities
- โ Tests as documentation and usage examples
- ๐ Well documented ReadMe showing how to install and use
- โ๏ธ License favoring Open Source and collaboration
๐ Related information
This application was generated using the <โกโ๏ธ> TypeScript React Library Template. Feel free to check it out and star the repo! ๐๐๐
2 years ago