1.0.1 • Published 1 year ago
ag-test-package-npm v1.0.1
tutorial
https://www.youtube.com/watch?v=Nh9xW2-ZOEU&t=639s
init package.json:
$ npm init -y
//add this to config:
"main": "dist/index.js",
"types": "dist/index.d.js",
"files": ['/dist'],
install typescript:
$ npm install typescript
$ npx tsc --init
//init the tsconfig.json with ALL the compiler options
//clear and create this configuration:
{
"compilerOptions": {
"module": "Commonjs",
"target": "es2015",
"sourceMap": true,
"outDir": "./dist",
"noImplicitAny": true,
"declaration": true,
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Compile TS:
$ npx tsc
NPM stuff
npm login
'npm publish'
tester
Install ts-node: https://www.npmjs.com/package/ts-node
import { sayHello } from 'ag-test-package-npm'
console.log(sayHello("from tester"));
Git stuff: git commit -m "first commit" git push -u origin main