Skip to content

Commit 25b2c47

Browse files
authored
Merge branch 'main' into fix-pantry-not-found
2 parents 96e63ca + f28d931 commit 25b2c47

34 files changed

+244
-87
lines changed

.github/workflows/cd.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ jobs:
8484

8585
# we would prefer this, but our pkging is not stable enough :/
8686
# - uses: pkgxdev/dev@v0
87-
- uses: denoland/setup-deno@v1
87+
- uses: denoland/setup-deno@v2
8888
with:
89-
deno-version: ~1.45
89+
deno-version: ^2.0.2
9090

9191
- run: deno task compile
9292

.github/workflows/ci.shellcode.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
compile:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: denoland/setup-deno@v1
20+
- uses: denoland/setup-deno@v2
2121
with:
22-
deno-version: ~1.45
22+
deno-version: ^2.0.2
2323
- uses: actions/checkout@v4
2424
- run: deno task compile
2525
- uses: actions/upload-artifact@v4

.github/workflows/ci.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
if: ${{ matrix.os == 'ubuntu-latest' }}
3333

3434
- uses: actions/checkout@v4
35-
- uses: denoland/setup-deno@v1 # using ourself to install deno could compromise the tests
35+
- uses: denoland/setup-deno@v2 # using ourself to install deno could compromise the tests
3636
with:
37-
deno-version: ~1.45
37+
deno-version: ^2.0.2
3838
- run: deno cache **/*.test.ts
3939
- run: deno task test --coverage=cov_profile --no-check
4040
- run: deno coverage cov_profile --lcov --exclude=tests/ --output=cov_profile.lcov
@@ -57,16 +57,16 @@ jobs:
5757
runs-on: ubuntu-latest
5858
steps:
5959
- uses: actions/checkout@v4
60-
- uses: denoland/setup-deno@v1 # using ourself to install deno could compromise the tests
60+
- uses: denoland/setup-deno@v2 # using ourself to install deno could compromise the tests
6161
with:
62-
deno-version: ~1.45
62+
deno-version: ^2.0.2
6363
- run: deno lint
6464

6565
typecheck:
6666
runs-on: ubuntu-latest
6767
steps:
6868
- uses: actions/checkout@v4
69-
- uses: denoland/setup-deno@v1
69+
- uses: denoland/setup-deno@v2
7070
with:
71-
deno-version: ~1.45
71+
deno-version: ^2.0.2
7272
- run: deno task typecheck

deno.jsonc

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
{
22
"compilerOptions": {
3-
"allowJs": false,
43
"strict": true
54
},
65
"tasks": {
76
// runs this source checkout, args will be passed
8-
"run": "deno run --unstable-fs --unstable-ffi --unstable-process -A ./entrypoint.ts",
7+
"run": "deno run --allow-all ./entrypoint.ts",
98

109
// you can specify paths to specific tests if you need
11-
// follows is the ideal permissions lines, unfortunately deno considers making symlinks to require full read/write permissions for fuck knows why reasons
12-
//"test": "deno test --allow-read=$PWD,$TMPDIR,$HOME,/ --allow-env --allow-write=$TMPDIR --allow-ffi --unstable",
13-
"test": "deno test --unstable-ffi --allow-ffi --allow-read --allow-env --allow-write",
14-
// ^^ ffi & unstable needed for execve.ts
10+
"test": "deno test --allow-all",
1511

1612
// installs to /usr/local/bin/pkgx
1713
"install": "deno task compile && ./pkgx +gnu.org/coreutils /usr/bin/sudo install -D ./pkgx /usr/local/bin/pkgx",
1814

1915
//--------------------------------------- ci/cd/admin
2016
"coverage": "scripts/run-coverage.sh",
2117
"typecheck": "deno check ./entrypoint.ts",
22-
"compile": "deno compile --lock=deno.lock --allow-read --allow-write --allow-net --allow-run --allow-env --allow-ffi --unstable-ffi --unstable-fs --unstable-process --output \"$INIT_CWD/pkgx\" ./entrypoint.ts"
18+
"compile": "deno compile --lock=deno.lock --allow-all --output \"$INIT_CWD/pkgx\" ./entrypoint.ts"
2319
},
24-
"pkgx": "deno~1.45",
20+
"pkgx": "deno~2.0",
2521
"lint": {
2622
"exclude": ["src/**/*.test.ts"]
2723
},
2824
"fmt": {
29-
"semiColons": false
25+
"semiColons": false
3026
},
3127
"imports": {
28+
"@cliffy/ansi": "jsr:@cliffy/ansi@^1.0.0-rc.7",
29+
"@std/assert": "jsr:@std/assert@^1.0.6",
30+
"@std/fmt": "jsr:@std/fmt@^1.0.2",
31+
"@std/io": "jsr:@std/io@^0.225.0",
32+
"@std/jsonc": "jsr:@std/jsonc@^1.0.1",
33+
"@std/path": "jsr:@std/path@^1.0.6",
34+
"@std/testing": "jsr:@std/testing@^1.0.3",
35+
"@std/yaml": "jsr:@std/yaml@^1.0.5",
3236
"is-what": "https://deno.land/x/[email protected]/src/index.ts",
33-
"pkgx": "https://deno.land/x/[email protected]/mod.ts",
34-
"pkgx/": "https://deno.land/x/[email protected]/src/",
35-
"outdent": "https://deno.land/x/[email protected]/mod.ts",
36-
"cliffy/": "https://deno.land/x/[email protected]/",
37-
"deno/": "https://deno.land/[email protected]/"
37+
"outdent": "jsr:@cspotcode/outdent@^0.8",
38+
"pkgx": "https://deno.land/x/[email protected]/mod.ts",
39+
"pkgx/": "https://deno.land/x/[email protected]/src/"
3840
}
3941
}

