A project template for TypeScript npm packages
MIT License
Clone this repo:
git clone [email protected]: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. We use Jest as a test runner; check out the documenation at https://jestjs.io. 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
.
To install the latest version:
npm install --save pkgname
yarn add pkgname
Compatible with TypeScript 3.2+.
Write stuff here!
version | release notes |
---|---|
[email protected] | Initial release |