you need to have yarn installed
npm install --global yarn
Then run install
yarn install
yarn storybook
yarn storybook-tailwind
yarn build
yarn test
yarn lint
To create a new component, make sure you have npx installed then run
npx hygen component new <componentName>
i.e
npx hygen component new textArea
After this you should manually include the new path in the tsconfig.json paths
"paths": {
"@uicr/core": ["packages/core/src"],
"@uicr/button-close": ["packages/button-close/src"],
...
"@uicr/<component-name>": ["packages/<component-name>/src"],
},
If your project uses other dependencies from other components add the, to your package local package.json i.e lets say your project needs the transition component
"dependencies": {
"core-js": "^3.6.5",
"vue": "3.1.5",
"@uicr/core": "*",
...
"@uicr/transition": "*"
},
By default the code generation will add a unit test with a basic test, make sure you also add the testing to your component.
This are the steps that the hygen command will execute
- Create a package: This creates a folder inside the packages dir with the next structure
-- packages
-- <component-name>
-- src
-- defaults
-- bs-ui-<component-name>-theme.config.ts
-- ui-<component-name>-aria.config.ts
-- docs
-- <ComponentName>.doc.mdx
-- models
-- ui-<component-name>-aria.model.ts
-- ui-<component-name>-theme.model.ts
-- ui-<component-name>.model.ts
-- stories
-- <ComponentName>.bs.stories.ts
-- <ComponentName>.tw.stories.ts
-- tw-ui-<component-name>-theme.config.ts
-- index.ts
-- dev.ts
-- shims-vue.d.ts
-- ui-<component-name>.component.vue
-- .eslintrc.js
-- babel.config.js
-- jest.config.js
-- package.json
-- tsconfig.json
-- test
-- ui-<component-name>.spec.ts
- Create a custom model: This includes 3 files:
- the theme model
ui-<component-name>-theme-config.model.ts
- the aria model
ui-<component-name>-aria-config.model.ts
- the main component model
ui-<component-name>.model.ts
: this one reflects the props for the main component
- Create a default bootstrap theme:
bs-ui-<component-name>-theme.config.ts
is the default file for theaming based on bootstrap clases - Create a default aria config:
ui-<component-name>-aria.config.ts
is the default values for aria strings - Create a custom tailwind config:
tw-ui-<component-name>-theme.config.ts
this is the configuration that overrides bootstrap with tailwind classes. - Create the bootstrap stories:
<ComponentName>.bs.stories.ts
- Create the tailwind stories:
<ComponentName>.tw.stories.ts
- Create the main vue component using composition api for Vue 3 with the respective project configuration files.
- Create the docs file
<ComponentName>.doc.mdx
and inject it in the stories. Includes it in thedev.ts
file for easy importing. - create the test file
ui-<component-name>.spec.ts
with other static files required by jest.eslintrc.js
andjest.config.js