@vu.nguyen4nitecose/component
v0.1.6
Published
Base UI component for T1 project
Readme
Base design system for T1 project.
Required:
Node.js >= v16
yarn >= v1.22
Install dependencies
yarn installCreate new component
All of components are defined in src/core/components folder
To start creating new component, needed to understand the type of component before creating new folder in the corresponding component type.
Example
Create new Input component
- Go to the
atomsfolder, createButtonfolder contains those files:
├── Button
│ └── Button.tsx
│ └── Button.module.scss
│ └── index.ts- Button.tsx: Contains the React component of Button, contains HTML and logic inside component.
- Button.module.scss: Contains Button's style
- index.ts: To contains file export component
Then, in core/components/index.ts, declare the module component there to resolve the component.
export { default as Button } from './atoms/Button'Visualize component using Storybook
- Go to folder
src/stories/to see the structure corresponding withsrc/core/components/folder - Create a file eg:
Button.stories.tsxthen write your story there.
All of the configurations of Storybook are in the .storybook folder
Storybook
To visualize components, run the Storybook by command:
yarn run storybookor with npm
npm run storybookEslint
To see the error/warning about ESLint, run the command below
With yarn:
yarn lintwith npm:
npm run lintTo fix the warning ESLint, run the command below
With yarn:
yarn lint:fixwith npm:
npm run lint:fixTo format code using Prettier, run the command below
With yarn:
yarn formatwith npm:
npm run formatStylelint
To fix the warning/error about Stylelint, run the command below
With yarn:
yarn lint:style:fixwith npm:
npm run lint:style:fixCommit conventional
All of the commits must be clearly and follow by Commitlint.
If you want to skip commit following Commit conventional, you can pass params --no-verify in the commit, but not recommended.
Build
- For development or local mode:
yarn run build-dev- For development or local mode:
yarn run build-prodThe output directory is dist/ will be bundled on your root directory.
Change version
Based on the semantic versioning, you can change the version of the package by running the commands below
Major changed:
npm run bump-version-majoror with yarn:
yarn bump-version-majorMinor changed:
npm run bump-version-minoror with yarn:
yarn bump-version-minorPatch changed:
npm run bump-version-patchor with yarn:
yarn bump-version-patchPack library
npm packYou will see an extract file in your root project. Then you can install and use their applications
Or if you want to auto publish the package, you can run the following command:
npm run publishor with yarn
yarn publishNote: Must config version of package before publishing.
