Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update dependencies #221

Merged
merged 6 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/src/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ensure, is } from "@core/unknownutil";
import { as, ensure, is } from "@core/unknownutil";
import { colors } from "@cliffy/ansi/colors";
import $ from "@david/dax";
import { associateWith, mapEntries } from "@std/collections";
Expand All @@ -19,7 +19,7 @@ async function getTasks(config?: string): Promise<TaskRecord> {
}
const json = ensure(
parseJsonc(await Deno.readTextFile(config)),
is.ObjectOf({ tasks: is.OptionalOf(is.RecordOf(is.String, is.String)) }),
is.ObjectOf({ tasks: as.Optional(is.RecordOf(is.String, is.String)) }),
);
return {
...tasks,
Expand Down
4 changes: 2 additions & 2 deletions core/locks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ensure, is } from "@core/unknownutil";
import { as, ensure, is } from "@core/unknownutil";
import { createGraph } from "@deno/graph";
import { filterValues, pick } from "@std/collections";
import * as SemVer from "@std/semver";
Expand Down Expand Up @@ -197,7 +197,7 @@ async function getNpmPackageInfo(
dist: is.ObjectOf({
integrity: is.String,
}),
dependencies: is.OptionalOf(is.RecordOf(is.String, is.String)),
dependencies: as.Optional(is.RecordOf(is.String, is.String)),
}),
);
const dependencies: [name: string, version: string][] = [];
Expand Down
6 changes: 3 additions & 3 deletions core/maps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Jsonc from "@std/jsonc";
import { ensure, is } from "@core/unknownutil";
import { as, ensure, is } from "@core/unknownutil";

export interface ImportMapJson {
imports?: Record<string, string>;
Expand All @@ -15,8 +15,8 @@ export function parseImportMapJson(
return ensure(
Jsonc.parse(src),
is.ObjectOf({
imports: is.OptionalOf(is.RecordOf(is.String)),
scopes: is.OptionalOf(is.RecordOf(is.RecordOf(is.String))),
imports: as.Optional(is.RecordOf(is.String)),
scopes: as.Optional(is.RecordOf(is.RecordOf(is.String))),
}),
);
}
Expand Down
8 changes: 4 additions & 4 deletions core/updates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ensure, is } from "@core/unknownutil";
import { as, ensure, is } from "@core/unknownutil";
import { filterValues, mapNotNullish, maxWith } from "@std/collections";
import * as SemVer from "@std/semver";
import {
Expand Down Expand Up @@ -82,11 +82,11 @@ async function getPackageUpdate(
const versions = await getVersions(dep);
const semvers = mapNotNullish(versions, SemVer.tryParse);

const locked = SemVer.tryParse(dep.locked);
const locked = dep.locked ? SemVer.tryParse(dep.locked) : undefined;
const range = SemVer.parseRange(dep.constraint);

const constrainted = SemVer.maxSatisfying(
semvers.filter((it) => SemVer.greaterThan(it, locked ?? SemVer.MIN)),
locked ? semvers.filter((it) => SemVer.greaterThan(it, locked)) : semvers,
range,
);

Expand Down Expand Up @@ -140,7 +140,7 @@ async function getJsrVersions(dep: DependencyState<"jsr">): Promise<string[]> {
assertOk(res);
const isJsrPackageMeta = is.ObjectOf({
versions: is.RecordOf(
is.ObjectOf({ yanked: is.OptionalOf(is.Boolean) }),
is.ObjectOf({ yanked: as.Optional(is.Boolean) }),
is.String,
),
});
Expand Down
8 changes: 4 additions & 4 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@cliffy/table": "jsr:@cliffy/table@1.0.0-rc.5",
"@conventional-commits/parser": "npm:@conventional-commits/parser@^0.4.1",
"@core/match": "jsr:@core/match@^0.3.1",
"@core/unknownutil": "jsr:@core/unknownutil@^3.18.1",
"@core/unknownutil": "jsr:@core/unknownutil@^4.0.0",
"@david/dax": "jsr:@david/dax@^0.41.0",
"@deno/graph": "jsr:@deno/graph@^0.81.0",
"@molt/core": "jsr:@molt/core@^0.19.0",
Expand All @@ -27,13 +27,13 @@
"@std/assert": "jsr:@std/assert@^1.0.0",
"@std/collections": "jsr:@std/collections@^1.0.1",
"@std/dotenv": "jsr:@std/dotenv@^0.225.0",
"@std/fmt": "jsr:@std/fmt@^0.225.0",
"@std/fmt": "jsr:@std/fmt@^1.0.0",
"@std/fs": "jsr:@std/fs@^1.0.0",
"@std/jsonc": "jsr:@std/jsonc@^1.0.0",
"@std/path": "jsr:@std/path@^1.0.0",
"@std/semver": "jsr:@std/semver@^0.224.3",
"@std/semver": "jsr:@std/semver@^1.0.0",
"@std/streams": "jsr:@std/streams@^1.0.0",
"@std/testing": "jsr:@std/testing@^0.225.0",
"@std/testing": "jsr:@std/testing@^1.0.0",
"dedent": "npm:dedent@^1.5.3"
},
"lint": {
Expand Down
58 changes: 43 additions & 15 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions integration/github.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { dirname } from "@std/path";
import { parse as parseJsonc } from "@std/jsonc";
import { match, placeholder as _ } from "@core/match";
import { isString } from "@core/unknownutil";
import { is } from "@core/unknownutil";
import { Octokit } from "@octokit/rest";
import { is, type Package } from "./packages.ts";
import { is as isPackage, type Package } from "./packages.ts";
import type { Repository } from "./repository.ts";

const octokit = new Octokit({
Expand Down Expand Up @@ -86,10 +86,10 @@ async function resolveJsrPackageRoot(
file_sha: config.sha,
});
const json = match(
{ name: _("name", isString) },
{ name: _("name", is.String) },
parseJsonc(atob(data.content)),
);
if (json && is(`jsr:${json.name}`, pkg)) {
if (json && isPackage(`jsr:${json.name}`, pkg)) {
return dirname(config.path);
}
}
Expand Down
4 changes: 2 additions & 2 deletions integration/repository.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ensure, is } from "@core/unknownutil";
import { as, ensure, is } from "@core/unknownutil";
import { type Package, stringify } from "./packages.ts";
import * as github from "./github.ts";

Expand Down Expand Up @@ -115,7 +115,7 @@ export async function resolveCreatedDate(
}

const isJsrPackageDetails = is.ObjectOf({
githubRepository: is.OptionalOf(is.ObjectOf({
githubRepository: as.Optional(is.ObjectOf({
owner: is.String,
name: is.String,
})),
Expand Down