Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hasundue/molt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.19.6
Choose a base ref
...
head repository: hasundue/molt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.19.7
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Aug 4, 2024

  1. Verified

    This commit was created on github.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8dfc8e5 View commit details

Commits on Aug 7, 2024

  1. Copy the full SHA
    e6714bd View commit details
  2. chore: release 0.19.7

    hasundue committed Aug 7, 2024
    Copy the full SHA
    3752183 View commit details
Showing with 56 additions and 10 deletions.
  1. +23 −6 README.md
  2. +1 −1 cli/deno.json
  3. +12 −3 cli/main.ts
  4. +20 −0 cli/main_test.ts
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 🦕 Molt

[![JSR](https://jsr.io/badges/@molt)](https://jsr.io/badges/@molt)
[![CI](https://github.com/hasundue/molt/actions/workflows/ci.yml/badge.svg)](https://github.com/hasundue/molt/actions/workflows/ci.yml)
[![codecov](https://codecov.io/github/hasundue/molt/graph/badge.svg?token=NhpMdDRNxy)](https://codecov.io/github/hasundue/molt)

@@ -75,24 +76,42 @@ Molt can update to dependencies written in different formats. URL imports,
> Molt uses a similar versioning strategy as `increase-if-necessary` in
> `dependabot` to bump version ranges[^1].
## Packages
## Packages and documentation

### [@molt/cli]

A CLI to check updates to dependencies in Deno modules or a configuration file.
[![JSR](https://jsr.io/badges/@molt/cli)](https://jsr.io/@molt/cli)
[![JSR](https://jsr.io/badges/@molt/cli/score)](https://jsr.io/@molt/cli/score)

A CLI to update dependencies, supposed to be the entry point for most users.

### [@molt/core]

[![JSR](https://jsr.io/badges/@molt/core)](https://jsr.io/@molt/core)
[![JSR](https://jsr.io/badges/@molt/core/score)](https://jsr.io/@molt/core/score)

Deno modules to collect and manipulate dependencies and updates.

### [@molt/integration]

[![JSR](https://jsr.io/badges/@molt/integration)](https://jsr.io/@molt/integration)
[![JSR](https://jsr.io/badges/@molt/integration/score)](https://jsr.io/@molt/integration/score)

Modules to integrate Molt with thrid-party platforms.

### [@molt/lib]

[![JSR](https://jsr.io/badges/@molt/lib)](https://jsr.io/@molt/lib)
[![JSR](https://jsr.io/badges/@molt/lib/score)](https://jsr.io/@molt/lib/score)

General-purpose utilities developed for Molt, but may be used independently.

## Integration

### [molt-action](https://github.com/hasundue/molt-action)

A GitHub Action to create pull requests for dependency updates.

## Compatibility with registries

We check compatibility with various registries in
@@ -126,16 +145,14 @@ The following registries are not compatible with Molt:
- [raw.githubusercontent.com](https://github.com)
- [x.nest.land](https://x.nest.land)

## References
## Related projects

Molt is inspired by prior works such as
Molt is inspired by other projects like

- [deno-udd](https://github.com/hayd/deno-udd)
- [dmm](https://github.com/drashland/dmm)
- [updater](https://github.com/deaddeno/updater)

and of full respect to the authors.

<!-- Footnotes -->

[^1]: See
2 changes: 1 addition & 1 deletion cli/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@molt/cli",
"version": "0.19.6",
"version": "0.19.7",
"exports": {
".": "./main.ts"
},
15 changes: 12 additions & 3 deletions cli/main.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import { Command } from "@cliffy/command";
import $ from "@david/dax";
import { collect } from "@molt/core";
import type { Update } from "@molt/core/types";
import { partition } from "@std/collections";

import { printChangelog } from "./src/changelog.ts";
import { findConfig, findLock, findSource } from "./src/files.ts";
@@ -45,16 +46,24 @@ async function version() {
console.log(configs.version);
}

main.action(async function (options, ...source) {
main.action(async function (options, ...args) {
const [jsons, modules] = partition(
args,
(it) => it.match(/\.jsonc?$/) !== null,
);
if (jsons.length > 1) {
$.logError("Multiple configuration files found:", jsons.join(", "));
Deno.exit(1);
}
const config = options.config === false
? undefined
: options.config ?? await findConfig();
: options.config ?? jsons[0] ?? await findConfig();

const lock = options.lock === false
? undefined
: await findLock(options.lock);

source = source.length ? source : config ? [] : await findSource();
const source = modules.length ? modules : config ? [] : await findSource();

if (options.dryRun) {
const paths = [config, lock, ...source].filter((it) => it != null);
20 changes: 20 additions & 0 deletions cli/main_test.ts
Original file line number Diff line number Diff line change
@@ -73,6 +73,26 @@ describe("CLI", () => {
);
});

it("should handle explicitly-specified `deno.json` with `--write`", async () => {
const { stderr } = await molt("deno.json --write");
assertEquals(
stderr,
dedent`
Collecting dependencies
Fetching updates
Writing changes
`,
);
});

it("should error on multiple configuration files", async () => {
const { stderr } = await molt("deno.json deno.jsonc");
assertEquals(
stderr,
"Multiple configuration files found: deno.json, deno.jsonc",
);
});

it("should commit updates with `--commit`", async () => {
const { stderr, stdout } = await molt("--commit --prefix chore:");
assertEquals(