Skip to content

Commit

Permalink
Merge 4a5c670 into 99c9c22
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Oct 12, 2023
2 parents 99c9c22 + 4a5c670 commit 5adc90a
Show file tree
Hide file tree
Showing 45 changed files with 240 additions and 2,815 deletions.
55 changes: 28 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ jobs:
os:
- macos-latest
- ubuntu-latest
- windows-latest

steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- run: deno cache mod.ts
# - run: deno cache mod.ts

- run: deno task test
--coverage=cov_profile
Expand All @@ -47,35 +48,35 @@ jobs:
with:
parallel-finished: true

verify-usage-as-deno-lib:
# we’re checking no import-map type imports snuck in
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: src
- uses: denoland/setup-deno@v1
- run: deno run --no-config --unstable src/mod.ts
# verify-usage-as-deno-lib:
# # we’re checking no import-map type imports snuck in
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# path: src
# - uses: denoland/setup-deno@v1
# - run: deno run --no-config --unstable src/mod.ts

dnt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- run: deno run -A --unstable .github/deno-to-node.ts
# dnt:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: denoland/setup-deno@v1
# - run: deno run -A --unstable .github/deno-to-node.ts

- run: |
npm i
npm start
working-directory:
fixtures/npm-integration-test
# - run: |
# npm i
# npm start
# working-directory:
# fixtures/npm-integration-test

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- run: deno lint
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: denoland/setup-deno@v1
# - run: deno lint

typecheck:
runs-on: ubuntu-latest
Expand Down
21 changes: 0 additions & 21 deletions examples/awscli/index.mjs

This file was deleted.

8 changes: 0 additions & 8 deletions examples/awscli/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions examples/whisper.js

This file was deleted.

17 changes: 0 additions & 17 deletions examples/whisper.mjs

This file was deleted.

21 changes: 0 additions & 21 deletions examples/whisper.ts

This file was deleted.

8 changes: 0 additions & 8 deletions fixtures/npm-integration-test/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions fixtures/npm-integration-test/package.json

This file was deleted.

Empty file.
6 changes: 0 additions & 6 deletions fixtures/projects/foo.com/package.yml

This file was deleted.

98 changes: 49 additions & 49 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,65 @@ export * as types from "./src/types.ts"
import * as pkg from "./src/utils/pkg.ts"

import { panic, PkgxError } from "./src/utils/error.ts"
import useConfig from "./src/hooks/useConfig.ts"
import useOffLicense from "./src/hooks/useOffLicense.ts"
import useCache from "./src/hooks/useCache.ts"
import useCellar, { InstallationNotFoundError} from "./src/hooks/useCellar.ts"
import useMoustaches from "./src/hooks/useMoustaches.ts"
import usePantry, { PantryError, PantryParseError, PantryNotFoundError, PackageNotFoundError } from "./src/hooks/usePantry.ts"
import useFetch from "./src/hooks/useFetch.ts"
import useDownload, { DownloadError } from "./src/hooks/useDownload.ts"
import useShellEnv from "./src/hooks/useShellEnv.ts"
import useInventory from "./src/hooks/useInventory.ts"
import hydrate from "./src/plumbing/hydrate.ts"
import which from "./src/plumbing/which.ts"
import link from "./src/plumbing/link.ts"
import install, { ConsoleLogger } from "./src/plumbing/install.ts"
import resolve, { ResolveError } from "./src/plumbing/resolve.ts"
import useSync from "./src/hooks/useSync.ts"
import run, { RunError } from "./src/porcelain/run.ts"
import porcelain_install from "./src/porcelain/install.ts"
// import useConfig from "./src/hooks/useConfig.ts"
// import useOffLicense from "./src/hooks/useOffLicense.ts"
// import useCache from "./src/hooks/useCache.ts"
// import useCellar, { InstallationNotFoundError} from "./src/hooks/useCellar.ts"
// import useMoustaches from "./src/hooks/useMoustaches.ts"
// import usePantry, { PantryError, PantryParseError, PantryNotFoundError, PackageNotFoundError } from "./src/hooks/usePantry.ts"
// import useFetch from "./src/hooks/useFetch.ts"
// import useDownload, { DownloadError } from "./src/hooks/useDownload.ts"
// import useShellEnv from "./src/hooks/useShellEnv.ts"
// import useInventory from "./src/hooks/useInventory.ts"
// import hydrate from "./src/plumbing/hydrate.ts"
// import which from "./src/plumbing/which.ts"
// import link from "./src/plumbing/link.ts"
// import install, { ConsoleLogger } from "./src/plumbing/install.ts"
// import resolve, { ResolveError } from "./src/plumbing/resolve.ts"
// import useSync from "./src/hooks/useSync.ts"
// import run, { RunError } from "./src/porcelain/run.ts"
// import porcelain_install from "./src/porcelain/install.ts"

