-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a345a32
commit 03a8ab3
Showing
5 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Imports | ||
import { fromFileUrl } from "jsr:@std/path/from-file-url" | ||
import { resolve } from "jsr:@std/path/resolve" | ||
import * as JSONC from "jsr:@std/jsonc" | ||
import { parseArgs } from "@std/cli" | ||
import type { record } from "jsr:@libs/typing" | ||
import * as semver from "@std/semver" | ||
import { assert } from "@std/assert" | ||
|
||
// Parse arguments | ||
const { version, _: [name] } = parseArgs(Deno.args, { string: ["version"] }) | ||
assert(version, "missing --version argument") | ||
assert(name, "missing package name argument") | ||
|
||
// Resolve config path | ||
const path = resolve(fromFileUrl(import.meta.resolve("../")), `${name}`, "deno.jsonc") | ||
console.log(`patching: ${path}`) | ||
|
||
// Patch config version | ||
const config = JSONC.parse(await Deno.readTextFile(path)) as record<string> | ||
const { version: previous } = config | ||
config.version = version | ||
console.log(`version: ${previous} → ${version}`) | ||
await Deno.writeTextFile(path, JSON.stringify(config, null, 2)) | ||
assert(semver.greaterThan(semver.parse(version), semver.parse(previous)), "expected new version to be grater than previous one") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.