@gabaraujo/seed-npm-package
v0.4.5
Published
This is a sample on how to create an NPM package using TypeScript source.
Downloads
17
Readme
Sample NPM Package in TypeScript
This is a sample on how to create an NPM package using TypeScript source.
Installation
- Install TypeScript
npm install typescript
- Install this package
npm install @ejgallo/seed-npm-package@latest
Usage
import * as samplePackage from "@ejgallo/seed-npm-package";
// returns 'Hello, John Doe.'
samplePackage.helloWorld({ first: "John", last: "Doe" });
OR
import { helloWorld } from "@ejgallo/seed-npm-package";
// returns 'Hello, John Doe.'
helloWorld({ first: "John", last: "Doe" });
Contributing
- Clone the Git Repository
- Create a new branch
- Install package dependencies:
npm install
- Make desired changes
- Test your changes prior to publishing.
- Please make sure to update tests as appropriate.
- Issue a new version command using the NPM semantic versioning:
# Values can be major, minor or patch
npm version patch
Note: This will automatically create a git commit with the new version tag for easier tracking in the source control system. 8. Publish new version to the NPM Repository:
npm publish
Note: This command will first run "tsc" (to compile TypeScript into JavaScript) and then publish the package. This is thanks to the
"prepack": "tsc"
line in package.json. Do not remove that from the configuration. 9. Go to the NPM Repository and check if new version is available. 10. Have fun!