Skip to content
Open
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
33 changes: 31 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,40 @@ jobs:
NODE
}

published_package_matches_local() {
local package_name="$1"
local tmp_dir local_dir remote_dir
tmp_dir="$(mktemp -d)"
local_dir="$tmp_dir/local"
remote_dir="$tmp_dir/remote"
mkdir -p "$local_dir" "$remote_dir"

(cd npm && npm pack --pack-destination "$local_dir" >/dev/null)
npm pack "${package_name}@${VERSION}" --pack-destination "$remote_dir" >/dev/null

mkdir -p "$tmp_dir/local-unpacked" "$tmp_dir/remote-unpacked"
tar -xzf "$(find "$local_dir" -name '*.tgz' -print -quit)" -C "$tmp_dir/local-unpacked"
tar -xzf "$(find "$remote_dir" -name '*.tgz' -print -quit)" -C "$tmp_dir/remote-unpacked"
Comment on lines +266 to +267

diff -qr "$tmp_dir/local-unpacked/package" "$tmp_dir/remote-unpacked/package" >/dev/null
}
Comment on lines +254 to +270

packages=("@opencoven/coven-code" "coven-code")
for package_name in "${packages[@]}"; do
if npm view "${package_name}@${VERSION}" version >/dev/null 2>&1; then
echo "${package_name}@${VERSION} is already published; skipping."
continue
if [[ "$package_name" == "@opencoven/coven-code" ]]; then
echo "${package_name}@${VERSION} is already published; skipping."
continue
fi

prepare_package "$package_name"
if published_package_matches_local "$package_name"; then
echo "${package_name}@${VERSION} is already published with the expected package contents; skipping."
continue
fi

echo "::error::${package_name}@${VERSION} already exists on npm with unexpected package contents."
exit 1
Comment on lines +281 to +287
fi

echo "${package_name}@${VERSION} is not published yet; publishing."
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,14 @@ This drops `coven-code` into `~/.coven-code/bin` (or `%USERPROFILE%\.coven-code\
### npm / Bun

```bash
npm install -g coven-code
# or the scoped package
npm install -g @opencoven/coven-code

bun install -g coven-code
# or the scoped package
bun install -g @opencoven/coven-code
```

```bash
npx coven-code
bunx coven-code
npx @opencoven/coven-code
bunx @opencoven/coven-code
```

### Upgrade
Expand Down
8 changes: 4 additions & 4 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ native binary for your platform from GitHub Releases — no compilation needed.

```bash
# npm
npm install -g coven-code
npm install -g @opencoven/coven-code

# bun
bun install -g coven-code
bun install -g @opencoven/coven-code
```

After installation, run `coven-code` directly from your terminal.

You can also run Coven Code without a permanent install:

```bash
npx coven-code # via npm
bunx coven-code # via bun
npx @opencoven/coven-code # via npm
bunx @opencoven/coven-code # via bun
```

**Supported platforms via npm:**
Expand Down
8 changes: 4 additions & 4 deletions docs/src/content/installation.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export function render() {

<h2>Via npm / bun</h2>

<pre><code data-lang="bash">npm install -g coven-code
<pre><code data-lang="bash">npm install -g @opencoven/coven-code
# or
bun install -g coven-code</code></pre>
bun install -g @opencoven/coven-code</code></pre>

<p>The postinstall script downloads the correct pre-built binary from GitHub Releases — no compilation needed. Or run without a permanent install:</p>

<pre><code data-lang="bash">npx coven-code
bunx coven-code</code></pre>
<pre><code data-lang="bash">npx @opencoven/coven-code
bunx @opencoven/coven-code</code></pre>

<h2>Upgrading</h2>

Expand Down
2 changes: 1 addition & 1 deletion npm/bin/coven-code
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const binary = path.join(__dirname, '..', 'native', `coven-code${ext}`);
if (!fs.existsSync(binary)) {
console.error(
'coven-code: native binary not found.\n' +
'Try reinstalling: npm install -g coven-code\n' +
'Try reinstalling: npm install -g @opencoven/coven-code\n' +
`Expected: ${binary}`
);
process.exit(1);
Expand Down