Repository navigation
feat(cli): Publish CLI releases under the v3 sentry-cli names #2514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
sentry-junior
wants to merge
4
commits into
main
Choose a base branch
from
feat/cli-legacy-distribution-channels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+852
−35
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2b1cbac
feat(cli): Publish CLI releases under the v3 sentry-cli names
sentry-junior[bot] bd6ca6e
fix(cli): Upgrade the package or formula the CLI was installed from
sentry-junior[bot] 42fe78a
ref(cli): Rename the sentry-cli Homebrew formula instead of publishin…
sentry-junior[bot] 125b940
Merge remote-tracking branch 'origin/main' into feat/cli-legacy-distr…
sentry-junior[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # @sentry/cli | ||
|
|
||
| Version 4 of the Sentry CLI is published as [`sentry`](https://www.npmjs.com/package/sentry). | ||
| `@sentry/cli` 4.x ships the same code under the old package name, so that | ||
| upgrades find it. Install `sentry` instead: | ||
|
|
||
| ```bash | ||
| npm install -g sentry | ||
| ``` | ||
|
|
||
| The command is now `sentry`, not `sentry-cli`, and the `SentryCli` class is | ||
| replaced by `createSentrySDK()`. Version 3 stays available as `@sentry/cli@3`. | ||
|
|
||
| See [Migrating from v3](https://cli.sentry.dev/migrating-from-v3/) and the | ||
| [documentation](https://cli.sentry.dev). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # sentry-cli | ||
|
|
||
| The command-line interface for [Sentry](https://sentry.io), built for | ||
| developers and AI agents. | ||
|
|
||
| Each wheel contains the standalone `sentry` binary for one platform: macOS | ||
| (arm64, x64), Linux with glibc 2.28 or later (arm64, x64), and Windows (x64). | ||
| There is no source distribution, so pip cannot install it on other platforms, | ||
| such as Alpine Linux. Use `npm install -g sentry` there. | ||
|
|
||
| ```bash | ||
| pip install sentry-cli | ||
| sentry --help | ||
| ``` | ||
|
|
||
| Version 4 installs a `sentry` command, not `sentry-cli`. To keep version 3, | ||
| pin `sentry-cli<4`. The `sentry` package (self-hosted Sentry) also installs a | ||
| `sentry` command, so do not install both into the same environment. | ||
|
|
||
| See [Migrating from v3](https://cli.sentry.dev/migrating-from-v3/) and the | ||
| [documentation](https://cli.sentry.dev). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /** | ||
| * Build the PyPI wheel of one standalone binary. | ||
| * | ||
| * Usage (from packages/cli, after `pnpm run build -- --target <target>`): | ||
| * pnpm run ts script/build-wheel.ts linux-x64 | ||
| * | ||
| * Reads dist-bin/sentry-<target>[.exe] and writes dist-wheel/<wheel>.whl. | ||
| */ | ||
|
|
||
| import { mkdir, readFile, writeFile } from "node:fs/promises"; | ||
| import { extname, join } from "node:path"; | ||
| import pkg from "../package.json" with { type: "json" }; | ||
| import { buildWheel, WHEEL_TARGETS } from "./lib/python-wheel.js"; | ||
| import { logger } from "../src/lib/logger.js"; | ||
|
|
||
| const OUT_DIR = "dist-wheel"; | ||
|
|
||
| const target = process.argv[2] ?? ""; | ||
| const exe = WHEEL_TARGETS[target]?.exe; | ||
| if (!exe) { | ||
| logger.error( | ||
| `Usage: build-wheel.ts <target>, one of: ${Object.keys(WHEEL_TARGETS).join(", ")}`, | ||
| ); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| const [binary, readme, license] = await Promise.all([ | ||
| readFile(join("dist-bin", `sentry-${target}${extname(exe)}`)), | ||
| readFile("packaging/pypi-README.md", "utf-8"), | ||
| readFile("LICENSE.md", "utf-8"), | ||
| ]); | ||
| const wheel = buildWheel({ | ||
| target, | ||
| version: pkg.version, | ||
| binary, | ||
| summary: pkg.description, | ||
| readme, | ||
| license, | ||
| }); | ||
| await mkdir(OUT_DIR, { recursive: true }); | ||
| await writeFile(join(OUT_DIR, wheel.filename), wheel.contents); | ||
| logger.success(`Built ${OUT_DIR}/${wheel.filename}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /** | ||
| * The `@sentry/cli` npm package: the `sentry` package under the v3 name, so | ||
| * `npm install @sentry/cli@latest` gets version 4. | ||
| */ | ||
|
|
||
| import { execFileSync } from "node:child_process"; | ||
| import { copyFile, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; | ||
| import { tmpdir } from "node:os"; | ||
| import { join, resolve } from "node:path"; | ||
|
|
||
| export const NPM_ALIAS_NAME = "@sentry/cli"; | ||
|
|
||
| /** | ||
| * Repack a `sentry` npm tarball as `@sentry/cli`, with the same files and the | ||
| * given README. npm names the result `sentry-cli-<version>.tgz`. | ||
| * | ||
| * @param tarball - Tarball from `npm pack` of the `sentry` package | ||
| * @param readme - README that replaces the package's own | ||
| * @param outDir - Directory for the new tarball | ||
| */ | ||
| export async function packNpmAlias( | ||
| tarball: string, | ||
| readme: string, | ||
| outDir: string, | ||
| ): Promise<void> { | ||
| const dir = await mkdtemp(join(tmpdir(), "sentry-npm-alias-")); | ||
| try { | ||
| execFileSync("tar", ["-xzf", resolve(tarball), "-C", dir]); | ||
| // npm pack always puts the package in package/. | ||
| const packageDir = join(dir, "package"); | ||
| const manifestPath = join(packageDir, "package.json"); | ||
| const manifest = JSON.parse(await readFile(manifestPath, "utf-8")); | ||
| manifest.name = NPM_ALIAS_NAME; | ||
| manifest.publishConfig = { access: "public" }; | ||
| await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`); | ||
| await copyFile(readme, join(packageDir, "README.md")); | ||
| execFileSync( | ||
| "npm", | ||
| ["pack", "--ignore-scripts", "--pack-destination", resolve(outDir)], | ||
| { cwd: packageDir, stdio: ["ignore", "ignore", "inherit"] }, | ||
| ); | ||
| } finally { | ||
| await rm(dir, { recursive: true, force: true }); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.