Will it get modified from the original? • How to upgrade? Will it work after an upgrade? • What about dependencies of dependencies? • Use a “dependencies file” • How to identify? URLs? Versions? • Needs a tool to resolve recursively • Needs a tool to fetch all properly How to include? Dependencies
fixes • Minor: new features + above • Major: BREAKING CHANGES + above • Still prone to human error but good enough™ Semantic Versioning Versioning: semver
enough • Prevents progress • Requires everyone to watch all updates in all dependencies • The most used versioning range: ^ • ^1.2.3: all minor and patch versions above this • Allows new features and fixes while providing stability • Other notables: ~, *, 1.x.x, <=, >= Version ranges Versioning: semver
Will break if there are major (breaking) version changes • Give everyone what they want • Waste of disk and memory • Hard to track who uses which version • Can cause issues in code when comparing objects • Will almost always work Potential solutions Versioning: collisions
version ranges to latest available and compatible versions of packages 02 Transitive dependencies Get dependencies of dependencies of dependencies of dependencies… 03 Optimize the dependency tree Try to collapse version ranges and reuse already available packages 04 Ensure consistency Ensure consistency across time and systems. AKA reproducible installs 05 Download & Install Download all the packages, cache them and then put them into the right places.
parallel, unoptimized, bound by network • Installation order changed the end result • Had a very deep tree without optimization • Was OK for smaller applications Early npm versions (v1 to v4) Dependency managers
the internet • Running an internal registry is not easy • Keeping up to date • Keeping everything vs. only what is needed • Controversial idea: put package tarballs into version control Offline mirror Yarn
• Impossible w/o forking, worse if deeper in the chain • “resolutions” field in “package.json” • Override resolutions in yarn.lock • Life saver during migrations Selective version resolutions Yarn
dependency management • Encourages code separation • Challenge: working across “internal” packages consistently • Automatic linking across workspace directories • Used inside FB monorepo and open source: Babel, React etc. Workspaces Yarn