0.0.11 • Published 3 years ago

reclutalia-react-tw-components v0.0.11

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Getting Started with Create React App

This project was bootstrapped with Create React App.

Install dependencies

Run the command npm install to install the dependencies

Serve the component with storybooks

Run the command npm run storybook to serve the components in localhost:6006

Structure for create components src/components/{componentFolderName}

Create new folder inside src/components/{componentFolderName}

Create the next files structure with the component name:

├── src\
│   ├── components\
│   │   ├── src\components\{componentFolderName}\
│   │   │   └── {componentName}.stories.tsx
│   │   │   └── {componentName}.tsx
│   │   │   └── index.ts
│   │   ├── src\components\{componentFolderName}\
│   │   │   └── {componentName}.stories.tsx
│   │   │   └── {componentName}.tsx
│   │   │   └── index.ts
│   │   ├── index.tsx
└── README.md (The main readme)

Modify the src/components/index.ts file:

export { default as {componentFolderName} } from './{componentFolderName}';

This is an example of structure and export component file:

This is an structure example:
├── src\
│   ├── components\
│   │   ├── src\components\button\
│   │   │   └── button.stories.tsx
│   │   │   └── button.tsx
│   │   │   └── index.ts
└── README.md (The main readme)
export { default as Button } from './button';

Prepare project to publish to npm

To publish to npm is required to have an account in npm

Once to have an account run the command npm adduser in the console command line and type the required values

Then run the command npm login and type the account data

Change the package name and version into package.json

{
  "name": "reclutalia-components", <- change this name to you package library name
  "version": "0.0.6", <- change the version in every publish
  "private": false, <- The flag must be in false, true is for private pachages
  "main": "lib/index.js",
  ....

Finally, run the command npm publish to publish package to npm

To see the published package go to you npm account in your packages published