Skip to content

Instantly share code, notes, and snippets.

@elvinmeza
Last active May 7, 2018 06:37
Show Gist options
  • Save elvinmeza/4aa43cfe743f77287a48593d4544c2cf to your computer and use it in GitHub Desktop.
Save elvinmeza/4aa43cfe743f77287a48593d4544c2cf to your computer and use it in GitHub Desktop.
Publishing a simple Typescript library into npm
export * from './person.model';
{
"name": "typescript-library-to-publish",
"version": "1.0.0",
"description": "A simple library to publish as a public package into npm's registry",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"compile": "rimraf dist && tsc"
},
"author": "elvinmeza",
"devDependencies": {
"rimraf": "^2.6.2",
"typescript": "^2.8.3"
}
}
export class Person {
name: string;
age: number;
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"rootDir": "src",
"outDir": "dist",
"declaration": true
},
"compileOnSave": true,
"exclude": [
"node_modules",
"dist"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment