diff --git a/changelog/changelog_test.ts b/changelog/changelog_test.ts index b51a997..4d33134 100644 --- a/changelog/changelog_test.ts +++ b/changelog/changelog_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "$std/assert/assert_equals.ts" +import { assertEquals } from "@std/assert" import { getSections, parseCommits } from "./mod.ts" export const exampleCommits = parseCommits([ diff --git a/changelog/mod.ts b/changelog/mod.ts index 143792a..58e9973 100644 --- a/changelog/mod.ts +++ b/changelog/mod.ts @@ -1,4 +1,4 @@ -import $ from "$dax/mod.ts" +import $ from "@david/dax" import { typedRegEx } from "https://deno.land/x/typed_regex@0.2.0/mod.ts" import type { RegExCaptureResult } from "https://deno.land/x/typed_regex@0.2.0/type_parser.ts" diff --git a/changelog/render_bbcode.ts b/changelog/render_bbcode.ts index cb38f27..2bb95a0 100644 --- a/changelog/render_bbcode.ts +++ b/changelog/render_bbcode.ts @@ -1,4 +1,4 @@ -import { outdent } from "$dax/src/deps.ts" +import { outdent } from "./vendor/outdent.ts" import { Commit } from "./mod.ts" import { ChangelogRenderer, renderSections, SectionFormatter } from "./render.ts" diff --git a/changelog/render_bbcode_test.ts b/changelog/render_bbcode_test.ts index c4792f9..a490dc3 100644 --- a/changelog/render_bbcode_test.ts +++ b/changelog/render_bbcode_test.ts @@ -1,5 +1,5 @@ -import { assertEquals } from "$std/assert/assert_equals.ts" -import { outdent } from "$dax/src/deps.ts" +import { assertEquals } from "@std/assert" +import { outdent } from "./vendor/outdent.ts" import { renderBBCode } from "./render_bbcode.ts" import { exampleSections } from "./changelog_test.ts" diff --git a/changelog/render_markdown.ts b/changelog/render_markdown.ts index 20f84a7..34f55b5 100644 --- a/changelog/render_markdown.ts +++ b/changelog/render_markdown.ts @@ -1,9 +1,8 @@ -import { outdent } from "$dax/src/deps.ts" +import { outdent } from "./vendor/outdent.ts" import { Commit } from "./mod.ts" import { ChangelogRenderer, renderSections, SectionFormatter } from "./render.ts" -const fmtCommit = (x: Commit) => - `- ${x.subject} (#${x.pr})` +const fmtCommit = (x: Commit) => `- ${x.subject} (#${x.pr})` const fmtSection: SectionFormatter = ([section, commits]) => `## ${section}\n\n` + commits.map(fmtCommit).join("\n") diff --git a/changelog/render_sts.ts b/changelog/render_sts.ts index de6f269..0c59c0e 100644 --- a/changelog/render_sts.ts +++ b/changelog/render_sts.ts @@ -1,4 +1,4 @@ -import { outdent } from "$dax/src/deps.ts" +import { outdent } from "./vendor/outdent.ts" import { Commit } from "./mod.ts" import { ChangelogRenderer, renderSections, SectionFormatter } from "./render.ts" diff --git a/changelog/render_sts_test.ts b/changelog/render_sts_test.ts index 07a9aa6..3eea453 100644 --- a/changelog/render_sts_test.ts +++ b/changelog/render_sts_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "$std/assert/assert_equals.ts" +import { assertEquals } from "@std/assert" import { Commit } from "./mod.ts" import { fmtCommit } from "./render_sts.ts" diff --git a/changelog/semver.ts b/changelog/semver.ts index 9882d98..fcebfda 100644 --- a/changelog/semver.ts +++ b/changelog/semver.ts @@ -1,7 +1,7 @@ -import type { SemVer } from "$std/semver/types.ts" +import type { SemVer } from "@std/semver" import type { Commit } from "./mod.ts" -import { format, increment, parse } from "$std/semver/mod.ts" +import { format, increment, parse } from "@std/semver" const increaseBy = (commit: Commit): "major" | "minor" | "patch" => commit.breaking ? "major" : commit.type === "feat" ? "minor" : "patch" diff --git a/changelog/semver_test.ts b/changelog/semver_test.ts index c5558a0..b251419 100644 --- a/changelog/semver_test.ts +++ b/changelog/semver_test.ts @@ -1,5 +1,5 @@ -import { assertObjectMatch } from "$std/assert/assert_object_match.ts" -import { assertEquals } from "$std/assert/assert_equals.ts" +import { assertObjectMatch } from "@std/assert" +import { assertEquals } from "@std/assert" import { getNextVersion, increaseVersion } from "./semver.ts" const major = { type: "fix", breaking: "!", subject: "big stuff", pr: "123", scopes: undefined } diff --git a/changelog/vendor/outdent.ts b/changelog/vendor/outdent.ts new file mode 100644 index 0000000..8613bae --- /dev/null +++ b/changelog/vendor/outdent.ts @@ -0,0 +1,215 @@ +// deno-lint-ignore-file no-explicit-any +// Vendored and modified from: https://github.com/cspotcode/outdent/blob/1aaf39e4788a41412eb0aab2943da5afe63d7dd1/src/index.ts +// Modified because it had some CommonJS code in it that was causing warnings in the esbuild build. + +// The MIT License (MIT) +// +// Copyright (c) 2016 Andrew Bradley + +// Copy all own enumerable properties from source to target +function extend(target: T, source: S) { + type Extended = T & S + for (const prop in source) { + if (Object.hasOwn(source, prop)) { + ;(target as any)[prop] = source[prop] + } + } + return target as Extended +} + +const reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/ +const reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/ +const reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/ +const reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/ +const reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/ + +function _outdentArray( + strings: ReadonlyArray, + firstInterpolatedValueSetsIndentationLevel: boolean, + options: Options, +) { + // If first interpolated value is a reference to outdent, + // determine indentation level from the indentation of the interpolated value. + let indentationLevel = 0 + + const match = strings[0].match(reDetectIndentation) + if (match) { + indentationLevel = match[1].length + } + + const reSource = `(\\r\\n|\\r|\\n).{0,${indentationLevel}}` + const reMatchIndent = new RegExp(reSource, "g") + + if (firstInterpolatedValueSetsIndentationLevel) { + strings = strings.slice(1) + } + + const { newline, trimLeadingNewline, trimTrailingNewline } = options + const normalizeNewlines = typeof newline === "string" + const l = strings.length + const outdentedStrings = strings.map((v, i) => { + // Remove leading indentation from all lines + v = v.replace(reMatchIndent, "$1") + // Trim a leading newline from the first string + if (i === 0 && trimLeadingNewline) { + v = v.replace(reLeadingNewline, "") + } + // Trim a trailing newline from the last string + if (i === l - 1 && trimTrailingNewline) { + v = v.replace(reTrailingNewline, "") + } + // Normalize newlines + if (normalizeNewlines) { + v = v.replace(/\r\n|\n|\r/g, (_) => newline as string) + } + return v + }) + return outdentedStrings +} + +function concatStringsAndValues( + strings: ReadonlyArray, + values: ReadonlyArray, +): string { + let ret = "" + for (let i = 0, l = strings.length; i < l; i++) { + ret += strings[i] + if (i < l - 1) { + ret += values[i] + } + } + return ret +} + +function isTemplateStringsArray(v: any): v is TemplateStringsArray { + return Object.hasOwn(v, "raw") && Object.hasOwn(v, "length") +} + +/** + * It is assumed that opts will not change. If this is a problem, clone your options object and pass the clone to + * makeInstance + * @param options + * @return {outdent} + */ +function createInstance(options: Options): Outdent { + /** Cache of pre-processed template literal arrays */ + const arrayAutoIndentCache = new WeakMap< + TemplateStringsArray, + Array + >() + /** + * Cache of pre-processed template literal arrays, where first interpolated value is a reference to outdent, + * before interpolated values are injected. + */ + const arrayFirstInterpSetsIndentCache = new WeakMap< + TemplateStringsArray, + Array + >() + + /* tslint:disable:no-shadowed-variable */ + function outdent( + stringsOrOptions: TemplateStringsArray, + ...values: Array + ): string + function outdent(stringsOrOptions: Options): Outdent + function outdent( + stringsOrOptions: TemplateStringsArray | Options, + ...values: Array + ): string | Outdent { + /* tslint:enable:no-shadowed-variable */ + if (isTemplateStringsArray(stringsOrOptions)) { + const strings = stringsOrOptions + + // Is first interpolated value a reference to outdent, alone on its own line, without any preceding non-whitespace? + const firstInterpolatedValueSetsIndentationLevel = + (values[0] === outdent || values[0] === defaultOutdent) && + reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && + reStartsWithNewlineOrIsEmpty.test(strings[1]) + + // Perform outdentation + const cache = firstInterpolatedValueSetsIndentationLevel + ? arrayFirstInterpSetsIndentCache + : arrayAutoIndentCache + let renderedArray = cache.get(strings) + if (!renderedArray) { + renderedArray = _outdentArray( + strings, + firstInterpolatedValueSetsIndentationLevel, + options, + ) + cache.set(strings, renderedArray) + } + /** If no interpolated values, skip concatenation step */ + if (values.length === 0) { + return renderedArray[0] + } + /** Concatenate string literals with interpolated values */ + const rendered = concatStringsAndValues( + renderedArray, + firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values, + ) + + return rendered + } else { + // Create and return a new instance of outdent with the given options + return createInstance( + extend(extend({}, options), stringsOrOptions || {}), + ) + } + } + + const fullOutdent = extend(outdent, { + string(str: string): string { + return _outdentArray([str], false, options)[0] + }, + }) + + return fullOutdent +} + +const defaultOutdent: Outdent = createInstance({ + trimLeadingNewline: true, + trimTrailingNewline: true, +}) + +export interface Outdent { + /** + * Remove indentation from a template literal. + */ + (strings: TemplateStringsArray, ...values: Array): string + /** + * Create and return a new Outdent instance with the given options. + */ + (options: Options): Outdent + + /** + * Remove indentation from a string + */ + string(str: string): string + + // /** + // * Remove indentation from a template literal, but return a tuple of the + // * outdented TemplateStringsArray and + // */ + // pass(strings: TemplateStringsArray, ...values: Array): [TemplateStringsArray, ...Array]; +} + +export interface Options { + trimLeadingNewline?: boolean + trimTrailingNewline?: boolean + /** + * Normalize all newlines in the template literal to this value. + * + * If `null`, newlines are left untouched. + * + * Newlines that get normalized are '\r\n', '\r', and '\n'. + * + * Newlines within interpolated values are *never* normalized. + * + * Although intended for normalizing to '\n' or '\r\n', + * you can also set to any string; for example ' '. + */ + newline?: string | null +} + +export { defaultOutdent as outdent } diff --git a/deno.jsonc b/deno.jsonc index a5e1f7c..88ea625 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -5,11 +5,22 @@ "changelog": "deno run -A ./changelog/mod.ts" }, "exclude": ["src/main/kotlin/", "src/main/resources/marisa/img", "build/"], + "workspace": ["src/main/resources/marisa/localization/"], "fmt": { "semiColons": false, "lineWidth": 100, "proseWrap": "never" }, - "importMap": "./import_map.json", + "imports": { + "$cliffy/": "https://deno.land/x/cliffy@v1.0.0-rc.3/", + "$zod/": "https://deno.land/x/zod@v3.20.5/", + "@david/dax": "jsr:@david/dax@^0.42.0", + "@std/assert": "jsr:@std/assert@^1.0.6", + "@std/collections": "jsr:@std/collections@^1.0.7", + "@std/fmt": "jsr:@std/fmt@^1.0.2", + "@std/fs": "jsr:@std/fs@^1.0.4", + "@std/path": "jsr:@std/path@^1.0.6", + "@std/semver": "jsr:@std/semver@^1.0.3" + }, "compilerOptions": { "exactOptionalPropertyTypes": true } } diff --git a/deno.lock b/deno.lock index b5bc827..43a890e 100644 --- a/deno.lock +++ b/deno.lock @@ -2,10 +2,103 @@ "version": "3", "packages": { "specifiers": { + "jsr:@david/dax": "jsr:@david/dax@0.42.0", + "jsr:@david/dax@^0.42.0": "jsr:@david/dax@0.42.0", + "jsr:@david/path@0.2": "jsr:@david/path@0.2.0", + "jsr:@david/which@~0.4.1": "jsr:@david/which@0.4.1", + "jsr:@std/assert@^0.221.0": "jsr:@std/assert@0.221.0", + "jsr:@std/assert@^1.0.6": "jsr:@std/assert@1.0.6", + "jsr:@std/bytes@^0.221.0": "jsr:@std/bytes@0.221.0", + "jsr:@std/collections@^1.0.7": "jsr:@std/collections@1.0.7", + "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.2", + "jsr:@std/fmt@^1.0.2": "jsr:@std/fmt@1.0.2", + "jsr:@std/fs@1": "jsr:@std/fs@1.0.4", + "jsr:@std/fs@^1": "jsr:@std/fs@1.0.4", + "jsr:@std/fs@^1.0.4": "jsr:@std/fs@1.0.4", + "jsr:@std/internal@^1.0.4": "jsr:@std/internal@1.0.4", + "jsr:@std/io@0.221": "jsr:@std/io@0.221.0", + "jsr:@std/io@^0.221.0": "jsr:@std/io@0.221.0", + "jsr:@std/path@1": "jsr:@std/path@1.0.6", + "jsr:@std/path@^1": "jsr:@std/path@1.0.6", + "jsr:@std/path@^1.0.6": "jsr:@std/path@1.0.6", + "jsr:@std/semver@^1.0.3": "jsr:@std/semver@1.0.3", + "jsr:@std/streams@0.221": "jsr:@std/streams@0.221.0", "npm:@types/node": "npm:@types/node@18.16.19", "npm:iter-ops": "npm:iter-ops@3.1.1", "npm:outdent": "npm:outdent@0.8.0", - "npm:ts-pattern": "npm:ts-pattern@5.0.5" + "npm:ts-pattern": "npm:ts-pattern@5.0.5", + "npm:type-fest": "npm:type-fest@4.26.1", + "npm:zod-to-json-schema@3.21.3": "npm:zod-to-json-schema@3.21.3_zod@3.23.8" + }, + "jsr": { + "@david/dax@0.42.0": { + "integrity": "0c547c9a20577a6072b90def194c159c9ddab82280285ebfd8268a4ebefbd80b", + "dependencies": [ + "jsr:@david/path@0.2", + "jsr:@david/which@~0.4.1", + "jsr:@std/fmt@1", + "jsr:@std/fs@1", + "jsr:@std/io@0.221", + "jsr:@std/path@1", + "jsr:@std/streams@0.221" + ] + }, + "@david/path@0.2.0": { + "integrity": "f2d7aa7f02ce5a55e27c09f9f1381794acb09d328f8d3c8a2e3ab3ffc294dccd", + "dependencies": [ + "jsr:@std/fs@^1", + "jsr:@std/path@^1" + ] + }, + "@david/which@0.4.1": { + "integrity": "896a682b111f92ab866cc70c5b4afab2f5899d2f9bde31ed00203b9c250f225e" + }, + "@std/assert@0.221.0": { + "integrity": "a5f1aa6e7909dbea271754fd4ab3f4e687aeff4873b4cef9a320af813adb489a" + }, + "@std/assert@1.0.6": { + "integrity": "1904c05806a25d94fe791d6d883b685c9e2dcd60e4f9fc30f4fc5cf010c72207", + "dependencies": [ + "jsr:@std/internal@^1.0.4" + ] + }, + "@std/bytes@0.221.0": { + "integrity": "64a047011cf833890a4a2ab7293ac55a1b4f5a050624ebc6a0159c357de91966" + }, + "@std/collections@1.0.7": { + "integrity": "6cff6949907372564735e25a5c6a7945d67cc31913b1b4d1278d08c2a5a3291d" + }, + "@std/fmt@1.0.2": { + "integrity": "87e9dfcdd3ca7c066e0c3c657c1f987c82888eb8103a3a3baa62684ffeb0f7a7" + }, + "@std/fs@1.0.4": { + "integrity": "2907d32d8d1d9e540588fd5fe0ec21ee638134bd51df327ad4e443aaef07123c", + "dependencies": [ + "jsr:@std/path@^1.0.6" + ] + }, + "@std/internal@1.0.4": { + "integrity": "62e8e4911527e5e4f307741a795c0b0a9e6958d0b3790716ae71ce085f755422" + }, + "@std/io@0.221.0": { + "integrity": "faf7f8700d46ab527fa05cc6167f4b97701a06c413024431c6b4d207caa010da", + "dependencies": [ + "jsr:@std/assert@^0.221.0", + "jsr:@std/bytes@^0.221.0" + ] + }, + "@std/path@1.0.6": { + "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" + }, + "@std/semver@1.0.3": { + "integrity": "7c139c6076a080eeaa4252c78b95ca5302818d7eafab0470d34cafd9930c13c8" + }, + "@std/streams@0.221.0": { + "integrity": "47f2f74634b47449277c0ee79fe878da4424b66bd8975c032e3afdca88986e61", + "dependencies": [ + "jsr:@std/io@^0.221.0" + ] + } }, "npm": { "@types/node@18.16.19": { @@ -23,6 +116,20 @@ "ts-pattern@5.0.5": { "integrity": "sha512-tL0w8U/pgaacOmkb9fRlYzWEUDCfVjjv9dD4wHTgZ61MjhuMt46VNWTG747NqW6vRzoWIKABVhFSOJ82FvXrfA==", "dependencies": {} + }, + "type-fest@4.26.1": { + "integrity": "sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==", + "dependencies": {} + }, + "zod-to-json-schema@3.21.3_zod@3.23.8": { + "integrity": "sha512-09W/9oyxeF1/wWnzCb6MursW+lOzgKi91QwE7eTBbC+t/qgfuLsUVDai3lHemSQnQu/UONAcT/fv3ZnDvbTeKg==", + "dependencies": { + "zod": "zod@3.23.8" + } + }, + "zod@3.23.8": { + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "dependencies": {} } } }, @@ -400,6 +507,7 @@ "https://deno.land/x/dax@0.39.2/src/runtimes/process.deno.ts": "50f85a086a9208b26c10dc2c1406fd9274226401f670d6862fdee05433c9ea4e", "https://deno.land/x/dax@0.39.2/src/shell.ts": "b95677094cc553c987f0f113a95a45d72f2896ef82754f9831029efbbafea5d5", "https://deno.land/x/dax@0.39.2/src/vendor/outdent.ts": "4d0283726579688c50b20c4b779e068acd3fa159a8784a4549e5e21bbef0ae64", + "https://deno.land/x/dprint@0.2.0/mod.ts": "89ddd655e1b3a0b294f433c296fa01875037eed078b53aa60af755a25f128074", "https://deno.land/x/fun@v2.0.0-alpha.10/alt.ts": "b61816a6a848b40eb40ec4548c4c00496dbc8df5f25d2e49fb35164fbd2d3ca3", "https://deno.land/x/fun@v2.0.0-alpha.10/applicative.ts": "123483ae07379c29784a1a254b05c35ba50f3091f121a3257c03592d181bcb99", "https://deno.land/x/fun@v2.0.0-alpha.10/apply.ts": "e2349f7b784525ecbad506325e106916c5290f1c65ef879dbf8ced5d3ed94858", @@ -439,6 +547,7 @@ "https://deno.land/x/jszip@0.11.0/mod.ts": "5661ddc18e9ac9c07e3c5d2483bc912a7022b6af0d784bb7b05035973e640ba1", "https://deno.land/x/jszip@0.11.0/types.ts": "1528d1279fbb64dd118c371331c641a3a5eff2b594336fb38a7659cf4c53b2d1", "https://deno.land/x/promise_object@v0.10.0/index.ts": "095e9fed1c0948110c8ded200814b051ac105ec2315b7ffc2c8ab51250d5a82b", + "https://deno.land/x/replicache@v10.0.0-beta.0/async-iterable-to-array.ts": "7307fa47b4cb94465335869fdac7e5429608577b8682824b513bf62c5fd3a9e3", "https://deno.land/x/typed_regex@0.2.0/api_types.ts": "27a3f41894244da95b60646962231a3b02c4ed55bf7042747c737869fe3d4574", "https://deno.land/x/typed_regex@0.2.0/mod.ts": "2a51f6fca3f6cabe28d420680c4bc6609704e3cc833ba987efe2c44c911330bb", "https://deno.land/x/typed_regex@0.2.0/type_parser.ts": "a265790f94234a5338c7854af3794bcb012015f7c3e1c091ebf7b160b1627d31", @@ -458,5 +567,16 @@ "https://deno.land/x/zod@v3.20.5/types.ts": "6ddc4608e70d75f2e06f9cc14aa406df4d80f420c0eef64f2f02d429853c0c38", "https://esm.sh/jszip@3.7.1": "f3872a819b015715edb05f81d973b5cd05d3d213d8eb28293ca5471fe7a71773", "https://esm.sh/v135/jszip@3.7.1/denonext/jszip.mjs": "d31d7f9e0de9c6db3c07ca93f7301b756273d4dccb41b600461978fc313504c9" + }, + "workspace": { + "dependencies": [ + "jsr:@david/dax@^0.42.0", + "jsr:@std/assert@^1.0.6", + "jsr:@std/collections@^1.0.7", + "jsr:@std/fmt@^1.0.2", + "jsr:@std/fs@^1.0.4", + "jsr:@std/path@^1.0.6", + "jsr:@std/semver@^1.0.3" + ] } } diff --git a/import_map.json b/import_map.json deleted file mode 100644 index 45b322b..0000000 --- a/import_map.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "imports": { - "$std/": "https://deno.land/std@0.219.0/", - "$cliffy/": "https://deno.land/x/cliffy@v1.0.0-rc.3/", - "$zod/": "https://deno.land/x/zod@v3.20.5/", - "$dax/": "https://deno.land/x/dax@0.39.2/" - } -} diff --git a/link/hardlink.ts b/link/hardlink.ts index f7352c8..c13c511 100644 --- a/link/hardlink.ts +++ b/link/hardlink.ts @@ -1,11 +1,10 @@ -import { brightRed, magenta } from "$std/fmt/colors.ts" -import { join, resolve } from "$std/path/mod.ts" +import { brightRed, magenta } from "@std/fmt/colors" +import { join, parse, resolve } from "@std/path" import promiseObject from "https://deno.land/x/promise_object@v0.10.0/index.ts" import { match, P } from "npm:ts-pattern" -import { parse } from "$std/path/mod.ts" import { hardlink, inode } from "./inode.ts" import { fmt, Logger } from "./logger.ts" import { noop } from "./noop.ts" diff --git a/link/inode.ts b/link/inode.ts index 79e78ca..2da4f48 100644 --- a/link/inode.ts +++ b/link/inode.ts @@ -1,4 +1,4 @@ -import { resolve } from "$std/path/mod.ts" +import { resolve } from "@std/path" import * as TE from "https://deno.land/x/fun@v2.0.0-alpha.10/async_either.ts" import { c, p } from "https://deno.land/x/copb@v1.0.1/mod.ts" diff --git a/link/logger.ts b/link/logger.ts index 98faa15..3e46568 100644 --- a/link/logger.ts +++ b/link/logger.ts @@ -1,4 +1,4 @@ -import { brightGreen, brightRed, brightYellow } from "$std/fmt/colors.ts" +import { brightGreen, brightRed, brightYellow } from "@std/fmt/colors" import { c, p } from "https://deno.land/x/copb@v1.0.1/mod.ts" diff --git a/link/mod.ts b/link/mod.ts index d85d066..3992a86 100755 --- a/link/mod.ts +++ b/link/mod.ts @@ -1,6 +1,6 @@ #!/usr/bin/env -S deno run --allow-read --allow-write --allow-env -import { join } from "$std/path/mod.ts" +import { join } from "@std/path" import { Command } from "$cliffy/command/mod.ts" import { image, jar, mod } from "../paths.ts" diff --git a/paths.ts b/paths.ts index c276291..95eb11a 100644 --- a/paths.ts +++ b/paths.ts @@ -1,9 +1,17 @@ -import { resolve } from "$std/path/mod.ts" +import { resolve } from "@std/path" + +const readGradle = async (): Promise> => { + const gradle = await Deno.readTextFile("gradle.properties") + + return Object.fromEntries(gradle.split("\n").map((line) => line.trim().split("="))) +} + +const gradleProperties = await readGradle() export const root = import.meta.dirname! export const jar = resolve(root, "build", "libs", "MarisaContinued.jar") export const image = resolve("docs", "thumbnail", "image.jpg") export const home = Deno.env.get("HOME")! -export const steam = resolve(home, ".steam", "steam", "steamapps", "common") +export const steam = resolve(gradleProperties["userSteamDir"], "common") export const mod = resolve(steam, "SlayTheSpire", "MarisaContinued") diff --git a/releases.ts b/releases.ts index 5fe2d16..527e362 100644 --- a/releases.ts +++ b/releases.ts @@ -1,5 +1,5 @@ -import { join } from "$std/path/join.ts" -import $ from "$dax/mod.ts" +import { join } from "@std/path" +import $ from "@david/dax" import { steam as SteamPath } from "./paths.ts" export const basePath = "docs/changelog" diff --git a/releases_test.ts b/releases_test.ts index 48fba02..cb8fb24 100644 --- a/releases_test.ts +++ b/releases_test.ts @@ -1,8 +1,7 @@ -import { join } from "$std/path/join.ts" +import { join } from "@std/path" import { basePath, changelogPath, jarPath, stsPath, version } from "./releases.ts" import { verifyHardLink } from "./link/mod.ts" -import { assertEquals } from "$std/assert/assert_equals.ts" -import { assertStringIncludes } from "$std/assert/assert_string_includes.ts" +import { assertEquals, assertStringIncludes } from "@std/assert" import { readZip } from "https://deno.land/x/jszip@0.11.0/mod.ts" Deno.test("hardlinks are verified", async () => { diff --git a/src/main/resources/marisa/localization/common.ts b/src/main/resources/marisa/localization/common.ts index 8023e81..416a7fe 100644 --- a/src/main/resources/marisa/localization/common.ts +++ b/src/main/resources/marisa/localization/common.ts @@ -1,4 +1,4 @@ -import { walk } from "$std/fs/walk.ts" +import { walk } from "@std/fs" import { asyncIterableToArray } from "https://deno.land/x/replicache@v10.0.0-beta.0/async-iterable-to-array.ts" export const langCodes = ["ENG", "FRA", "JPN", "KOR", "ZHS", "ZHT"] as const export type LangCode = typeof langCodes[number] diff --git a/src/main/resources/marisa/localization/deno.jsonc b/src/main/resources/marisa/localization/deno.jsonc index efd7a18..5f540cc 100644 --- a/src/main/resources/marisa/localization/deno.jsonc +++ b/src/main/resources/marisa/localization/deno.jsonc @@ -3,6 +3,5 @@ "schema": "deno run -A schema.ts", "schema:vscode": "deno run -A vscode.ts", "validate": "deno run -A validate.ts" - }, - "importMap": "../../../../../import_map.json" + } } diff --git a/src/main/resources/marisa/localization/dirEntries_test.ts b/src/main/resources/marisa/localization/dirEntries_test.ts index 5b9b022..c99045c 100644 --- a/src/main/resources/marisa/localization/dirEntries_test.ts +++ b/src/main/resources/marisa/localization/dirEntries_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "$std/assert/assert_equals.ts" +import { assertEquals } from "@std/assert" import { dirEntries } from "./dirEntries.ts" Deno.test(async function testDirEntries() { diff --git a/src/main/resources/marisa/localization/dprint.ts b/src/main/resources/marisa/localization/dprint.ts index 45f9d65..0fd126f 100644 --- a/src/main/resources/marisa/localization/dprint.ts +++ b/src/main/resources/marisa/localization/dprint.ts @@ -1,4 +1,4 @@ -import { join } from "$std/path/mod.ts" +import { join } from "@std/path" import { createFromBuffer, GlobalConfiguration } from "https://deno.land/x/dprint@0.2.0/mod.ts" import { projectRoot } from "./common.ts" diff --git a/src/main/resources/marisa/localization/editVariables.ts b/src/main/resources/marisa/localization/editVariables.ts index c6c205a..65c6680 100644 --- a/src/main/resources/marisa/localization/editVariables.ts +++ b/src/main/resources/marisa/localization/editVariables.ts @@ -1,4 +1,4 @@ -import { brightGreen, brightRed, brightYellow } from "$std/fmt/colors.ts" +import { brightGreen, brightRed, brightYellow } from "@std/fmt/colors" import { Command } from "$cliffy/command/mod.ts" import type { Entry } from "npm:type-fest" diff --git a/src/main/resources/marisa/localization/json_to_zod_test.ts b/src/main/resources/marisa/localization/json_to_zod_test.ts index 8d7ed77..51419f2 100644 --- a/src/main/resources/marisa/localization/json_to_zod_test.ts +++ b/src/main/resources/marisa/localization/json_to_zod_test.ts @@ -1,5 +1,5 @@ -import { assertThrows } from "$std/assert/assert_throws.ts" -import { assert } from "$std/assert/assert.ts" +import { assertThrows } from "@std/assert" +import { assert } from "@std/assert" import { z } from "$zod/mod.ts" import { jsonToZod } from "./json_to_zod.ts" diff --git a/src/main/resources/marisa/localization/schema.ts b/src/main/resources/marisa/localization/schema.ts index f2f95b4..598f5d5 100644 --- a/src/main/resources/marisa/localization/schema.ts +++ b/src/main/resources/marisa/localization/schema.ts @@ -1,4 +1,4 @@ -import { WalkEntry } from "$std/fs/walk.ts" +import { WalkEntry } from "@std/fs" import { z } from "$zod/mod.ts" import { zodToJsonSchema } from "npm:zod-to-json-schema@3.21.3" import { jsons } from "./common.ts" diff --git a/src/main/resources/marisa/localization/validate.ts b/src/main/resources/marisa/localization/validate.ts index 6ece667..d003114 100644 --- a/src/main/resources/marisa/localization/validate.ts +++ b/src/main/resources/marisa/localization/validate.ts @@ -1,7 +1,7 @@ -import { walk, WalkEntry } from "$std/fs/walk.ts" +import { walk, WalkEntry } from "@std/fs" import { asyncIterableToArray } from "https://deno.land/x/replicache@v10.0.0-beta.0/async-iterable-to-array.ts" import { jsons, LangCode, langCodes } from "./common.ts" -import { parse } from "$std/path/mod.ts" +import { parse } from "@std/path" import { Command, EnumType } from "$cliffy/command/mod.ts" import { ZodIssue } from "$zod/mod.ts"