cliengify v2.5.1
Cliengify
React component library by Cliengo to the world
Find the interactive documentation here
Commands
The recommended workflow is to run project in one terminal:
yarn start
This builds to /dist
and runs the project in watch mode so any edits you save inside src
causes a rebuild to /dist
.
Then run Storybook playground:
Storybook
Run inside another terminal:
yarn storybook
This loads the stories from ./stories
.
NOTE: Stories should reference the components as if using the library, similar to the example playground. This means importing from the root project directory. This has been aliased in the tsconfig and the storybook webpack config as a helper.
To do a one-off build, use yarn build
.
To run tests, use yarn test
.
Configuration
Code quality is set up for you with prettier
, husky
, and lint-staged
. Adjust the respective fields in package.json
accordingly.
Jest
Jest tests are set up to run with npm test
or yarn test
.
Bundle analysis
Calculates the real cost of your library using size-limit with npm run size
and visulize it with npm run analyze
.
Setup Files
This is the folder structure we set up for you:
/example
index.html
index.tsx # test your component here in a demo app
package.json
tsconfig.json
/src
index.tsx # EDIT THIS
/test
blah.test.tsx # EDIT THIS
/stories
Thing.stories.tsx # EDIT THIS
/.storybook
main.js
preview.js
.gitignore
package.json
README.md # EDIT THIS
tsconfig.json
Rollup
TSDX uses Rollup as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.
TypeScript
tsconfig.json
is set up to interpret dom
and esnext
types, as well as react
for jsx
. Adjust according to your needs.
Continuous Integration
GitHub Actions
Two actions are added by default:
main
which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrixsize
which comments cost comparison of your library on every pull request using size-limit
Optimizations
Please see the main tsdx
optimizations docs. In particular, know that you can take advantage of development-only optimizations:
// ./types/index.d.ts
declare var __DEV__: boolean;
// inside your code...
if (__DEV__) {
console.log('foo');
}
You can also choose to install and use invariant and warning functions.
Module Formats
CJS, ESModules, and UMD module formats are supported.
The appropriate paths are configured in package.json
and dist/index.js
accordingly. Please report if any issues are found.
Named Exports
Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.
Publishing to NPM
Manual release is already set in the repo actions.
Changelog
Before you proceed to trigger a new release, add notable changes to the changelog file. Our workflow requires that you stick with the Keep a Changelog convention.
Local development
steps:
- 1-
yarn link
on the cliengify folder - 2-
cd node_modules/react && yarn link
on the target folder (your current project) - 3-
cd node_modules/@chakra-ui/react && yarn link
on the target folder (your current project) - 4- on your current project do a
yarn link cliengify
- 5- on cliengify folder do a
yarn link react && yarn link @chakra-ui/react
Repository keeper 👀
Doubts? Bugs? Features? ask Dani (daniel.gomez@cliengo.com)