Naturally Pacifist Marsupials

    @redneckz/slice-node-modules

    0.0.7 • Public • Published

    slice-node-modules

    List only needed modules to package/archive/zip before going to production (packaging of AWS Lambda, for example)

    NPM Version Build Status Coverage Status Bundle size

    Installation

    npm install --save-dev @redneckz/slice-node-modules

    Using npx:

    npx @redneckz/slice-node-modules [-e <source file>] [-p <package.json>] [--dev|-D] [--print0|-0]

    How-to

    List all packages used by some-package:

    # Parse dependencies from source files (-e stands for entry file) 
    $ npx @redneckz/slice-node-modules -e some-package/lib/index.js
    # or from package.json 
    $ npx @redneckz/slice-node-modules -p some-package/package.json

    Dev. dependencies:

    $ npx @redneckz/slice-node-modules -e some-package/lib/index.js --dev

    Filtering options --include/--exclude:

    $ npx @redneckz/slice-node-modules -e some-package/lib/index.js --exclude 'aws-*'

    Zero-separated (for xargs, for example):

    $ npx @redneckz/slice-node-modules -e some-package/lib/index.js --print0

    AWS Lambda Packaging

    In case of monorepo (just for example):

    $ npx @redneckz/slice-node-modules -e monorepo-root/packages/some-lambda/lib/index.js --exclude 'aws-*' --zip some-lambda.zip

    AWS Lambda config (CloudFormation):

    const logLambda = new Function(this, 'some-lambda', {
      code: new AssetCode('some-lambda.zip'),
      handler: 'monorepo-root/packages/some-lambda/lib/index.handler',
      runtime: Runtime.NODEJS_12_X
    });

    License

    MIT

    Install

    npm i @redneckz/slice-node-modules

    DownloadsWeekly Downloads

    13

    Version

    0.0.7

    License

    MIT

    Unpacked Size

    14.1 kB

    Total Files

    19

    Last publish

    Collaborators

    • redneckz