Script to remove unnecessary properties from package.json on prepublish hook

Overview

clean-pkg-json

Script to remove unnecessary properties from package.json on prepublish hook.

Support this project by ⭐️ starring and sharing it. Follow me to see what other cool projects I'm working on! ❤️

Why?

package.json is primarily for declaring an npm package and describing how it can be consumed.

However, it can often get bloated with development concerns such as devDependencies and configuration like eslintConfig, prettier, lint-staged, simple-git-hooks, etc.

Use clean-pkg-json in a prepublish hook to remove unnecessary properties from package.json. Useful in micropackages where every byte matters.

Usage

Add clean-pkg-json to the prepack hook, which runs before npm publish and npm pack.

// package.json
{
    "name": "my-package",
    // ...
    "scripts": {
        // ...
        "prepack": "clean-pkg-json"
    }
}

Flags

Flag Description
-k, --keep <property name> Property names to keep. Accepts multiple flags or a comma-delimited list.
-v, --verbose Verbose logs.
-d, --dry Dry run mode. Instead of writing to disk, it will log it.
-h, --help Show help
--version Show version

Default preserved properties

By default, these properties are preserved in package.json:

name, version, private, publishConfig, type, scripts.preinstall, scripts.install, scripts.postinstall, scripts.prepublish, scripts.preprepare, scripts.prepare, scripts.postprepare, files, bin, browser, main, module, types, exports, imports, man, dependencies, peerDependencies, peerDependenciesMeta, bundledDependencies, optionalDependencies, engines, os, cpu, description, keywords, author, contributors, license, homepage, repository, bugs, funding

You might also like...

Mirrors the functionality of Apollo client's useQuery hook, but with a "query" being any async function rather than GQL statement.

useAsyncQuery Mirrors the functionality of Apollo client's useQuery hook, but with a "query" being any async function rather than GQL statement. Usage

Nov 16, 2022

📋 useClipboardApi() is a React Hook that consumes Web Clipboard API.

📋 use-clipboard-api useClipboardApi() is a React Hook that consumes Web Clipboard API. Table of Contents Motivation Usage Contributing Bugs and Suges

Dec 15, 2022

A custom react hook to use a dialogs easily.

dialog-hook The dialog-hook is a custom react hook to use a dialog easily. First of all it is necessary to install the package in your project some co

Mar 29, 2022

An easy hook to use with expo-calendar library!

useCalendar Hook 🚀 Updated to Expo SDK45 This is an easy hook to use expo-calendar. It allows you: Get access permission to calendar Open settings to

Nov 1, 2022

How to submit HTML forms to Google Sheets. (Updated for 2021 Script Editor)

How to submit HTML forms to Google Sheets. (Updated for 2021 Script Editor)

Submit a HTML form to Google Sheets How to submit a simple HTML form to a Google Sheet using only HTML and JavaScript. Updated for Google Script Edito

Jan 6, 2023

A node script that lists the cities on Santa's route from santatracker.google.com

Google Santa Route A script that lists the cities on Santa's route from santatracker.google.com based on the JSON containing all Santa's destinations.

Dec 24, 2021

An implementation of React v15.x that optimizes for small script size

react-lite Introduction react-lite is an implementation of React that optimizes for small script size. Note: react-lite dose not support React v16.x n

Dec 10, 2022

A very lightweight and flexible accessible modal dialog script.

A11y Dialog This is a lightweight (1.3Kb) yet flexible script to create accessible dialog windows. Documentation ↗ Demo on CodeSandbox ↗ Features: Clo

Jan 2, 2023

Bookstore CMS React Front-End to display a list of books, categorize it, add and remove books and update your reading progress

Bookstore CMS React Front-End to display a list of books, categorize it, add and remove books and update your reading progress

Bookstore REACT app to manage your books Build an app to display a list of books, categorize it, add and remove books and update your reading progress

Aug 19, 2022
Comments
  • feat: add more well-known fields by default

    feat: add more well-known fields by default

    Reference: https://angular.io/guide/angular-package-format#legacy-resolution-keys

    Related fields: fesm2020 / fesm2015 / esm2020 / es2020

    I'm glad to raise a PR for it.

    released 
    opened by JounQin 10
Releases(v1.2.0)
Owner
hiroki osame
I'm on a mission to open source my solutions 🚀
hiroki osame
JSON Hero is an open-source, beautiful JSON explorer for the web that lets you browse, search and navigate your JSON files at speed. 🚀

JSON Hero makes reading and understand JSON files easy by giving you a clean and beautiful UI packed with extra features.

JSON Hero 7.2k Jan 9, 2023
ESLint plugin for react-hook-form

eslint-plugin-react-hook-form react-hook-form is an awsome library which provide a neat solution for building forms. However, there are many rules for

Chuan-Tse Kao 37 Nov 22, 2022
An extremely helpful React Hook to trap the focusable elements / Hello Modals! Hello a11y!

react-use-focus-trap Everytime when people implement Modals... ...People forget that pro users as well as users that are permanently or temporarily re

David Lorenz 18 Nov 30, 2022
This hook allows you to isolate and manage the state within the component, reducing rendering operations and keeping the source code concise.

React Hook Component State This hook allows you to isolate and manage the state within the component, reducing rendering operations and keeping the so

Yongwoo Jung 2 May 15, 2022
A hook based project created during 20-Dec week ReactJS workshop

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Nabendu 1 Dec 25, 2021
React hook library, ready to use, written in Typescript.

usehooks-ts React hook library, ready to use, written in Typescript. npm i usehooks-ts Created by Julien Caron and maintained with ❤️ by an amazing te

Julien 2.8k Jan 5, 2023
react-dialog is a custom react hook to use a dialog easily

react-dialog react-dialog is a custom react hook to use a dialog easily. Documentation To use react-dialog follow the documentation. useDialog Returns

Levy Mateus Macedo 2 Mar 29, 2022
Small (0.5 Kb) react hook for getting media breakpoints state info in runtime

tiny-use-media Small (0.5 Kb) react hook for getting media breakpoints state info in runtime Usage npm i tiny-use-media --save Adn in your react code

Valeriy Komlev 51 Dec 13, 2022
A reusable react hook that preserves a components semantic accessibility to create a visual block link.

useAccessibleBlockLink is a reusable react hook that preserves a components semantic accessibility to create a visual block link. This hook supports multiple links within the same block.

Wayfair Tech – Incubator 4 Nov 28, 2022
🌐 Unlimited free google translate component & hook

React Native Translator Preview Introduce Free translate component & hook Never need api key, This library is Unlimited free Support translators Googl

Hyun 34 Dec 18, 2022