Package Exports
- @architect/hydrate
- @architect/hydrate/src/cli
- @architect/hydrate/src/cli.js
- @architect/hydrate/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@architect/hydrate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@architect/hydrate

@architect/hydrate ensures that all functions managed by Architect have their dependencies installed. Functions containing all required dependencies are considered to be 'hydrated' - thus the name!
@architect/hydrate supports dependencies managed in the following languages using the following package managers:
- Node.js via
npm
usingpackage.json
(and optionallypackage-lock.json
), or viayarn
usingpackage.json
andyarn.lock
- Python via
pip3
using arequirements.txt
file - Ruby via
bundle
usingGemfile
andGemfile.lock
files
Installation
npm install @architect/hydrate
API
All methods accept an options
object can include the following properties:
autoinstall
- Boolean - Enables or disables automated Lambda dependency treeshaking via static code analysis- Defaults to
false
- Used by
install
- Defaults to
basepath
- String - Filesystem path in which Hydrate should search for functions- Defaults the current working directory
- Useful if you want to hydrate one function or a subset of functions
- Used by
install
+update
copyShared
- Boolean - Enables or disables copying of shared code folders (e.g.src/shared
) into Lambdas- Useful to disable if you want to just hydrate external dependencies
- Defaults to
true
- Used by
install
+update
cwd
- String - Root filesystem path of the project Hydrate is working in- Defaults to current working directory
- May be the same or different from
basepath
; if using in conjunction withbasepath
, specify a subset of the project withbasepath
, for example:{ cwd: '/your/project/', basepath: '/your/project/src/http/' }
runs Hydrate against/your/project/
(without having to useprocess.chdir
) and only hydrates functions within/your/project/src/http/**
- Used by
install
+update
+shared
hydrateShared
- Boolean - Enables or disables dependency hydration in shared code folders (e.g.src/shared
)- Useful to disable if you want to just hydrate external dependencies
- Defaults to
true
- Used by
install
+update
inventory
- Object - Architect Inventory object; generally used internallylocal
- Boolean - Favor the local platform during installation of dependencies that may be distributed as platform-specific binariesonly
- String - Specify a subset of possible shared files forshared
to copy into Lambdas- Falsy by default
- Accepts:
shared
,views
, orstaticJson
- Used by
shared
quiet
- Boolean - Disables (most) loggingsymlink
- Boolean - Enables or disables symlinking instead of full directory copying, useful for local development- Defaults to
false
- Used by
install
+update
+shared
- Defaults to
timeout
- Number - Amount of time in milliseconds to give each package manager process to execute- Used by
install
+update
- Used by
verbose
- Boolean - Enables verbose logging
Note on
cwd
vsbasepath
:cwd
is necessary for Hydrate to find your project's manifest and key files and folders, whilebasepath
scopes hydration to a specific path. When in doubt, include neither parameter, Hydrate will default to process working directory; if you know you need to aim Hydrate at a specific place but aren't sure which parameter to use, usecwd
.
hydrate.install(options[, callback]) → [Promise]
Installs function dependencies, then invokes hydrate.shared()
.
To ensure local development behavior is as close to staging
and production
as possible, hydrate.install()
(and other hydrate functions) uses:
- Node.js:
npm ci
ifpackage-lock.json
is present andnpm i
if not; oryarn
- Python:
pip3 install
- Ruby:
bundle install
Note: by default update
also installs dependencies in shared folders like src/shared
and src/views
.
hydrate.update(options[, callback]) → [Promise]
Updates function dependencies, then invokes hydrate.shared()
.
update
is functionally almost identical to install
, except it will update dependencies to newer versions if they exist. This is done via:
- Node.js:
npm update
oryarn upgrade
- Python:
pip3 install -U --upgrade-strategy eager
- Ruby:
bundle update
Note: by default update
also updates dependencies in shared folders like src/shared
and src/views
.
hydrate.shared(options[, callback]) → [Promise]
Copies shared code (from src/shared
and src/views
, or your custom @shared
+ @views
paths, if any) into all functions.