deno.lock

+166-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

entrypoint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { render as perror } from "./src/err-handler.ts"
7-
import { setColorEnabled } from "deno/fmt/colors.ts"
7+
import { setColorEnabled } from "@std/fmt/colors"
88
import clicolor from "./src/utils/clicolor.ts"
99

1010
setColorEnabled(clicolor(Deno.stderr))

src/app.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import internal_activate from "./modes/internal.activate.ts"
44
import shell_completion from "./modes/shell-completion.ts"
55
import parse_pkg_str from "./prefab/parse-pkg-str.ts"
66
import InstallLogger from "./utils/InstallLogger.ts"
7-
import { setColorEnabled } from "deno/fmt/colors.ts"
87
import internal_use from "./modes/internal.use.ts"
98
import { Args as BaseArgs } from "./parse-args.ts"
9+
import { setColorEnabled } from "@std/fmt/colors"
1010
import { AmbiguityError } from "./utils/error.ts"
1111
import integrate from "./modes/integrate.ts"
1212
import uninstall from "./modes/uninstall.ts"
@@ -115,7 +115,7 @@ export default async function({ flags, ...opts }: Args, logger_prefix?: string)
115115
const out = await env({pkgs, update, logger})
116116
if (out.trim()) {
117117
console.log(out)
118-
} else {
118+
} else if (!flags.sync) {
119119
console.error("empty env, try `pkgx --help`")
120120
}
121121
} break

src/err-handler.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { AmbiguityError, ProgrammerError, ProvidesError } from "./utils/error.ts
33
import announce from "./utils/announce.ts"
44
import { red } from "./utils/color.ts"
55

6-
export default function(err: Error) {
6+
export default function(err: unknown) {
77
if (err instanceof InstallationNotFoundError) {
88
const subtitle = utils.pkg.str(err.pkg)
99
render("not cached", subtitle, [], 'pkg-not-cached')
@@ -48,10 +48,12 @@ export default function(err: Error) {
4848
render('programmer error', undefined, [['this is a bug, please report it']], 'https://github.com/pkgxdev/pkgx/issues/new')
4949
} else if (err instanceof PkgxError) {
5050
console.error('%c × %s', 'color: red', err.message)
51-
} else {
51+
} else if (err instanceof Error) {
5252
const title = 'unexpected error'
5353
const ctx = err.stack?.split('\n').map(x => [x]) ?? [['no stack trace']]
5454
render(title, err.message, ctx, 'https://github.com/pkgxdev/pkgx/issues/new')
55+
} else {
56+
render('unknown error', `${err}`, [['no context']], 'https://github.com/pkgxdev/pkgx/issues/new')
5557
}
5658
return 1
5759
}

src/modes/env.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { null_logger as logger } from "../utils/test-utils.ts"
2-
import { assertEquals } from "deno/assert/mod.ts"
32
import specimen, { _internals } from "./env.ts"
4-
import * as mock from "deno/testing/mock.ts"
3+
import { assertEquals } from "@std/assert"
4+
import * as mock from "@std/testing/mock"
55
import { semver } from "pkgx"
66
import undent from "outdent"
77

src/modes/install.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default async function(pkgs: PackageRequirement[], unsafe: boolean) {
9090
rm -f ${programs.map(p => `'${p}'`).join(' ')} && echo "uninstalled: ${pkgstr}" >&2
9191
fi`
9292
}
93-
93+
9494
const f = dst.mkdir('p').join(program)
9595

9696
if (f.exists()) {

src/modes/integrate.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// deno-lint-ignore-file no-explicit-any
2-
import { afterEach, beforeEach, describe, afterAll, it } from "deno/testing/bdd.ts"
2+
import { afterEach, beforeEach, describe, afterAll, it } from "@std/testing/bdd"
33
import specimen0, { _internals } from "./integrate.ts"
4-
import { assertRejects } from "deno/assert/mod.ts"
5-
import * as mock from "deno/testing/mock.ts"
4+
import { assertRejects } from "@std/assert"
5+
import * as mock from "@std/testing/mock"
66
import { isString } from "is-what"
77
import { Path } from "pkgx"
88

0 commit comments

Comments
 (0)