Coder Social home page Coder Social logo

packito's Introduction

๐Ÿ“ฆ Packito

Build Status codecov NPM version License

Packito is a cli tool to clean package before publishing it.

Purpose

Before publishing to npm, did you take care of your package.json ?

  • devDependencies, some scripts and other entries("husky", ...) could be removed.
  • add some new or change entries, like "main" source file name
  • use a dist file and copy some extra files/directories in it (README.md, LICENSE, ...).
  • and finally publish your package using npm, np or lerna.

Simple using one command:

$ packito

By default it will remove "scripts" and "devDependencies", copy README.md and LICENSE if they exist to './dist' folder.

Install

$ yarn add --dev packito

Or using npm

$ npm add --dev packito

Usage

$ packito [options] [bin-to-publisher]

Options

name alias description
--dist -d Path to publish from
--nopublish -n Skips publishing step
--help -h Displays help informations

Bin to publisher

name description
npm Publish using npm
lerna Publish using npm
np Publish using np

.packito.json

It is the configuration file. This json should be at root of the project, a sample:

{
  "remove": {
    "devDependencies": "*",
    "scripts": "*",
    "type": true,
    "esm": true,
    "husky": true,
    "commitlint": true
  },
  "replace": {
    "main": "index.js",
    "module": "index.mjs"
  },
  "publisher":  "np"
}
name type description
remove object all keys to remove from packages.json (if =true or ='*' replace all)
replace object all keys+values to replace in packages.json
copy object all files to copy in dist
output string folder to publish to
publisher string|object The publisher to use (npm, np, lerna)

Other command examples

Publish to path 'publish'

$ packito -d ./publish

Publish to path 'publish' and use np patchto publish

$ packito -d ./publish np patch

Coded using state of the art and simplicity in mind

  • Simple to use
  • Modern ES6+ syntax (import instead of require, await/async, ...)
  • Follows Node best practices

Requirements

  • Node >= 12

Contribution

Read Contributing Guide for development setup instructions.

packito's People

Contributors

dependabot[bot] avatar mikbry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tibor19

packito's Issues

bug: CI Travis failed instead of local

Description

Build error

18 passing (6s)

  3 failing

  1) Packito

       publish not valid publisher command:

     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/travis/build/mikbry/packito/test/packito.test.js)

      at listOnTimeout (internal/timers.js:549:17)

      at processTimers (internal/timers.js:492:7)

  2) Packito

       publish valid command using publisherArguments:

     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/travis/build/mikbry/packito/test/packito.test.js)

      at listOnTimeout (internal/timers.js:549:17)

      at processTimers (internal/timers.js:492:7)

  3) Packito

       publish valid command using publisher prop:

     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/travis/build/mikbry/packito/test/packito.test.js)

      at listOnTimeout (internal/timers.js:549:17)

      at processTimers (internal/timers.js:492:7)

Expected behaviour

Should pass as on my dev machine

[bug] publisher and publisher args are ignored

Description

Running packito without the -n arg, thus with the intention to publish, does not publish packages.

I could have missed something, but it appears that nothing calls the publish function?

Expected behaviour

If a bug, what do you expect ?

Expect packito to publish given the publisher and publisher args.

Actual behaviour

Packito exits after bundling the code.

Steps to reproduce

If a bug, how do you reproduce it :

  • run packito without the -n option, and passing in a publisher and args
npx packito -d ./dist npm

Environnement

Node v14.15.1
Npm 6.14.8
OS: Max OS X Catalina

[feat]: Implements publisher

Description

$ packito yarn publish

the command yarn publishshould be run at the end of packito process.

Same from .packito.json:

{
  "publisher": "yarn publish"
} 

[feat] default configuration

Description

By default it will remove "scripts" and "devDependencies", copy README.md and LICENSE if they exist to './dist' folder.

feat: migrate to Rust

Description

As an experiment migrate to Rust / WASM

Expected behaviour

Run as previously

feat: update the bin path

Description

In my package, I have

"bin": "dist/cli.mjs",

but when I publish with packtio, it stays the same.

Expected behaviour

I would like this to become just "cli.mjs".

Actual behaviour

In dist/package.json, it still says "bin": "dist/cli.mjs",

Environnement

Node version 16
OS Windows

Further Notes

The package.json "bin" can be a string or a object of type Record<string, string>.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.