1.0.2 • Published 1 year ago
mk-package v1.0.2
mk-package
copy package.json into dist directory for npm publish
This allows the library consumer to import required files instead of loading the whole library easily.
main
and types
are auto updated if index.js
and index.d.ts
exists.
Otherwise, the fields will be left blank.
Example library with moved package.json
import { aFunc } from 'a-lib/aModule'
Example library without moved package.json
import { aFunc } from 'a-lib/dist/aModule'
Setup Example
You can use mk-package in last step of build pipeline or in the postbuild
hook, then run npm publish
inside the dist
directory
package.json:
{
"scripts": {
"build": "tsc && mk-package",
"publish": "npm run build && cd dist && npm publish"
},
"devDependencies": {
"mk-package": "^1.0.0"
}
}
tsconfig.json
{
"compilerOptions": {
"outDir": "dist"
},
"include": [
"src/**/*.ts"
]
}
Details see ./example