Crossfeed is a monorepo that uses Node Package Manager (NPM). NPM manages Crossfeed dependencies using five separate package.json files.
./package.json
backend/package.json
docs/package.json
frontend/package.json
frontend/scripts/package.json
There is overlap between the package files meaning NPM installs some packages multiple times. Each instance of a package means an additional download from the Node registry, and an additional instance of the package stored in the project.
Why does this work belong in this project?Performant Node Package Manager (PNPM) is an alternative package manager that creates a global store for all node modules on a system. This means that the same dependency found in three separate directories will be downloaded only once and installed only once. Additionally, project-wide dependencies can be specified once in the parent directory, instead of needing to be specified in multiple package files.
This would be useful because...
Fewer downloads and fewer installs improves the project build time which reduces downtime during local development.
Being able to specify project-wide dependencies makes updating dependencies simpler. For example, updating Jest for the project now requires modifying three separate package files and Dependabot creates three separate pull requests. Using PNPM would allow us to specify Jest in one file meaning fewer pull requests to review, and fewer lines of code to update.
PNPM provides the option to create branch-specific lock files. These can reduce merge conflicts related to dependency changes.
Implementation notes
AWS Lambda does not support symlinks so we would need to specify node-linker=hoisted in the .npmrc file. .npmrc files support setting environment variables meaning we can implement symlinks for local development and a flat node-modules file for use in AWS. Source
💡 Summary
Motivation and context
Crossfeed is a monorepo that uses Node Package Manager (NPM). NPM manages Crossfeed dependencies using five separate package.json files.
There is overlap between the package files meaning NPM installs some packages multiple times. Each instance of a package means an additional download from the Node registry, and an additional instance of the package stored in the project.
Why does this work belong in this project? Performant Node Package Manager (PNPM) is an alternative package manager that creates a global store for all node modules on a system. This means that the same dependency found in three separate directories will be downloaded only once and installed only once. Additionally, project-wide dependencies can be specified once in the parent directory, instead of needing to be specified in multiple package files.
This would be useful because...
Implementation notes
AWS Lambda does not support symlinks so we would need to specify
node-linker=hoisted
in the .npmrc file. .npmrc files support setting environment variables meaning we can implement symlinks for local development and a flat node-modules file for use in AWS. SourceAcceptance criteria
How do we know when this work is done?