react-library-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Setup a sample typescript based library to export to NPM as a package and install in other projects

Install required dependencies

npm i -D react typescript @types/react

npx tsc --init

npm i -D rollup --force

npm i -D @rollup/plugin-node-resolve @rollup/plugin-commonjs @rollup/plugin-typescript rollup-plugin-peer-deps-external rollup-plugin-postcss rollup-plugin-terser --force

npm i -D rollup-plugin-dts --force

npm i -D rollup-plugin-node-resolve --force

npm i -D rollup-plugin-commonjs --force

Build the library

npm run build

Publishing to NPM

npm login

npm publish

Sample usage in another project

import { FluentButton, PrimaryButton } from 'react-library-ts';

    <FluentButton onClick={() => console.log("Clicked")}>
        Test Button 123
    </FluentButton>
    <PrimaryButton onClick={() => console.log("Clicked")}>
        Test Button 456
    </PrimaryButton>

Reference

https://www.thisdot.co/blog/how-to-setup-a-typescript-project-using-rollup-js

Package Sidebar

Install

npm i react-library-ts

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

2.46 MB

Total Files

23

Last publish

Collaborators

  • himanshuchandolasourcesoft