Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
/ macro-node-prune Public archive

[DEPRECATED] Please use `@architect/plugin-node-prune`

License

Notifications You must be signed in to change notification settings

architect/macro-node-prune

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js-specific Architect macro 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 pruner script source.

Installation

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

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

@macros
architect/macro-node-prune

Note, no @ in the macro 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 macro

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

@macros
# architect/macro-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 macro runs just prior to deployment, it must avoid Architect shared code dirs so as not to inadvertently destroy user files.
    • As such, any node_modules folders within src/shared or src/views will not be pruned.
  • This macro relies on shelling out to a bash script, so ymmv on Windows.

About

[DEPRECATED] Please use `@architect/plugin-node-prune`

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •