Managing dependencies
- One convention places all these dependent URLs into a local file.
Functionality is then exported out of
deps.ts
for use by local modules. - Continuing this convention, dev only dependencies can be kept in a
dev_deps.ts
file. - See also Linking to external code
The standard practice for solving this problem in Deno is to create a
file. All required remote dependencies are referenced in this file and the
required methods and classes are re-exported. The dependent local modules then
reference the deps.ts
rather than the remote dependencies. If now for example
one remote dependency is used in several files, upgrading to a new version of
this remote dependency is much simpler as this can be done just within
deps.ts
.
With all dependencies centralized in , managing these becomes easier.
Dev dependencies can also be managed in a separate dev_deps.ts
file, allowing
clean separation between dev only and production dependencies.
Command:
```ts, ignore /**
function totalCost(outbound: number, inbound: number, tax: number): number { return multiply(add(outbound, inbound), tax); }
console.log(totalCost(19, 31, 1.2)); console.log(totalCost(45, 27, 1.15));
- Output *
- 60
- 82.8 */ ```