@mishguru/package
Utils for creating, building and testing NPM packages
Last updated 2 days ago by cojj .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mishguru/package 
SYNC missed versions from official npm registry.

Package

Installation

npm install --save-dev @mishguru/package

Recommended Scripts

Copy the following into your package.json.

"scripts": {
  "build": "pkg-build",
  "lint": "pkg-lint",
  "tidy": "pkg-tidy",
  "test": "NODE_ENV=test pkg-test",
  "coverage": "NODE_ENV=test pkg-coverage",
  "precommit": "pkg-precommit"
}

Using Typescript

To enable typescipt support, set the types property in your package.json.

"main": "./dist/index.js",
"types": "./dist/index.d.ts",

Type declarations

If you need to use a 3rd party library that doesn't have typescript support, you can provide your own type declarations.

There are some strict rules you need to follow for this to work:

  1. You must only mock one dependency per file.
  2. You must place the file inside the ./src/types/ folder.
  3. The filename must be the same as the dependency name.
  4. The extension must be .d.ts.

For example, if you are providing types for file-exists, the types must be saved in ./src/types/file-exists.d.ts.

Providing Typescript types for a project written in JS

If you are manually adding types for a non-typescript project, you must keep your types in the root of your project, in a file named types.d.ts.

@mishguru/package will not use the typescript compiler if your package.json contains the value: "types": "types.d.ts".

Lifecycle Test Helpers

AVA does not support "before all" or "after all" functions, because it runs everything in parallel.

Package has got your back though. If you need to setup/teardown a database, then this is for you.

Please note, that if you run AVA in watch mode, the "after all" function will not be called until you exit AVA.

Before All

Create a file called testHelpers/beforeAll.js in the root of your project, and it will be executed before the tests begin.

After All

Create a file called testHelpers/afterAll.js in the root of your project, and it will be executed after the tests finish.

It will be called regardless of whether the tests passed or failed.

Different Folder Structure

srcPath

If your code is kept in a folder that isn't src then you can change the path by adding the following to your package.json

"srcPath": "lib",

distPath

Would you like your compiled code to be in a folder that isn't named dist?

"distPath": "public"

testsPath

Tests must be defined inside the srcPath, and by default match any files that end in .spec.js.

"testsPath": "**/*.test.js",

Current Tags

  • 4.17.0-alpha.0                                ...           alpha (9 months ago)
  • 3.0.0                                ...           beta (a year ago)
  • 7.0.2                                ...           latest (2 days ago)
  • 7.0.0-rc3                                ...           next (12 days ago)

