diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-05-18 20:50:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-18 15:50:57 -0400 |
commit | 76ee5c780848a922dfc0ab8ac48096ab2262cc4a (patch) | |
tree | 44ca80c376cd2ecaa343877d642c2b9a85c14372 /docs/linking_to_external_code/integrity_checking.md | |
parent | 93c21646739a46a9710be9d580256e18bee740c0 (diff) |
docs: Clarify external code vendoring (#5597)
Diffstat (limited to 'docs/linking_to_external_code/integrity_checking.md')
-rw-r--r-- | docs/linking_to_external_code/integrity_checking.md | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/docs/linking_to_external_code/integrity_checking.md b/docs/linking_to_external_code/integrity_checking.md index 820ea1d2b..91d595cda 100644 --- a/docs/linking_to_external_code/integrity_checking.md +++ b/docs/linking_to_external_code/integrity_checking.md @@ -1,5 +1,33 @@ ## Integrity checking & lock files -Deno can store and check module subresource integrity for modules using a small -JSON file. Use the `--lock=lock.json` to enable and specify lock file checking. -To update or create a lock use `--lock=lock.json --lock-write`. +Deno can store and check subresource integrity for modules using a small JSON +file. Use the `--lock=lock.json` to enable and specify lock file checking. To +update or create a lock use `--lock=lock.json --lock-write`. + +A typical workflow will look like this: + +```ts +// Add a new dependency to "src/deps.ts", used somewhere else. +export { xyz } from "https://unpkg.com/xyz-lib@v0.9.0/lib.ts"; +``` + +```shell +# Create/update the lock file "lock.json". +deno cache --lock=lock.json --lock-write src/deps.ts + +# Include it when committing to source control. +git add -u lock.json +git commit -m "feat: Add support for xyz using xyz-lib" +git push +``` + +Collaborator on another machine -- in a freshly cloned project tree: + +```shell +# Download the project's dependencies into the machine's cache, integrity +# checking each resource. +deno cache -r --lock=lock.json src/deps.ts + +# Done! You can proceed safely. +deno test --allow-read src +``` |