New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More ā†’
Socket
Sign inDemoInstall
Socket

create-typescript-react-library

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-typescript-react-library

šŸ§° Tool for building low-maintenance, flexible TypeScript libraries.

  • 1.0.0-alpha.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
Ā 
Created
Source

create-typescript-react-library

npm version test coverage GitHub Workflow Status

This starter enables simple creation of libraries using TypeScript.

Features

  • rollup for smallest bundles
  • tests with jest (+coverage)
  • generates type declarations
  • esm, cjs and umd (script tag) exports
  • admin (code of conduct, contributing instructions)
  • interactive setup script
  • automated semantic releases
  • automated api docs generation
  • add react with a single command
  • context-dependent start script (tdd jest, plus storybook for react)

Requirements

  • curl
  • git
  • node
  • yarn

Setup

Step 1. Local setup

yarn create typescript-react-library <yourdir>
cd <yourdir>

# install dependencies
yarn
# start setup
yarn ctrl setup
# re-init history
rm -rf .git
git init
# if adding react
yarn ctrl add-react
# create repo and push changes
git add -A
git commit -m 'Initial commit' --no-verify
git remote add origin https://github.com/<user>/<repo>.git
git push -u origin main

Step 2. Github setup

  1. Create an NPM token: https://docs.npmjs.com/creating-and-viewing-authentication-tokens
  2. Create a Github repo of the same name that you selected in the setup script
  3. Add the NPM token to your repository's secrets: your-repo > Settings > Secrets > New Secret NPM_TOKEN=<your token from Step 1>

Step 3. Go!

yarn start

I'm not creating a React library

yarn remove react react-dom

Also, my library is for node, not the browser

Remove the browser key in package.json.

Pointers

  • If you want to bundle a package you're importing, stick it in dependencies. If you'd like the user of your library to install it as a peer dependency, install it as a peer dependency
    • Peer dependencies in web (umd) buildsĀ are imported by getting it from the window object. Web versions of different dependencies often use different global names (window.$ might be used in import ... from "jquery"). For web builds to work, you'll have to add the correct global name to the knownDependencyNames map in rollup.config.js

Keywords

FAQs

Package last updated on 12 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc