0.43.1 • Published 4 months ago

@hexagonpro/hx-components v0.43.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

HX-Components

Parabéns! Você acaba de salvar horas de trabalho por usar esse projeto! Vamos te orientar em o que está aqui e como usá-los.

Se você é novo em Typescript ou React, confira essa cheatsheet

Comandos

Todo o conteúdo da biblioteca se encontra dentro da /src e também temos uma aplicação de playground que usa Parcel na pasta /example.

O fluxo de trabalho recomendado é rodar a biblioteca em um terminal:

yarn start

Isso cria uma pasta /dist e toda edição feita na pasta src recompila a /dist.

Depois disso, rode o Storybook ou a aplicação de playground:

Storybook

Rodar em outro terminal:

yarn storybook

Isso carrega as stories que estão em /src/**/*.stories.tsx.

Playground

Rodar em outro terminal:

cd example
yarn
yarn start

Para compilar sem rodar o servidor, use yarn build.

Configuração

A qualiade de código está configurada pra você com prettier, husky, e lint-staged. Ajuste os respectivos campos no package.json conforme necessaário.

Estrutura de arquivos

Essa é a estrutura de arquivos do projeto:

/example
  index.html
  index.tsx               # teste seus componentes nessa aplicação de exemplo
  package.json
  tsconfig.json
/src
  /Thing
    index.tsx
    Thing.stories.tsx     # Storybook
/.storybook
  main.js
  manager.js
  preview.js
.gitignore
package.json
README.md
tsconfig.json

Rollup

A biblioteca usa Rollup como bundler e gera várias configurações e formatos de módulo. Ver Otimizações para mais detalhes.

TypeScript

tsconfig.json está configurado para interpretar dom e esnext, além de react para jsx.

Otimizações

Confira as documentações do tsdx.

Formato dos módulos

CJS, ESModules, e UMD são suportados.

Os caminhos dos artefatos estão configurados no package.json e dist/index.js.

Deploying the Example Playground

The Playground is just a simple Parcel app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for manually deploying with the Netlify CLI (npm i -g netlify-cli):

cd example # if not already in the example folder
npm run build # builds to dist
netlify deploy # deploy the dist folder

Alternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:

netlify init
# build command: yarn build && cd example && yarn && yarn build
# directory to deploy: example/dist
# pick yes for netlify.toml

Named Exports

Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.

Including Styles

There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.

For vanilla CSS, you can include it at the root directory and add it to the files section in your package.json, so that it can be imported separately by your users and run through their bundler's loader.

Publishing to NPM

We recommend using np.

Usage with Lerna

When creating a new package with TSDX within a project set up with Lerna, you might encounter a Cannot resolve dependency error when trying to run the example project. To fix that you will need to make changes to the package.json file inside the example directory.

The problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's package.json might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.

Change the alias to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.

   "alias": {
-    "react": "../node_modules/react",
-    "react-dom": "../node_modules/react-dom"
+    "react": "../../../node_modules/react",
+    "react-dom": "../../../node_modules/react-dom"
   },

An alternative to fixing this problem would be to remove aliases altogether and define the dependencies referenced as aliases as dev dependencies instead. However, that might cause other problems.

0.43.0

4 months ago

0.43.1

4 months ago

0.36.0

10 months ago

0.40.0

6 months ago

0.37.1

10 months ago

0.37.0

10 months ago

0.41.0

6 months ago

0.38.0

9 months ago

0.42.0

5 months ago

0.39.0

8 months ago

0.35.2

1 year ago

0.34.0

1 year ago

0.35.1

1 year ago

0.35.0

1 year ago

0.32.4

1 year ago

0.32.3

1 year ago

0.32.2

1 year ago

0.32.1

1 year ago

0.32.0

1 year ago

0.29.0

1 year ago

0.25.0

1 year ago

0.29.2

1 year ago

0.29.1

1 year ago

0.33.1

1 year ago

0.33.0

1 year ago

0.26.0

1 year ago

0.30.2

1 year ago

0.30.1

1 year ago

0.30.0

1 year ago

0.27.2

1 year ago

0.27.1

1 year ago

0.27.0

1 year ago

0.31.1

1 year ago

0.31.0

1 year ago

0.28.1

1 year ago

0.28.0

1 year ago

0.20.1

2 years ago

0.20.0

2 years ago

0.23.6

2 years ago

0.23.5

2 years ago

0.21.7

2 years ago

0.23.4

2 years ago

0.21.6

2 years ago

0.23.3

2 years ago

0.21.5

2 years ago

0.21.4

2 years ago

0.23.1

2 years ago

0.21.3

2 years ago

0.23.0

2 years ago

0.21.2

2 years ago

0.21.1

2 years ago

0.23.7

2 years ago

0.21.0

2 years ago

0.22.4

2 years ago

0.24.1

1 year ago

0.22.3

2 years ago

0.22.2

2 years ago

0.22.1

2 years ago

0.22.0

2 years ago

0.18.3

2 years ago

0.18.4

2 years ago

0.18.5

2 years ago

0.18.6

2 years ago

0.19.0

2 years ago

0.17.5

2 years ago

0.17.6

2 years ago

0.17.7

2 years ago

0.18.1

2 years ago

0.18.2

2 years ago

0.18.0

2 years ago

0.17.2

2 years ago

0.16.3

2 years ago

0.17.3

2 years ago

0.16.4

2 years ago

0.17.4

2 years ago

0.14.8

2 years ago

0.15.0

2 years ago

0.16.0

2 years ago

0.15.1

2 years ago

0.17.0

2 years ago

0.16.1

2 years ago

0.15.2

2 years ago

0.17.1

2 years ago

0.16.2

2 years ago

0.15.3

2 years ago

0.13.8

2 years ago

0.13.7

2 years ago

0.13.6

2 years ago

0.13.5

2 years ago

0.13.4

2 years ago

0.13.2

2 years ago

0.13.1

2 years ago

0.13.0

2 years ago

0.12.1

2 years ago

0.12.0

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago