@nerdjs/workflow-kit
v2.0.5
Published
This is a @nerdjs library for the WA Workflow Service
Downloads
12
Keywords
Readme
Nerd Sales Kit User Guide
This setup is meant for developing React component libraries (not apps!) that can be published to NPM. If you’re looking to build a React-based app, you should use
create-react-app
,razzle
,nextjs
,gatsby
, orreact-static
.
If you’re new to TypeScript and React, checkout this handy cheatsheet
Commands
The recommended workflow is to run the library in one terminal:
npm start # or yarn start
This builds to /dist
and runs the project in watch mode so any edits you save inside lib
causes a rebuild to /dist
.
Then run the example inside another:
cd example
npm i # or yarn to install dependencies
npm start # or yarn start
The default example imports and live reloads whatever is in /dist
.
To do a one-off build, use npm run build
or yarn build
.
To run tests, use npm test
or yarn test
.
Configuration
Code quality is set up for you with prettier
. Adjust the respective fields in package.json
accordingly.
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:
/lib
index.tsx
.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.
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.
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
Use npm npm.