Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</p>


# tea/cli 0.35.0
# tea/cli 0.35.1

`tea` puts the whole open source ecosystem at your fingertips:

Expand Down
4 changes: 2 additions & 2 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"imports": {
"is-what": "https://deno.land/x/is_what@v4.1.8/src/index.ts",
"jsonc": "https://deno.land/x/jsonc_parser@v0.0.1/mod.ts",
"tea": "https://raw.github.com/teaxyz/lib/v0.3.1/mod.ts",
"tea/": "https://raw.github.com/teaxyz/lib/v0.3.1/src/",
"tea": "https://raw.github.com/teaxyz/lib/v0.4.2/mod.ts",
"tea/": "https://raw.github.com/teaxyz/lib/v0.4.2/src/",
"outdent": "https://deno.land/x/outdent@v0.8.0/mod.ts",
"cliffy/": "https://deno.land/x/cliffy@v0.25.7/",
"deno/": "https://deno.land/std@0.187.0/",
Expand Down
4 changes: 2 additions & 2 deletions scripts/repair.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env -S deno run -A

import { hooks, semver, Installation, prefab } from "tea"
import { hooks, semver, Installation, plumbing } from "tea"
import { useConfig } from "hooks"
const { useCellar } = hooks
const { link } = prefab
const { link } = plumbing

if (import.meta.main) {
useConfig()
Expand Down
19 changes: 16 additions & 3 deletions src/app.magic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default function(self: Path, shell?: string) {
fi
}

if test "$TERM_PROGRAM" = WarpTerminal -o "$TERM_PROGRAM" = vscode; then
# warp.dev & vscode integrated terminal don’t call the hook on startup
if test "$TERM_PROGRAM" != Apple_Terminal; then
# Apple’s app calls this hook itself, but nothing else seems to
_tea_chpwd_hook
fi

Expand All @@ -28,11 +28,18 @@ export default function(self: Path, shell?: string) {
chpwd_functions=( _tea_chpwd_hook \${chpwd_functions[@]} )
fi

# add our shims to the PATH
TEA_PREFIX="\${TEA_PREFIX:-$HOME/.tea}"
if [[ "$PATH" != *"$TEA_PREFIX/.local/bin"* ]]; then
export PATH="$TEA_PREFIX/.local/bin:$PATH"
fi

# we configure eg. \`npm i -g\`, cargo, etc. to install here
if [[ "$PATH" != *"$HOME/.local/bin"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi

if ! command -v tea 2>&1 >/dev/null || ! tea --prefix 2>&1 >/dev/null; then
if ! command -v tea 2>&1 >/dev/null; then
export PATH="${d}:$PATH"
fi

Expand Down Expand Up @@ -114,6 +121,12 @@ export default function(self: Path, shell?: string) {
source /dev/stdin <<<"$("${d}"/tea +tea.xyz/magic -Esk --chaste env)"
}

# add our shims to the PATH
TEA_PREFIX="\${TEA_PREFIX:-$HOME/.tea}"
if [[ "$PATH" != *"$TEA_PREFIX/.local/bin"* ]]; then
export PATH="$TEA_PREFIX/.local/bin:$PATH"
fi

if [[ "$PATH" != *"$HOME/.local/bin"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
Expand Down
25 changes: 17 additions & 8 deletions src/prefab/install.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { PackageSpecification, Package, utils, Installation, plumbing, Path } from "tea"
import { Logger as InstallLogger } from "tea/plumbing/install.ts"
const { hydrate, link: base_link, resolve, install } = plumbing
import useConfig, { Verbosity } from "../hooks/useConfig.ts"
import useLogger, { Logger } from "../hooks/useLogger.ts"
import { ExitError } from "../hooks/useErrorHandler.ts"
const { hydrate, link: base_link, resolve, install } = plumbing
import usePantry from "tea/hooks/usePantry.ts"
import undent from "outdent"
import usePantry from "https://raw.githubusercontent.com/teaxyz/lib/v0.3.1/src/hooks/usePantry.ts"

//TODO we should use even more plumbing to ensure pkgs aren’t moved into
// TEA_PREFIX until all their deps are moved in
Expand Down Expand Up @@ -223,17 +223,26 @@ function QuietLogger(logger: Logger): InstallLogger {

async function link(installation: Installation) {
const pp: Promise<void>[] = [base_link(installation)]
const { prefix: TEA_PREFIX } = useConfig()

const bin = useConfig().prefix.join("local/bin")
const tea = useConfig().prefix.join("tea.xyz/v*/bin/tea").isExecutableFile()?.relative({ to: bin })
const bin = TEA_PREFIX.join(".local/bin")
const tea = TEA_PREFIX.join("tea.xyz/v*/bin/tea").isExecutableFile()
const provides = await usePantry().project(installation.pkg).provides()

/// we only do auto-POSIX symlinking if tea is installed properly
if (tea) for (const provides of await usePantry().project(installation.pkg).provides()) {
const target = bin.mkdir('p').join(provides)
if (!target.exists()) {
const p = Deno.symlink(tea, target.string)
if (tea && provides.length) {
const tealink = bin.mkdir('p').join("tea")
if (!tealink.exists()) {
const p = Deno.symlink(tea.relative({ to: bin }), tealink.string)
pp.push(p)
}
for (const exename of provides) {
const target = bin.join(exename)
if (!target.exists()) {
const p = Deno.symlink("tea", target.string)
pp.push(p)
}
}
}

await Promise.all(pp)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/tea.ln.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ it(suite, "auto-symlinks in ~/.tea/local work", async function() {
this.tea = this.tea.cp({ into: this.TEA_PREFIX.join("tea.xyz/v*/bin").mkdir('p') })
await this.run({args: ["perl", "--version"]})

assert(this.TEA_PREFIX.join("local/bin/perl").isExecutableFile())
assert(this.TEA_PREFIX.join(".local/bin/perl").isExecutableFile())
})