2.1.3 • Published 4 years ago
@p1t1ch/package-example v2.1.3
package-example
Example of simple opensource library with totally useless content 🙃
Point of this package is to show:
- how to create an opensource project and publish it to npm
- how to build a library with rollup bundler in esm/cjs formats
- how to make "tree-shakable" library
- how to write simple CLI script
- how to use Storybook for development
Usage
First things first, install package:
yarn add @p1t1ch/package-example
Library provides React component Operation
and math
helpers:
import React from 'react';
import { Operation, math } from '@p1t1ch/package-example';
const SomeComponent = () => <Operation a={16} b={13} func={math.sum} />;
And dummy CLI script – log with "Hello" and yor name from -n
argument:
# Hello, p1t1ch
npx package-example -n p1t1ch
Development
yarn <command> | Description |
---|---|
storybook | Starts a Storybook in dev mode |
storybook:build | Build static Storybook version in docs folder |
storybook:serve | Starts a static server for docs browsing |
build | Build package |
eslint | Lint all .js , .jsx , .ts and .tsx files |