Socket
Socket
Sign inDemoInstall

@architect/arc-plugin-node-prune

Package Overview
Dependencies
0
Maintainers
7
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @architect/arc-plugin-node-prune

Architect serverless framework plugin that runs node-prune on functions prior to deployment


Version published
Weekly downloads
6
Maintainers
7
Install size
20.8 kB
Created
Weekly downloads
 

Changelog

Source

[1.0.0 - 1.0.1] 2019-02-03

Changed

  • Removes binary dists in favor of bash-based operations
    • Massively smaller module payload
    • Needed to ensure we can ignore files in @architect/[shared|views], which are Architect's shared code paths copied into Functions' node_modules
    • No human-discernible perf impact on normal size projects

Readme

Source

@architect/arc-plugin-node-prune

Node.js-specific Architect plugin based on node-prune that cleans node_modules cruft from your Functions during deployment

Warning

Pruning your node_modules tree(s) has some inherent risks. While we have found it to be stable and reliable, the packages your project uses may provide different results.

For example: while unlikely, a package that includes and makes use of a file with a commonly .npmignored filename may be impacted by this pruner. For a list of files and folders that are pruned, please review the script.

Installation

  1. Run: npm i @architect/arc-plugin-node-prune

  2. Then add the following to your Architect project file (usually .arc):

@plugins
architect/arc-plugin-node-prune

Note, no @ in the plugin name!

  1. Deploy your project (npx deploy) and watch the filesizes drop 📉

Results

In practice, we have seen average filesize and file count reductions of about 25-30% across the board. That's a meaningful number for cloud functions!

Disabling the plugin

If for whatever reason you need to disable the plugin, simply comment it out in (or remove it from) your Architect project file:

@plugins
# architect/arc-plugin-node-prune

Limitations

  • Architect supports shared code by selectively copying src/shared and src/views into all Functions' node_modules dirs by default.
    • Because this plugin runs just prior to deployment, it must avoid Architect shared code dirs so as not to inadvertently destroy user files.
    • As such, any modules shared via src/shared and src/views will not be pruned.
  • This plugin relies on shelling out to a bash script, so ymmv on Windows.

Keywords

FAQs

Last updated on 04 Feb 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc