diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 97da21c..4f8b3f4 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -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" + + diff -qr "$tmp_dir/local-unpacked/package" "$tmp_dir/remote-unpacked/package" >/dev/null + } + 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 fi echo "${package_name}@${VERSION} is not published yet; publishing." diff --git a/README.md b/README.md index a3b5457..a39dbaa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/installation.md b/docs/installation.md index 90c35f7..134c7df 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -73,10 +73,10 @@ 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. @@ -84,8 +84,8 @@ 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:** diff --git a/docs/src/content/installation.js b/docs/src/content/installation.js index 320e100..c3ddb40 100644 --- a/docs/src/content/installation.js +++ b/docs/src/content/installation.js @@ -44,14 +44,14 @@ export function render() {

Via npm / bun

-
npm install -g coven-code
+    
npm install -g @opencoven/coven-code
 # or
-bun install -g coven-code
+bun install -g @opencoven/coven-code

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

-
npx coven-code
-bunx coven-code
+
npx @opencoven/coven-code
+bunx @opencoven/coven-code

Upgrading

diff --git a/npm/bin/coven-code b/npm/bin/coven-code index 26d3fdf..c2df1ac 100644 --- a/npm/bin/coven-code +++ b/npm/bin/coven-code @@ -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);