npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easy-dist

v1.1.1

Published

Copy source files and node_modules without devDependencies to destination directory.

Downloads

126

Readme

Easy-Dist

Copy source files and node_modules without devDependencies to destination directory.

Installation

npm install easy-dist --save

Usage

CLI

# copy current path(.) to dist directory
npx easy-dist

# copy specific path to custom dist directory
npx easy-dist libs/* graphql/* --out mydist

# copy node_modules only
npx easy-dist --no-files

Javascript

import { easyDist } from 'easy-dist'

await easyDist({ src: '.' })

Documents

Usage:

  $ easy-dist <path ...> [options]

Synopsis:

  $ easy-dist [--timeout ms] --src file ...
  $ easy-dist --help

Options:

  -h, --help         Display this usage info.
  -V, --version      Output the version number.
  -v, --verbose      Increase the verbosity of messages.
  -o, --out string   Copy all input files into an output directory.
                     [default: dist]
  --no-clean         Without cleaning the output directory.

Module Options:

  --no-files                 Run without copying files.
  --no-modules               Run without copying node_modules.
  -M, --module-path string   Change node_modules path.
  -D, --dev                  Copy modules in devDependencies also.
  -B, --bin                  Copy .bin also.

Examples

with AWS CDK

When you deploy your Lambda project using the AWS CDK, you also need to deploy node_modules. Lambda has a capacity limit. You can use easy-dist to copy node_modules except devDependencies.

file: package.json

{
  "scripts": {
    "build": "npm run build:infra && npm run build:server",
    "build:server": "babel ./src --out-dir ./src-dist --extensions \".ts\"",
    "build:infra": "babel ./infra --out-dir ./infra-dist --extensions \".ts\"",
    "deploy": "npm run build && easy-dist ./src-dist/* && cdk deploy"
  },
  "dependencies": {
    "core-js": "^3.6.0"
  },
  "devDependencies": {
    "@aws-cdk/aws-apigateway": "^1.19.0",
    "@aws-cdk/aws-lambda": "^1.19.0",
    "@aws-cdk/core": "^1.19.0",
    "@babel/cli": "7.7.7",
    "@babel/core": "7.7.7",
    "@babel/plugin-proposal-class-properties": "7.7.4",
    "@babel/plugin-proposal-decorators": "7.7.4",
    "@babel/plugin-proposal-object-rest-spread": "7.7.7",
    "@babel/preset-env": "7.7.7",
    "@babel/preset-typescript": "7.7.7",
    "@types/aws-lambda": "^8.10.39",
    "@types/graphql": "14.5.0",
    "@types/node": "^12.12.21",
    "aws-cdk": "^1.19.0",
    "easy-dist": "^1.1.0",
    "source-map-support": "^0.5.16",
    "typescript": "^3.7.3"
  }
}

API

interface EasyDistOptions {
  src: string[] | string
  basePath?: string
  out?: string
  modulePath?: string
  noModules?: boolean
  dev?: false
  bin?: false
}

export interface EasyDistResult extends Promise<void> {
  on(
    event: 'progress',
    listener: (
      name: 'CLEAN' | 'COPY_SOURCE_FILES' | 'COPY_NODE_MODULES'
    ) => void
  ): this
  on(event: 'copy', listener: (src: string, dest: string) => void): this
  on(event: 'done', listener: () => void): this
}

function easyDist(options: EasyDistOptions): EasyDistResult