2024/6/19 JSR使ってjotai-syncを公開する
JSR使う
jotai-syncというpackageを作ってpublishしてみる
Publish a package
https://jsr.io/new
https://gyazo.com/9532edaff0e3c4a197d0f245809daa2b
ScopeとPackage名を指定
https://gyazo.com/360787222c84953adb230e102eb4d0c5
ページができる
https://jsr.io/@mrsekut/jotai-sync/publish
これpackage.json使わないんだ
コードを書く
jotaiに依存するので入れる
$ npx jsr add @jotai/jotai
λ npx jsr add
package.jsonが生成された
若干version低かったのでnpm i jotaiで入れ直した
importは@jotaiというscope付きになる
code:ts
import { type WritableAtom, atom } from "@jotai/jotai";
パッケージの公開
https://jsr.io/docs/publishing-packages
λ npx jsr publish
公開している関数の返り値の型が明示的に書かれていないとエラーになるらしい
https://jsr.io/docs/about-slow-types#explicit-types
code:bash
λ npx jsr publish
Downloading JSR binary...
00:02 #################################################> 39.4 MiB/39.7 MiB
Checking for slow types in the public API...
errormissing-explicit-return-type: missing explicit return type in the public API
--> /path/to/jotai-sync/mod.ts:3:14
|
3 | export const syncAtoms = <A, B>(
| ^^^^^^^^^ this function is missing an explicit return type
|
= hint: add an explicit return type to the function
info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type
This package contains errors for slow types. Fixing these errors will:
1. Significantly improve your package users' type checking performance.
2. Improve the automatic documentation generation.
3. Enable automatic .d.ts generation for Node.js.
Don't want to bother? You can choose to skip this step by
providing the --allow-slow-types flag.
error: Found 1 problem
Child process exited with: 1
slow typeってなんだ?
承認はサイト上でやるらしい
https://gyazo.com/9a7130fc454dad615c7e3341ed061bf0
JSR Scoreというのがでている
しかもめっさ低い
https://gyazo.com/60306dafd3d9e324614e4719d61871ab