mk-package

1.0.2 • Public • Published

mk-package

copy package.json into dist directory for npm publish

npm Package Version

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

Package Sidebar

Install

npm i mk-package

Weekly Downloads

1

Version

1.0.2

License

BSD-2-Clause

Unpacked Size

5.17 kB

Total Files

4

Last publish

Collaborators

  • beenotung