165 Versions

  • 7.0.2                                ...           2 days ago
  • 7.0.1                                ...           12 days ago
  • 7.0.0-rc3                                ...           12 days ago
  • 7.0.0-rc2                                ...           12 days ago
  • 7.0.0-rc1                                ...           a month ago
  • 6.3.1                                ...           a month ago
  • 6.2.2                                ...           2 months ago
  • 6.2.1                                ...           2 months ago
  • 6.2.0                                ...           2 months ago
  • 6.1.0                                ...           2 months ago
  • 6.0.0                                ...           2 months ago
  • 6.0.0-next.30                                ...           2 months ago
  • 6.0.0-next.29                                ...           2 months ago
  • 6.0.0-next.28                                ...           3 months ago
  • 6.0.0-next.27                                ...           3 months ago
  • 6.0.0-next.26                                ...           3 months ago
  • 6.0.0-next.25                                ...           3 months ago
  • 6.0.0-next.24                                ...           3 months ago
  • 6.0.0-next.23                                ...           3 months ago
  • 6.0.0-next.22                                ...           3 months ago
  • 6.0.0-next.21                                ...           3 months ago
  • 6.0.0-next.20                                ...           3 months ago
  • 6.0.0-next.19                                ...           3 months ago
  • 6.0.0-next.18                                ...           3 months ago
  • 6.0.0-next.17                                ...           3 months ago
  • 6.0.0-next.16                                ...           3 months ago
  • 6.0.0-next.15                                ...           3 months ago
  • 6.0.0-next.14                                ...           3 months ago
  • 6.0.0-next.13                                ...           3 months ago
  • 6.0.0-next.12                                ...           3 months ago
  • 6.0.0-next.11                                ...           3 months ago
  • 6.0.0-next.10                                ...           3 months ago
  • 6.0.0-next.9                                ...           3 months ago
  • 6.0.0-next.8                                ...           3 months ago
  • 6.0.0-next.7                                ...           3 months ago
  • 6.0.0-next.6                                ...           3 months ago
  • 6.0.0-next.5                                ...           3 months ago
  • 6.0.0-next.4                                ...           3 months ago
  • 6.0.0-next.3                                ...           3 months ago
  • 6.0.0-next.2                                ...           3 months ago
  • 6.0.0-next.1                                ...           3 months ago
  • 6.0.0-next.0                                ...           3 months ago
  • 5.5.0-next.0                                ...           3 months ago
  • 5.4.0                                ...           3 months ago
  • 5.3.0                                ...           3 months ago
  • 5.2.0                                ...           3 months ago
  • 5.1.0                                ...           8 months ago
  • 5.0.1                                ...           8 months ago
  • 5.0.0                                ...           8 months ago
  • 4.18.0                                ...           8 months ago
  • 4.17.0                                ...           9 months ago
  • 4.17.0-alpha.0                                ...           9 months ago
  • 4.16.0                                ...           10 months ago
  • 4.15.0                                ...           10 months ago
  • 4.14.0                                ...           10 months ago
  • 4.13.0                                ...           10 months ago
  • 4.12.0                                ...           10 months ago
  • 4.11.0                                ...           a year ago
  • 4.10.1                                ...           a year ago
  • 4.10.0                                ...           a year ago
  • 4.9.0                                ...           a year ago
  • 4.9.0-0                                ...           a year ago
  • 4.8.0                                ...           a year ago
  • 4.7.0                                ...           a year ago
  • 4.6.0                                ...           a year ago
  • 4.6.0-11                                ...           a year ago
  • 4.6.0-10                                ...           a year ago
  • 4.6.0-9                                ...           a year ago
  • 4.6.0-8                                ...           a year ago
  • 4.6.0-7                                ...           a year ago
  • 4.6.0-6                                ...           a year ago
  • 4.6.0-5                                ...           a year ago
  • 4.6.0-4                                ...           a year ago
  • 4.6.0-3                                ...           a year ago
  • 4.6.0-2                                ...           a year ago
  • 4.6.0-1                                ...           a year ago
  • 4.6.0-0                                ...           a year ago
  • 4.5.0                                ...           a year ago
  • 4.5.0-0                                ...           a year ago
  • 4.4.0-0                                ...           a year ago
  • 4.3.2                                ...           a year ago
  • 4.4.0                                ...           a year ago
  • 4.3.1                                ...           a year ago
  • 4.3.0                                ...           a year ago
  • 4.2.1                                ...           a year ago
  • 4.2.0                                ...           a year ago
  • 4.1.0                                ...           a year ago
  • 4.0.3                                ...           a year ago
  • 4.0.2                                ...           a year ago
  • 4.0.1                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.3.1-10                                ...           a year ago
  • 3.3.1-9                                ...           a year ago
  • 3.3.1-8                                ...           a year ago
  • 3.3.1-7                                ...           a year ago
  • 3.3.1-6                                ...           a year ago
  • 3.3.1-5                                ...           a year ago
  • 3.3.1-4                                ...           a year ago
  • 3.3.1-3                                ...           a year ago
  • 3.3.1-2                                ...           a year ago
  • 3.3.1-1                                ...           a year ago
  • 3.3.1-0                                ...           a year ago
  • 3.3.0                                ...           a year ago
  • 3.2.0                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.2.2                                ...           a year ago
  • 2.2.1                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.0.3-0                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0-0                                ...           a year ago
  • 1.15.5                                ...           a year ago
  • 1.15.4                                ...           a year ago
  • 2.1.4                                ...           2 years ago
  • 2.1.3                                ...           2 years ago
  • 2.1.2                                ...           2 years ago
  • 2.1.1                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.15.3                                ...           2 years ago
  • 1.15.2                                ...           2 years ago
  • 1.15.1                                ...           2 years ago
  • 1.15.0                                ...           2 years ago
  • 1.14.0                                ...           2 years ago
  • 1.13.0                                ...           2 years ago
  • 1.12.0                                ...           2 years ago
  • 1.11.0                                ...           2 years ago
  • 1.10.0                                ...           2 years ago
  • 1.9.0                                ...           2 years ago
  • 1.8.6                                ...           2 years ago
  • 1.8.5                                ...           2 years ago
  • 1.8.4                                ...           2 years ago
  • 1.8.3                                ...           2 years ago
  • 1.8.2                                ...           2 years ago
  • 1.8.1                                ...           2 years ago
  • 1.8.0                                ...           2 years ago
  • 1.7.1                                ...           2 years ago
  • 1.7.0                                ...           2 years ago
  • 1.7.0-0                                ...           2 years ago
  • 1.6.0                                ...           2 years ago
  • 1.5.0                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.14                                ...           2 years ago
  • 1.0.13                                ...           2 years ago
  • 1.0.12                                ...           2 years ago
  • 1.0.11                                ...           2 years ago
  • 1.0.10                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |