diff --git a/README.md b/README.md index e65f6a68..91d8612b 100644 --- a/README.md +++ b/README.md @@ -39,15 +39,16 @@ provided. ```ts import { DependencyUpdate, - FileUpdate, + writeAll, } from "https://deno.land/x/molt@{VERSION}/mod.ts"; const updates = await DependencyUpdate.collect("./mod.ts", { importMap: "./deno.json", }); -const results = FileUpdate.collect(updates); -await FileUpdate.write(results); +await writeAll(results, { + onWrite: (file) => console.log(`💾 ${file.specifier}`), +}); ``` ##### Update all dependencies in a module and commit the changes to local git repository diff --git a/lib/file.ts b/lib/file.ts index b7b37b68..1a11011b 100644 --- a/lib/file.ts +++ b/lib/file.ts @@ -14,8 +14,8 @@ import { URI } from "./uri.ts"; * @example * ```ts * await writeAll(updates, { - * onWrite: (update) => { - * console.log(`Updated ${update.specifier}`); + * onWrite: (file) => { + * console.log(`Updated ${file.specifier}`); * }, * }); * ``` @@ -23,7 +23,7 @@ import { URI } from "./uri.ts"; export function writeAll( updates: DependencyUpdate[], options?: { - onWrite?: (result: FileUpdate) => void | Promise; + onWrite?: (file: FileUpdate) => void | Promise; }, ) { return FileUpdate.write(FileUpdate.collect(updates), options); diff --git a/mod.ts b/mod.ts index 43affb5b..a71cac4c 100644 --- a/mod.ts +++ b/mod.ts @@ -10,19 +10,23 @@ * ```ts * import { * DependencyUpdate, - * FileUpdate, + * writeAll, * } from "https://deno.land/x/molt@{VERSION}/mod.ts"; * * const updates = await DependencyUpdate.collect("./mod.ts", { * importMap: "./deno.json", * }); * - * const results = FileUpdate.collect(updates); - * await FileUpdate.write(results); + * await writeAll(updates); * ``` * * @module */ export { DependencyUpdate } from "./lib/update.ts"; -export { FileUpdate } from "./lib/file.ts"; +export { FileUpdate, writeAll } from "./lib/file.ts"; +export type { Dependency, LatestDependency } from "./lib/dependency.ts"; +export type { SemVerString } from "./lib/semver.ts"; +export type { ImportMap } from "./lib/import_map.ts"; +export type { URI } from "./lib/uri.ts"; +export type { Path } from "./lib/types.ts";