0.4.5 • Published 3 years ago
@gabaraujo/seed-npm-package v0.4.5
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@latestUsage
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 patchNote: 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 publishNote: 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!