const utils = {
pkg, host, flatmap, validate, panic, ConsoleLogger
pkg, host, flatmap, validate, panic, //ConsoleLogger
}

const hooks = {
useCache,
useCellar,
useConfig,
useDownload,
useFetch,
useInventory,
useMoustaches,
useOffLicense,
usePantry,
useShellEnv,
useSync,
}
// const hooks = {
// useCache,
// useCellar,
// useConfig,
// useDownload,
// useFetch,
// useInventory,
// useMoustaches,
// useOffLicense,
// usePantry,
// useShellEnv,
// useSync,
// }

const plumbing = {
hydrate,
link,
install,
resolve,
which
}
// const plumbing = {
// hydrate,
// link,
// install,
// resolve,
// which
// }

const porcelain = {
install: porcelain_install,
run
}
// const porcelain = {
// install: porcelain_install,
// run
// }

export {
utils, hooks, plumbing, porcelain,
utils, //hooks, plumbing, porcelain,
semver,
PkgxError,
RunError,
ResolveError,
PantryError, PantryParseError, PantryNotFoundError, PackageNotFoundError,
InstallationNotFoundError,
DownloadError
// RunError,
// ResolveError,
// PantryError, PantryParseError, PantryNotFoundError, PackageNotFoundError,
// InstallationNotFoundError,
// DownloadError
}

/// export types
Expand Down
17 changes: 10 additions & 7 deletions src/hooks/useCellar.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { assertEquals, assertRejects } from "deno/assert/mod.ts"
import SemVer, * as semver from "../utils/semver.ts"
import { useTestConfig } from "./useTestConfig.ts"
import install from "../plumbing/install.ts"
import useCellar from "./useCellar.ts"

Deno.test("useCellar.resolve()", async () => {
useTestConfig()

const pkgrq = { project: "python.org", version: new SemVer("3.11.3")}
const installation = await install(pkgrq)
const pkg = { project: "python.org", version: new SemVer("3.11.3") }
const path = useCellar().shelf(pkg.project).join(`v${pkg.version}`).mkdir('p')
path.join("cant-be-empty").touch()
const installation = { pkg, path }

await useCellar().resolve(installation)
await useCellar().resolve(installation.pkg)
Expand All @@ -21,11 +22,13 @@ Deno.test("useCellar.resolve()", async () => {
Deno.test("useCellar.has()", async () => {
useTestConfig()

const rq = { project: "beyondgrep.com", version: new SemVer("3.6.0") }
const pkg = { project: "beyondgrep.com", version: new SemVer("3.6.0") }

assertEquals(await useCellar().has(rq), undefined)
assertEquals(await useCellar().has(pkg), undefined)

const installation = await install(rq)
const path = useCellar().shelf(pkg.project).join(`v${pkg.version}`).mkdir('p')
path.join("cant-be-empty").touch()
const installation = { pkg, path }

assertEquals(await useCellar().has(rq), installation)
assertEquals(await useCellar().has(pkg), installation)
})
6 changes: 5 additions & 1 deletion src/hooks/useConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ Deno.test("useConfig", () => {
}

config = ConfigDefault({ PKGX_PANTRY_PATH: "/foo:/bar", CI: "true" })
assertEquals(config.pantries.map(x => x.string), ["/foo", "/bar"])
if (Deno.build.os != 'windows') {
assertEquals(config.pantries.map(x => x.string), ["/foo", "/bar"])
} else {
assertEquals(config.pantries.map(x => x.string), ["C:\\foo", "C:\\bar"])
}
assertEquals(config.options.compression, "gz")

assertFalse(_internals.boolize("false"))
Expand Down
40 changes: 0 additions & 40 deletions src/hooks/useDownload.test.ts

This file was deleted.

Loading

0 comments on commit 5adc90a

Please sign in to comment.