Skip to content

Commit

Permalink
chore: don't rely on import map in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed May 30, 2024
1 parent 7f970f5 commit 9d27790
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
5 changes: 0 additions & 5 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@
"noUnusedParameters": true
},
"imports": {
"@cliffy/prompt": "jsr:@cliffy/prompt@^1.0.0-rc.4",
"@david/dax": "jsr:@david/dax@^0.41.0",
"@molt/core": "jsr:@molt/core@^0.18.4",
"@std/assert": "jsr:@std/assert@^0.225.3",
"@std/async": "jsr:@std/async@^0.224.1",
"@std/fmt": "jsr:@std/fmt@^0.225.2",
"@std/fs": "jsr:@std/fs@^0.229.1",
"@std/http": "jsr:@std/http@^0.224.2",
"@std/net": "jsr:@std/net@^0.224.1",
"@std/path": "jsr:@std/path@^0.225.1",
"@std/regexp": "jsr:@std/regexp@^0.224.1",
"@std/semver": "jsr:@std/semver@^0.224.1",
"chokidar": "npm:chokidar@^3.6.0"
},
"tasks": {
Expand Down
17 changes: 8 additions & 9 deletions deno.lock

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

11 changes: 6 additions & 5 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import {
type InputOptions,
Select as _Select,
type SelectOptions,
} from '@cliffy/prompt'
import { $ } from '@david/dax'
import { black, blue, bold, cyan, dim, gray, green, magenta, red, white, yellow } from '@std/fmt/colors'
import { escape } from '@std/regexp'
import { canParse, format, increment, parse, type ReleaseType } from '@std/semver'
} from 'jsr:@cliffy/prompt@1.0.0-rc.4'
import { $ } from 'jsr:@david/dax'
import { black, blue, bold, cyan, dim, gray, green, magenta, red, white, yellow } from 'jsr:@std/fmt/colors'
import { escape } from 'jsr:@std/regexp'
import { canParse, format, increment, parse, type ReleaseType } from 'jsr:@std/semver'

const SEMVER_INCREMENTS: ReleaseType[] = ['patch', 'minor', 'major', 'prepatch', 'preminor', 'premajor', 'prerelease']

Expand Down Expand Up @@ -366,4 +366,5 @@ await step('Creating a new release...', async () => {
/**
* TODO:
* - publish stuff from this script as standalone modules
* - remove version from @cliffy/prompt when it's stable
*/
18 changes: 13 additions & 5 deletions scripts/update.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $ } from '@david/dax'
import { parse, resolveLatestVersion, stringify } from '@molt/core'
import { expandGlob } from '@std/fs'
import { relative } from '@std/path'
import { $ } from 'jsr:@david/dax'
import { parse, resolveLatestVersion, stringify } from 'jsr:@molt/core'
import { expandGlob } from 'jsr:@std/fs'
import { relative } from 'jsr:@std/path'

const denoJson = JSON.parse(await Deno.readTextFile('deno.json')) as { imports: Record<string, string> }
const newImports = { ...denoJson.imports }
Expand Down Expand Up @@ -32,7 +32,15 @@ denoJson.imports = newImports
await Deno.writeTextFile('deno.json', JSON.stringify(denoJson, null, 2))
await $.raw`deno fmt deno.json`.quiet()

await Deno.remove('deno.lock')
try {
await Deno.remove('deno.lock')
} catch (e) {
if (e instanceof Deno.errors.NotFound) {
// ignore
} else {
throw e
}
}

const files =
(await Array.fromAsync(expandGlob('**/*.ts', { root: Deno.cwd(), includeDirs: false, exclude: ['**/_*', '**/.*'] })))
Expand Down

0 comments on commit 9d27790

Please sign in to comment.