npm-ts-starter
Usage
-
Clone this repo:
git clone git@github.com:vriad/npm-ts-starter.git yourpkgname cd yourpkgname
Then create a new repoisitory in your GitHub account and set it up
rm -rf .git git init git remote add origin GITHUB_REMOTE_URL git add . git commit -am "Initial commit" git push origin master
-
In package.json: update "name", "description", "repository", "keywords", "tags", "hompage", and any other relevant fields.
-
Implement your module! Start writing code in index.ts.
-
Write tests! See 'tests/sample.ts' for some basic examples. Run your tests with
yarn test
. This automatically generates a badge like this to display your test coverage: -
Write a README. An initial template is below. Find and replace all references to "pkgname" with your package's name and "username" with your GitHub username. Delete this "Meta-README" section before you deploy (everything above the red line).
-
Install Node (here) if you haven't already. This automatically installs the
npm
command-line tool to your computer. -
Create an npm account through npmjs.com.
-
Use the
npm login
command to sign into npm on your computer. -
Build your project with
yarn build
. This transpiles your TyeScript to JavaScript code and writes the output into/lib
. -
Publish to npm with
npm publish
.
Sample NPM Package
Table of contents
Installation
To install the latest version:
npm install --save pkgname
yarn add pkgname
TypeScript versions
Compatible with TypeScript 3.2+.
Usage
Write stuff here!
Changelog
version | release notes |
---|---|
pkgname@1.0 | Initial release |