Skip to content

Commit

Permalink
refactor(git)!: mv git/mod.ts to src/git.ts and create git.ts
Browse files Browse the repository at this point in the history
Because this seems more consistent with the rest of the project.
  • Loading branch information
hasundue committed Oct 21, 2023
1 parent 855b5d9 commit ffc5df4
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ registry.
#### API Reference (WIP)

- [mod.ts](https://deno.land/x/molt/mod.ts) - Main module
- [git/mod.ts](https://deno.land/x/molt/git/mod.ts) - Sub-module for Git
operations
- [git.ts](https://deno.land/x/molt/git/mod.ts) - Sub-module for Git operations
- [lib/uri.ts](https://deno.land/x/molt/lib/uri.ts) - Library for handling URIs

#### Examples
Expand All @@ -50,7 +49,7 @@ FileUpdate.writeAll(results);

```ts
import { DependencyUpdate } from "https://deno.land/x/molt@{VERSION}/mod.ts";
import { commitAll } from "https://deno.land/x/molt@{VERSION}/git/mod.ts";
import { commitAll } from "https://deno.land/x/molt@{VERSION}/git.ts";

const updates = await DependencyUpdate.collect("./mod.ts");

Expand Down
4 changes: 2 additions & 2 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { existsSync } from "./lib/std/fs.ts";
import { distinct } from "./lib/std/collections.ts";
import { parse as parseJsonc } from "./lib/std/jsonc.ts";
import { dirname, extname, join } from "./lib/std/path.ts";
import { colors, Command, List, Select } from "./lib/x/cliffy.ts";
import { URI } from "./lib/uri.ts";
import { DependencyUpdate, FileUpdate } from "./mod.ts";
import { commitAll } from "./git/mod.ts";
import { dirname, extname, join } from "./lib/std/path.ts";
import { commitAll } from "./git.ts";

const { gray, yellow, bold } = colors;

Expand Down
26 changes: 26 additions & 0 deletions git.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 Chiezo (Shun Ueda). All rights reserved. MIT license.

/**
* A sub module of molt for git operations.
*
* ### Example
*
* To update all dependencies in a module and commit the changes to git:
*
* ```ts
* import { DependencyUpdate } from "https://deno.land/x/molt@{VERSION}/mod.ts";
* import { commitAll } from "https://deno.land/x/molt@{VERSION}/git.ts";
*
* const updates = await DependencyUpdate.collect("./mod.ts");
*
* commitAll(updates, {
* groupBy: (dependency) => dependency.name,
* composeCommitMessage: ({ group, version }) =>
* `build(deps): bump ${group} to ${version!.to}`,
* });
* ```
*
* @module
*/

export * from "./src/git.ts";
33 changes: 4 additions & 29 deletions git/mod.ts → src/git.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
// Copyright 2023 Chiezo (Shun Ueda). All rights reserved. MIT license.

/**
* A sub module of molt for git operations.
*
* ### Example
*
* To update all dependencies in a module and commit the changes to git:
*
* ```ts
* import { DependencyUpdate } from "https://deno.land/x/molt@{VERSION}/mod.ts";
* import { commitAll } from "https://deno.land/x/molt@{VERSION}/git/mod.ts";
*
* const updates = await DependencyUpdate.collect("./mod.ts");
*
* commitAll(updates, {
* groupBy: (dependency) => dependency.name,
* composeCommitMessage: ({ group, version }) =>
* `build(deps): bump ${group} to ${version!.to}`,
* });
* ```
*
* @module
*/

import { DependencyUpdate } from "../src/update.ts";
import { FileUpdate } from "../src/file.ts";
import { createVersionProp, type VersionProp } from "../src/versions.ts";
import { DependencyUpdate } from "./update.ts";
import { FileUpdate } from "./file.ts";
import { createVersionProp, type VersionProp } from "./versions.ts";
import { URI } from "../lib/uri.ts";

export interface CommitProps {
Expand All @@ -43,7 +18,7 @@ export interface CommitOptions {
gitCommitOptions?: string[];
}

export const defaultCommitOptions = {
const defaultCommitOptions = {
groupBy: () => "dependencies",
composeCommitMessage: ({ group, version }) => {
let message = `build(deps): update ${group}`;
Expand Down
4 changes: 2 additions & 2 deletions git/mod_test.ts → src/git_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
} from "../lib/std/testing.ts";
import { assertArrayIncludes, assertEquals } from "../lib/std/assert.ts";
import { URI } from "../lib/uri.ts";
import { DependencyUpdate } from "../mod.ts";
import { commitAll } from "./mod.ts";
import { DependencyUpdate } from "./update.ts";
import { commitAll } from "./git.ts";

const DenoCommandOriginal = Deno.Command;
const readTextFileSyncOriginal = Deno.readTextFileSync;
Expand Down

0 comments on commit ffc5df4

Please sign in to comment.