Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

publish-it

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

publish-it

Publish your library differently

  • 0.5.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 23 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc