Socket
Book a DemoInstallSign in
Socket

npm-prepare-dist

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-prepare-dist

Prepare library for NPM distribution

latest
Source
npmnpm
Version
0.5.0
Version published
Weekly downloads
228
-37.36%
Maintainers
1
Weekly downloads
 
Created
Source

npm version npm downloads Package License Build & Publish codecov

NPM Prepare Dist CLI

Clean and prepare dist folder and all files before publishing your NPM library

  • Potentially smaller build and faster installation of your library
  • TypeScript, JavaScript, CLI version
  • Useful options

Install

via yarn

yarn add npm-prepare-dist --dev

via npm

npm install npm-prepare-dist --save-dev

Usage

CLI

npm-prepare-dist
  • Main package.json file will be copied into your dist folder
  • devDependencies will be removed
  • More useless options will be removed
  • README.md (and other files) will be copied into dist folder as you wish

JavaScript

import { prepareDist } from 'npm-prepare-dist';

prepareDist('build', ['README.md', 'LICENSE', 'icon.svg'], './src/');

Example

Highly recommended to use as postbuild hook in you package.json

{
  "name": "my-project",
  "scripts": {
    "build": "tsc",
    "postbuild": "npm-prepare-dist"
  }
}

Options

OptionDescriptiondefaultexample
-h, --helpDisplay this usage info--
-v, --versionShow version--
-d, --distDist folder pathdist-d build
-f, --filesArray of files to copy into dist folder as wellREADME.md-f README.md -f LICENSE
-m, --mainMain folder where. Usually where is your index.js./-m ./src/
-s, --remove-scriptRemove script in package.json--s postinstall -s test
--remove-depsRemove all dependencies from package.json---remove-deps

Development

I welcome you to customize this according to your needs ;)

Pull requests for any improvements would be great!

Developing and debugging this library

git clone git@github.com:bartholomej/npm-prepare-dist.git
cd npm-prepare-dist
yarn
yarn start

Run demo locally

You can find and modify it in ./demo.ts file

yarn demo

Donation

If this project have helped you save time please consider making a donation for some 🍺 or 🍵 ;)

Privacy Policy

I DO NOT STORE ANY DATA. PERIOD.

I physically can't. I have nowhere to store it. I don't even have a server database to store it. So even if Justin Bieber asked nicely to see your data, I wouldn't have anything to show him.

That's why, with this library, what happens on your device stays on your device till disappear.

License

Copyright © 2021 Lukas Bartak

Proudly powered by nature 🗻, wind 💨, tea 🍵 and beer 🍺 ;)

All contents are licensed under the MIT license.

Keywords

npm

FAQs

Package last updated on 21 Aug 2024

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