0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JSR で一度公開したパッケージは基本削除できないので注意

Posted at

JSR でのパッケージ公開を試していたあるとき

テキトーに console.loghello するだけのコードを書いて・・・

ls
# hello.ts  jsr.json  mod.ts
hello.ts
/**
 * Say hello module
 *
 * @author aKuad
 */

/**
 * Say hello
 */
export function hello(): undefined {
  console.log("hello");
}
mod.ts
export * from "./hello.ts"
jsr.json
{
  "name": "@akuad/pub-test",
  "version": "0.0.1",
  "license": "CC0",
  "exports": "./mod.ts"
}

公開

deno publish
Checking for slow types in the public API...
Visit https://jsr.io/auth?code=XXXX-XXXX to authorize publishing of @akuad/pub-test
Waiting...
Authorization successful. Authenticated as aKuad
Publishing @akuad/pub-test@0.0.1 ...
Successfully published @akuad/pub-test@0.0.1
Visit https://jsr.io/@akuad/pub-test@0.0.1 for details

おー、できたできた。

さっそく呼んでみよう。Deno の REPL でお試し。

deno
> import { hello } from "jsr:@akuad/pub-test";
undefined
> hello()
hello
undefined

いい感じ。

さて、遊び終わったし削除・・・ってあれ?

パッケージの Settings で、

JSR package setting

Delete・・・あれ、押せない??

JSR package setting - Delete package

もう用無いし消したいんだけど、どうすれば・・・?

基本は消せないらしい

公式サイトへゴー。

すると、気になる一文が。

Packages can only be deleted if they have no published versions. If a package has published versions, it cannot be deleted. Learn more about registry immutability.

「パッケージに公開されたバージョンがある場合、消すことができない」だって?

もうちょっと詳しく、Immutability について。

どれどれ?信頼性、セキュリティ、シンプルさのために、JSR は Immutable (不変) であると・・・。不変、つまり一度出したら、変更することも、削除することもできないということ。

事故ってしまったときはメール

Immutability のページ内「I published a secret / personal info by accident, what do I do?」の章。

シークレットを公開してしまった場合は、そのシークレットを早急に無効化すること。個人情報を入れて公開してしまい、削除したい場合は help@jsr.io までメールして、とのこと。

パッケージ (あるいはその一部) を削除できるのは、事故ってしまった非常用に限られるようです。本記事最初のように、JSR を試すために遊んだ場合は当てはまりません。覚悟を決めて JSR がなくなるまで公開し続けましょう。

まとめ

JSR に一度公開したら、基本消せません。簡単な遊びだとしても、黒歴史にならないよう、ある程度内容を考えてから公開しましょう。

(なんだかインターネットについて学校で教わったことを思い出す。)

と言っても、もし「jsr パッケージ 削除」の検索でここにたどり着いているようであれば、手遅れということになるのですが・・・。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?