0.5.2 • Published 5 years ago

publish-it v0.5.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

publish-it

Attempt to simplify publishing of a js library with different types of source files.

Why should I use this ?

I've started developing a private util library and realized there was no obvious, straight-forward way of publishing a package with different source files. I investigated what other utils packages are doing and got some inspiration from lodash, that has on it's root, the es5 files and a folder for the es files, so this way the consumer could decide which one to go for.

So this is the main use case of this package, to be able to publish your library simply be defining what type of files are you publishing. It runs under the hood npm publish so it should be able to work together with post publish scripts.

Usage

npm install publish-it --save-dev

There are several options for config. Either pass an object to publishLib, or define a .publishitrc, publishit in package.json or CommonJS publishit.config.js.

const publishLib = require("publish-it")

publishLib({
    libFolder: "dist",
    srcFolder: "src",
    extraFilesCopy: ["README.md"],
    ignoreFiles: /spec./,
    dryRun: false,
    output: {
        es: true,
        umd: "npm run something",
        cjs: "npm run anything"
    }
})

or

{
	"libFolder": "dist",
	"srcFolder": "src",
	"extraFilesCopy": ["README.md"],
	"ignoreFiles": "/spec./",
	"dryRun": false,
	"output": {
		"es": true,
		"umd": "npm run something",
		"cjs": "npm run anything"
	}
}

Add a script to your package.json file

"scripts": {
    "...": "",
    "publish-it": "node ./path/to/publish.js"
}

publish-it cli

You can use npx to use the cli.

npx publish-it

Config can still be specified on a rc file (or other options as stated before), or trough the cli. See npx publish-it --help for options.

Configuration

nametypeDescriptionDefault
libFolderstringFolder that will be the root of the published package.dist (Add it to your .gitignore)
srcFolderstringLocation of the source files---
dryRunbooleanSkip publishing the packagefalse
fileFormatarrayFile format to copy["js"]
extraFilesCopyarrayExtra files that will be copied to published package root---
ignoreFilesregexFiles to be ignored---
packageAccessstringPublish public or restricted packagepublic
rootstringOne of es, es5, cjs or umdes
outputobjectType of files to output---
nextbooleanPublish package as a nextfalse
0.5.2

5 years ago

0.5.1

5 years ago

15505.19338.278

5 years ago

15505.19237.344

5 years ago

15505.19151.832

5 years ago

15505.18551.498

5 years ago

0.5.0

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago