From 53a4e4054dea32714fd2e4d65283f3f773c61c0c Mon Sep 17 00:00:00 2001 From: NoriDev Date: Mon, 12 Jun 2023 16:35:30 +0900 Subject: [PATCH] misskey-js -> cherrypick-js --- .github/labeler.yml | 10 +++--- .github/workflows/api-misskey-js.yml | 10 +++--- .github/workflows/lint.yml | 4 +-- .github/workflows/storybook.yml | 4 +-- ...-misskey-js.yml => test-cherrypick-js.yml} | 8 ++--- CHANGELOG_CHERRYPICK.md | 1 + CONTRIBUTING.md | 6 ++-- Dockerfile | 2 +- packages/backend/package.json | 2 +- packages/backend/test/e2e/antennas.ts | 4 +-- packages/backend/test/e2e/clips.ts | 2 +- packages/backend/test/e2e/users.ts | 4 +-- packages/backend/test/utils.ts | 2 +- .../.eslintignore | 0 .../.eslintrc.cjs | 0 packages/{misskey-js => cherrypick-js}/.swcrc | 0 .../CONTRIBUTING.md | 0 .../{misskey-js => cherrypick-js}/LICENSE | 0 .../{misskey-js => cherrypick-js}/README.md | 36 +++++++++---------- .../api-extractor.json | 0 .../docs/CONTRIBUTING.en.md | 0 .../etc/cherrypick-js.api.md} | 2 +- .../jest.config.cjs | 0 .../package.json | 4 +-- .../{misskey-js => cherrypick-js}/src/acct.ts | 0 .../{misskey-js => cherrypick-js}/src/api.ts | 0 .../src/api.types.ts | 0 .../src/consts.ts | 0 .../src/entities.ts | 0 .../src/index.ts | 0 .../src/streaming.ts | 0 .../src/streaming.types.ts | 0 .../test-d/api.ts | 0 .../test-d/streaming.ts | 0 .../{misskey-js => cherrypick-js}/test/api.ts | 0 .../test/streaming.ts | 0 .../tsconfig.json | 0 packages/frontend/.storybook/fakes.ts | 2 +- packages/frontend/package.json | 2 +- packages/frontend/src/account.ts | 2 +- packages/frontend/src/cache.ts | 2 +- .../src/components/MkAbuseReportWindow.vue | 2 +- .../src/components/MkAccountMoved.vue | 2 +- .../src/components/MkAchievements.vue | 2 +- .../src/components/MkCropperDialog.vue | 2 +- .../frontend/src/components/MkCwButton.vue | 2 +- .../frontend/src/components/MkDrive.file.vue | 2 +- .../src/components/MkDrive.folder.vue | 2 +- .../src/components/MkDrive.navFolder.vue | 2 +- packages/frontend/src/components/MkDrive.vue | 2 +- .../src/components/MkDriveFileThumbnail.vue | 2 +- .../src/components/MkDriveSelectDialog.vue | 2 +- .../frontend/src/components/MkDriveWindow.vue | 2 +- .../frontend/src/components/MkEmojiPicker.vue | 2 +- .../src/components/MkFeaturedPhotos.vue | 2 +- .../components/MkFileCaptionEditWindow.vue | 2 +- .../src/components/MkFileListForAdmin.vue | 2 +- .../src/components/MkFollowButton.vue | 2 +- .../src/components/MkGalleryPostPreview.vue | 2 +- .../src/components/MkInstanceCardMini.vue | 2 +- .../frontend/src/components/MkMediaBanner.vue | 2 +- .../frontend/src/components/MkMediaImage.vue | 2 +- .../frontend/src/components/MkMediaList.vue | 2 +- .../frontend/src/components/MkMediaVideo.vue | 2 +- packages/frontend/src/components/MkNote.vue | 2 +- .../src/components/MkNoteDetailed.vue | 2 +- .../frontend/src/components/MkNoteHeader.vue | 2 +- .../frontend/src/components/MkNoteSimple.vue | 2 +- .../frontend/src/components/MkNoteSub.vue | 2 +- .../src/components/MkNotification.vue | 2 +- .../src/components/MkNotifications-Pages.vue | 2 +- .../frontend/src/components/MkPagePreview.vue | 2 +- .../frontend/src/components/MkPagination.vue | 2 +- packages/frontend/src/components/MkPoll.vue | 2 +- .../frontend/src/components/MkPostForm.vue | 4 +-- .../src/components/MkPostFormDialog.vue | 2 +- .../src/components/MkReactedUsersDialog.vue | 2 +- .../components/MkReactionsViewer.reaction.vue | 2 +- .../src/components/MkReactionsViewer.vue | 2 +- .../src/components/MkRenotedUsersDialog.vue | 2 +- .../src/components/MkSubNoteContent.vue | 2 +- .../src/components/MkTokenGenerateWindow.vue | 2 +- .../src/components/MkUserCardMini.vue | 2 +- .../frontend/src/components/MkUserInfo.vue | 2 +- .../src/components/MkUserOnlineIndicator.vue | 2 +- .../frontend/src/components/MkUserPopup.vue | 4 +-- .../src/components/MkUserSelectDialog.vue | 2 +- .../src/components/MkUserSetupDialog.User.vue | 2 +- .../src/components/MkVisibilityPicker.vue | 2 +- .../src/components/MkVisitorDashboard.vue | 2 +- .../components/global/CPAvatar-Friendly.vue | 2 +- .../frontend/src/components/global/MkAcct.vue | 2 +- .../src/components/global/MkAvatar.vue | 2 +- .../global/MkMisskeyFlavoredMarkdown.ts | 2 +- .../src/components/global/MkUserName.vue | 2 +- .../src/components/global/toast-avatar.vue | 2 +- .../src/components/page/page.block.vue | 2 +- .../src/components/page/page.image.vue | 2 +- .../src/components/page/page.note.vue | 2 +- .../src/components/page/page.section.vue | 2 +- .../src/components/page/page.text.vue | 2 +- .../frontend/src/components/page/page.vue | 2 +- packages/frontend/src/custom-emojis.ts | 2 +- packages/frontend/src/filters/user.ts | 4 +-- packages/frontend/src/instance.ts | 2 +- packages/frontend/src/os.ts | 4 +-- packages/frontend/src/pages/_error_.vue | 2 +- packages/frontend/src/pages/about.emojis.vue | 2 +- packages/frontend/src/pages/api-console.vue | 2 +- packages/frontend/src/pages/auth.form.vue | 2 +- packages/frontend/src/pages/auth.vue | 2 +- packages/frontend/src/pages/clip.vue | 2 +- packages/frontend/src/pages/follow.vue | 2 +- packages/frontend/src/pages/instance-info.vue | 2 +- .../frontend/src/pages/messaging/index.vue | 2 +- .../pages/messaging/messaging-room.form.vue | 2 +- .../messaging/messaging-room.message.vue | 2 +- .../src/pages/messaging/messaging-room.vue | 4 +-- .../frontend/src/pages/my-antennas/editor.vue | 2 +- packages/frontend/src/pages/note.vue | 2 +- .../frontend/src/pages/settings/accounts.vue | 2 +- .../frontend/src/pages/settings/migration.vue | 4 +-- packages/frontend/src/pages/share.vue | 6 ++-- packages/frontend/src/pages/user-info.vue | 2 +- .../frontend/src/pages/user/achievements.vue | 2 +- .../src/pages/user/activity.following.vue | 2 +- .../src/pages/user/activity.heatmap.vue | 2 +- .../src/pages/user/activity.notes.vue | 2 +- .../frontend/src/pages/user/activity.pv.vue | 2 +- packages/frontend/src/pages/user/activity.vue | 2 +- packages/frontend/src/pages/user/clips.vue | 2 +- .../frontend/src/pages/user/follow-list.vue | 2 +- .../frontend/src/pages/user/followers.vue | 4 +-- .../frontend/src/pages/user/following.vue | 4 +-- packages/frontend/src/pages/user/gallery.vue | 2 +- packages/frontend/src/pages/user/home.vue | 2 +- .../src/pages/user/index.activity.vue | 2 +- .../frontend/src/pages/user/index.photos.vue | 2 +- .../src/pages/user/index.timeline.vue | 2 +- packages/frontend/src/pages/user/index.vue | 4 +-- packages/frontend/src/pages/user/lists.vue | 2 +- packages/frontend/src/pages/user/pages.vue | 2 +- .../frontend/src/pages/user/reactions.vue | 2 +- .../frontend/src/pages/welcome.entrance.a.vue | 2 +- .../frontend/src/pages/welcome.timeline.vue | 2 +- packages/frontend/src/scripts/api.ts | 2 +- .../frontend/src/scripts/gen-search-query.ts | 2 +- .../src/scripts/get-drive-file-menu.ts | 2 +- .../frontend/src/scripts/get-note-menu.ts | 2 +- .../frontend/src/scripts/get-note-summary.ts | 2 +- .../frontend/src/scripts/get-user-menu.ts | 2 +- packages/frontend/src/scripts/lookup-user.ts | 2 +- .../frontend/src/scripts/page-metadata.ts | 2 +- packages/frontend/src/scripts/select-file.ts | 2 +- packages/frontend/src/scripts/upload.ts | 2 +- .../frontend/src/scripts/use-note-capture.ts | 2 +- packages/frontend/src/store.ts | 2 +- packages/frontend/src/stream.ts | 2 +- packages/frontend/src/types/menu.ts | 2 +- packages/frontend/src/ui/_common_/common.vue | 2 +- .../frontend/src/ui/_common_/notification.vue | 2 +- .../src/ui/_common_/statusbar-federation.vue | 2 +- .../src/ui/_common_/statusbar-user-list.vue | 2 +- .../frontend/src/ui/deck/channel-column.vue | 2 +- packages/frontend/src/ui/deck/deck-store.ts | 2 +- packages/frontend/test/home.test.ts | 2 +- packages/frontend/test/init.ts | 2 +- packages/frontend/test/note.test.ts | 2 +- packages/frontend/vite.config.ts | 4 +-- packages/sw/package.json | 2 +- packages/sw/src/scripts/operations.ts | 2 +- packages/sw/src/sw.ts | 2 +- packages/sw/src/types.ts | 2 +- pnpm-lock.yaml | 14 ++++---- pnpm-workspace.yaml | 2 +- 175 files changed, 207 insertions(+), 206 deletions(-) rename .github/workflows/{test-misskey-js.yml => test-cherrypick-js.yml} (86%) rename packages/{misskey-js => cherrypick-js}/.eslintignore (100%) rename packages/{misskey-js => cherrypick-js}/.eslintrc.cjs (100%) rename packages/{misskey-js => cherrypick-js}/.swcrc (100%) rename packages/{misskey-js => cherrypick-js}/CONTRIBUTING.md (100%) rename packages/{misskey-js => cherrypick-js}/LICENSE (100%) rename packages/{misskey-js => cherrypick-js}/README.md (78%) rename packages/{misskey-js => cherrypick-js}/api-extractor.json (100%) rename packages/{misskey-js => cherrypick-js}/docs/CONTRIBUTING.en.md (100%) rename packages/{misskey-js/etc/misskey-js.api.md => cherrypick-js/etc/cherrypick-js.api.md} (99%) rename packages/{misskey-js => cherrypick-js}/jest.config.cjs (100%) rename packages/{misskey-js => cherrypick-js}/package.json (93%) rename packages/{misskey-js => cherrypick-js}/src/acct.ts (100%) rename packages/{misskey-js => cherrypick-js}/src/api.ts (100%) rename packages/{misskey-js => cherrypick-js}/src/api.types.ts (100%) rename packages/{misskey-js => cherrypick-js}/src/consts.ts (100%) rename packages/{misskey-js => cherrypick-js}/src/entities.ts (100%) rename packages/{misskey-js => cherrypick-js}/src/index.ts (100%) rename packages/{misskey-js => cherrypick-js}/src/streaming.ts (100%) rename packages/{misskey-js => cherrypick-js}/src/streaming.types.ts (100%) rename packages/{misskey-js => cherrypick-js}/test-d/api.ts (100%) rename packages/{misskey-js => cherrypick-js}/test-d/streaming.ts (100%) rename packages/{misskey-js => cherrypick-js}/test/api.ts (100%) rename packages/{misskey-js => cherrypick-js}/test/streaming.ts (100%) rename packages/{misskey-js => cherrypick-js}/tsconfig.json (100%) diff --git a/.github/labeler.yml b/.github/labeler.yml index 137be487c0..5312f3e328 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -13,9 +13,9 @@ 'packages/sw': - packages/sw/**/* -'packages/misskey-js': -- packages/misskey-js/**/* +'packages/cherrypick-js': +- packages/cherrypick-js/**/* -'packages/misskey-js:test': -- packages/misskey-js/test/**/* -- packages/misskey-js/test-d/**/* +'packages/cherrypick-js:test': +- packages/cherrypick-js/test/**/* +- packages/cherrypick-js/test-d/**/* diff --git a/.github/workflows/api-misskey-js.yml b/.github/workflows/api-misskey-js.yml index ed004c78dc..c311a40bea 100644 --- a/.github/workflows/api-misskey-js.yml +++ b/.github/workflows/api-misskey-js.yml @@ -1,4 +1,4 @@ -name: API report (misskey.js) +name: API report (cherrypick.js) on: [push, pull_request] @@ -23,14 +23,14 @@ jobs: run: pnpm i --frozen-lockfile - name: Build - run: pnpm --filter misskey-js build + run: pnpm --filter cherrypick-js build - name: Check files - run: ls packages/misskey-js/built + run: ls packages/cherrypick-js/built - name: API report - run: pnpm --filter misskey-js api-prod + run: pnpm --filter cherrypick-js api-prod - name: Show report if: always() - run: cat packages/misskey-js/temp/misskey-js.api.md + run: cat packages/cherrypick-js/temp/cherrypick-js.api.md diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0f3702f958..e51896f610 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,7 +36,7 @@ jobs: - backend - frontend - sw - - misskey-js + - cherrypick-js steps: - uses: actions/checkout@v3.3.0 with: @@ -62,7 +62,7 @@ jobs: matrix: workspace: - backend - - misskey-js + - cherrypick-js steps: - uses: actions/checkout@v3.3.0 with: diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 22675a9871..d9190a2e36 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -46,8 +46,8 @@ jobs: - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml run: git diff --exit-code pnpm-lock.yaml - - name: Build misskey-js - run: pnpm --filter misskey-js build + - name: Build cherrypick-js + run: pnpm --filter cherrypick-js build - name: Build storybook run: pnpm --filter frontend build-storybook - name: Publish to Chromatic diff --git a/.github/workflows/test-misskey-js.yml b/.github/workflows/test-cherrypick-js.yml similarity index 86% rename from .github/workflows/test-misskey-js.yml rename to .github/workflows/test-cherrypick-js.yml index b15e704c7f..d8b82ab53b 100644 --- a/.github/workflows/test-misskey-js.yml +++ b/.github/workflows/test-cherrypick-js.yml @@ -1,7 +1,7 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Test (misskey.js) +name: Test (cherrypick.js) on: push: @@ -38,10 +38,10 @@ jobs: run: git diff --exit-code pnpm-lock.yaml - name: Build - run: pnpm --filter misskey-js build + run: pnpm --filter cherrypick-js build - name: Test - run: pnpm --filter misskey-js test + run: pnpm --filter cherrypick-js test env: CI: true @@ -49,4 +49,4 @@ jobs: uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/misskey-js/coverage/coverage-final.json + files: ./packages/cherrypick-js/coverage/coverage-final.json diff --git a/CHANGELOG_CHERRYPICK.md b/CHANGELOG_CHERRYPICK.md index 282779e67a..d4c217561d 100644 --- a/CHANGELOG_CHERRYPICK.md +++ b/CHANGELOG_CHERRYPICK.md @@ -66,6 +66,7 @@ ### Server - mfm-js를 cherrypick-mfm-js로 변경 +- misskey-js를 cherrypick-js로 변경 --- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef9c39740d..4bc0ad3f53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -219,7 +219,7 @@ CherryPick uses [Storybook](https://storybook.js.org/) for UI development. ##### Setup ```bash -pnpm --filter misskey-js build +pnpm --filter cherrypick-js build pnpm --filter frontend tsc -p .storybook && (node packages/frontend/.storybook/preload-locale.js & node packages/frontend/.storybook/preload-theme.js) ``` @@ -234,7 +234,7 @@ node packages/frontend/.storybook/generate.js && pnpm --filter frontend storyboo ##### Setup ```bash -pnpm --filter misskey-js build +pnpm --filter cherrypick-js build ``` ##### Run @@ -435,7 +435,7 @@ export const paramDef = { ``` ### コネクションには`markRaw`せよ -**Vueのコンポーネントのdataオプションとして**misskey.jsのコネクションを設定するとき、必ず`markRaw`でラップしてください。インスタンスが不必要にリアクティブ化されることで、misskey.js内の処理で不具合が発生するとともに、パフォーマンス上の問題にも繋がる。なお、Composition APIを使う場合はこの限りではない(リアクティブ化はマニュアルなため)。 +**Vueのコンポーネントのdataオプションとして**cherrypick.jsのコネクションを設定するとき、必ず`markRaw`でラップしてください。インスタンスが不必要にリアクティブ化されることで、misskey.js内の処理で不具合が発生するとともに、パフォーマンス上の問題にも繋がる。なお、Composition APIを使う場合はこの限りではない(リアクティブ化はマニュアルなため)。 ### JSONのimportに気を付けよう TypeScriptでjsonをimportすると、tscでコンパイルするときにそのjsonファイルも一緒にdistディレクトリに吐き出されてしまう。この挙動により、意図せずファイルの書き換えが発生することがあるので、jsonをimportするときは書き換えられても良いものかどうか確認すること。書き換えされて欲しくない場合は、importで読み込むのではなく、`fs.readFileSync`などの関数を使って読み込むようにすればよい。 diff --git a/Dockerfile b/Dockerfile index 902bc3930b..0d01053a11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ COPY --link ["scripts", "./scripts"] COPY --link ["packages/backend/package.json", "./packages/backend/"] COPY --link ["packages/frontend/package.json", "./packages/frontend/"] COPY --link ["packages/sw/package.json", "./packages/sw/"] -COPY --link ["packages/misskey-js/package.json", "./packages/misskey-js/"] +COPY --link ["packages/cherrypick-js/package.json", "./packages/cherrypick-js/"] RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \ pnpm i --frozen-lockfile --aggregate-output diff --git a/packages/backend/package.json b/packages/backend/package.json index 13e242a058..442db0687f 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -111,7 +111,7 @@ "meilisearch": "0.32.5", "cherrypick-mfm-js": "0.23.3-cp-1.0.0", "mime-types": "2.1.35", - "misskey-js": "workspace:*", + "cherrypick-js": "workspace:*", "ms": "3.0.0-canary.1", "nested-property": "4.0.0", "node-fetch": "3.3.1", diff --git a/packages/backend/test/e2e/antennas.ts b/packages/backend/test/e2e/antennas.ts index dd3b09f85a..a94b02769d 100644 --- a/packages/backend/test/e2e/antennas.ts +++ b/packages/backend/test/e2e/antennas.ts @@ -17,7 +17,7 @@ import { uploadFile, testPaginationConsistency, } from '../utils.js'; -import type * as misskey from 'misskey-js'; +import type * as misskey from 'cherrypick-js'; import type { INestApplicationContext } from '@nestjs/common'; const compareBy = (selector: (s: T) => string = (s: T): string => s.id) => (a: T, b: T): number => { @@ -28,7 +28,7 @@ describe('アンテナ', () => { // エンティティとしてのアンテナを主眼においたテストを記述する // (Antennaを返すエンドポイント、Antennaエンティティを書き換えるエンドポイント、Antennaからノートを取得するエンドポイントをテストする) - // BUG misskey-jsとjson-schemaが一致していない。 + // BUG cherrypick-jsとjson-schemaが一致していない。 // - srcのenumにgroupが残っている // - userGroupIdが残っている, isActiveがない type Antenna = misskey.entities.Antenna | Packed<'Antenna'>; diff --git a/packages/backend/test/e2e/clips.ts b/packages/backend/test/e2e/clips.ts index f35aae9dc6..b37a73db5d 100644 --- a/packages/backend/test/e2e/clips.ts +++ b/packages/backend/test/e2e/clips.ts @@ -144,7 +144,7 @@ describe('クリップ', () => { alice = await signup({ username: 'alice' }); bob = await signup({ username: 'bob' }); - // FIXME: misskey-jsのNoteはoutdatedなので直接変換できない + // FIXME: cherrypick-jsのNoteはoutdatedなので直接変換できない aliceNote = await post(alice, { text: 'test' }) as any; aliceHomeNote = await post(alice, { text: 'home only', visibility: 'home' }) as any; aliceFollowersNote = await post(alice, { text: 'followers only', visibility: 'followers' }) as any; diff --git a/packages/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index 02684c93b8..f35b3bfc08 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -15,7 +15,7 @@ import { failedApiCall, uploadFile, } from '../utils.js'; -import type * as misskey from 'misskey-js'; +import type * as misskey from 'cherrypick-js'; import type { INestApplicationContext } from '@nestjs/common'; describe('ユーザー', () => { @@ -31,7 +31,7 @@ describe('ユーザー', () => { }, {}); }; - // BUG misskey-jsとjson-schemaと実際に返ってくるデータが全部違う + // BUG cherrypick-jsとjson-schemaと実際に返ってくるデータが全部違う type UserLite = misskey.entities.UserLite & { badgeRoles: any[], }; diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 22f7d81e4e..17f00ffc86 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -9,7 +9,7 @@ import { JSDOM } from 'jsdom'; import { DEFAULT_POLICIES } from '@/core/RoleService.js'; import { entities } from '../src/postgres.js'; import { loadConfig } from '../src/config.js'; -import type * as misskey from 'misskey-js'; +import type * as misskey from 'cherrypick-js'; export { server as startServer } from '@/boot/common.js'; diff --git a/packages/misskey-js/.eslintignore b/packages/cherrypick-js/.eslintignore similarity index 100% rename from packages/misskey-js/.eslintignore rename to packages/cherrypick-js/.eslintignore diff --git a/packages/misskey-js/.eslintrc.cjs b/packages/cherrypick-js/.eslintrc.cjs similarity index 100% rename from packages/misskey-js/.eslintrc.cjs rename to packages/cherrypick-js/.eslintrc.cjs diff --git a/packages/misskey-js/.swcrc b/packages/cherrypick-js/.swcrc similarity index 100% rename from packages/misskey-js/.swcrc rename to packages/cherrypick-js/.swcrc diff --git a/packages/misskey-js/CONTRIBUTING.md b/packages/cherrypick-js/CONTRIBUTING.md similarity index 100% rename from packages/misskey-js/CONTRIBUTING.md rename to packages/cherrypick-js/CONTRIBUTING.md diff --git a/packages/misskey-js/LICENSE b/packages/cherrypick-js/LICENSE similarity index 100% rename from packages/misskey-js/LICENSE rename to packages/cherrypick-js/LICENSE diff --git a/packages/misskey-js/README.md b/packages/cherrypick-js/README.md similarity index 78% rename from packages/misskey-js/README.md rename to packages/cherrypick-js/README.md index 318149f4f1..6526a318af 100644 --- a/packages/misskey-js/README.md +++ b/packages/cherrypick-js/README.md @@ -1,32 +1,32 @@ -# misskey.js -**Strongly-typed official Misskey SDK for browsers/Node.js.** +# cherrypick.js +**Strongly-typed official CherryPick SDK for browsers/Node.js.** [![Test](https://github.com/misskey-dev/misskey.js/actions/workflows/test.yml/badge.svg)](https://github.com/misskey-dev/misskey.js/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/misskey-dev/misskey.js/branch/develop/graph/badge.svg?token=PbrTtk3nVD)](https://codecov.io/gh/misskey-dev/misskey.js) [![NPM](https://nodei.co/npm/misskey-js.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/misskey-js) -JavaScript(TypeScript)用の公式MisskeySDKです。ブラウザ/Node.js上で動作します。 +JavaScript(TypeScript)用の公式CherryPickSDKです。ブラウザ/Node.js上で動作します。 以下が提供されています: - ユーザー認証 - APIリクエスト - ストリーミング - ユーティリティ関数 -- Misskeyの各種型定義 +- CherryPickの各種型定義 -対応するMisskeyのバージョンは12以上です。 +対応するCherryPickのバージョンは12以上です。 ## Install ``` -npm i misskey-js +npm i cherrypick-js ``` # Usage インポートは以下のようにまとめて行うと便利です。 ``` ts -import * as Misskey from 'misskey-js'; +import * as Misskey from 'cherrypick-js'; ``` 便宜上、以後のコード例は上記のように`* as Misskey`としてインポートしている前提のものになります。 @@ -34,7 +34,7 @@ import * as Misskey from 'misskey-js'; ただし、このインポート方法だとTree-Shakingできなくなるので、コードサイズが重要なユースケースでは以下のような個別インポートをお勧めします。 ``` ts -import { api as misskeyApi } from 'misskey-js'; +import { api as misskeyApi } from 'cherrypick-js'; ``` ## Authenticate @@ -45,7 +45,7 @@ APIを利用する際は、利用するサーバーの情報とアクセスト ``` ts const cli = new Misskey.api.APIClient({ - origin: 'https://misskey.test', + origin: 'https://cherrypick.test', credential: 'TOKEN', }); @@ -55,12 +55,12 @@ const meta = await cli.request('meta', { detail: true }); `request`の第一引数には呼び出すエンドポイント名、第二引数にはパラメータオブジェクトを渡します。レスポンスはPromiseとして返ります。 ## Streaming -misskey.jsのストリーミングでは、二つのクラスが提供されます。 +cherrypick.jsのストリーミングでは、二つのクラスが提供されます。 ひとつは、ストリーミングのコネクション自体を司る`Stream`クラスと、もうひとつはストリーミング上のチャンネルの概念を表す`Channel`クラスです。 ストリーミングを利用する際は、まず`Stream`クラスのインスタンスを初期化し、その後で`Stream`インスタンスのメソッドを利用して`Channel`クラスのインスタンスを取得する形になります。 ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); const mainChannel = stream.useChannel('main'); mainChannel.on('notification', notification => { console.log('notification received', notification); @@ -74,14 +74,14 @@ mainChannel.on('notification', notification => { パラメータなし ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); const mainChannel = stream.useChannel('main'); ``` パラメータあり ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); const messagingChannel = stream.useChannel('messaging', { otherparty: 'xxxxxxxxxx', @@ -92,7 +92,7 @@ const messagingChannel = stream.useChannel('messaging', { `Channel`クラスの`dispose`メソッドを呼び出します。 ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); const mainChannel = stream.useChannel('main'); @@ -103,7 +103,7 @@ mainChannel.dispose(); `Channel`クラスはEventEmitterを継承しており、メッセージがサーバーから受信されると受け取ったイベント名でペイロードをemitします。 ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); const mainChannel = stream.useChannel('main'); mainChannel.on('notification', notification => { console.log('notification received', notification); @@ -114,7 +114,7 @@ mainChannel.on('notification', notification => { `Channel`クラスの`send`メソッドを使用してメッセージをサーバーに送信することができます。 ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); const messagingChannel = stream.useChannel('messaging', { otherparty: 'xxxxxxxxxx', }); @@ -128,7 +128,7 @@ messagingChannel.send('read', { `Stream`クラスの`_connected_`イベントが利用可能です。 ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); stream.on('_connected_', () => { console.log('connected'); }); @@ -138,7 +138,7 @@ stream.on('_connected_', () => { `Stream`クラスの`_disconnected_`イベントが利用可能です。 ``` ts -const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' }); +const stream = new Misskey.Stream('https://cherrypick.test', { token: 'TOKEN' }); stream.on('_disconnected_', () => { console.log('disconnected'); }); diff --git a/packages/misskey-js/api-extractor.json b/packages/cherrypick-js/api-extractor.json similarity index 100% rename from packages/misskey-js/api-extractor.json rename to packages/cherrypick-js/api-extractor.json diff --git a/packages/misskey-js/docs/CONTRIBUTING.en.md b/packages/cherrypick-js/docs/CONTRIBUTING.en.md similarity index 100% rename from packages/misskey-js/docs/CONTRIBUTING.en.md rename to packages/cherrypick-js/docs/CONTRIBUTING.en.md diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/cherrypick-js/etc/cherrypick-js.api.md similarity index 99% rename from packages/misskey-js/etc/misskey-js.api.md rename to packages/cherrypick-js/etc/cherrypick-js.api.md index eddc5cf90c..137596a1bf 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/cherrypick-js/etc/cherrypick-js.api.md @@ -1,4 +1,4 @@ -## API Report File for "misskey-js" +## API Report File for "cherrypick-js" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). diff --git a/packages/misskey-js/jest.config.cjs b/packages/cherrypick-js/jest.config.cjs similarity index 100% rename from packages/misskey-js/jest.config.cjs rename to packages/cherrypick-js/jest.config.cjs diff --git a/packages/misskey-js/package.json b/packages/cherrypick-js/package.json similarity index 93% rename from packages/misskey-js/package.json rename to packages/cherrypick-js/package.json index 23836b05f5..d889eacd02 100644 --- a/packages/misskey-js/package.json +++ b/packages/cherrypick-js/package.json @@ -1,7 +1,7 @@ { - "name": "misskey-js", + "name": "cherrypick-js", "version": "0.0.15", - "description": "Misskey SDK for JavaScript", + "description": "CherryPick SDK for JavaScript", "main": "./built/index.js", "types": "./built/index.d.ts", "scripts": { diff --git a/packages/misskey-js/src/acct.ts b/packages/cherrypick-js/src/acct.ts similarity index 100% rename from packages/misskey-js/src/acct.ts rename to packages/cherrypick-js/src/acct.ts diff --git a/packages/misskey-js/src/api.ts b/packages/cherrypick-js/src/api.ts similarity index 100% rename from packages/misskey-js/src/api.ts rename to packages/cherrypick-js/src/api.ts diff --git a/packages/misskey-js/src/api.types.ts b/packages/cherrypick-js/src/api.types.ts similarity index 100% rename from packages/misskey-js/src/api.types.ts rename to packages/cherrypick-js/src/api.types.ts diff --git a/packages/misskey-js/src/consts.ts b/packages/cherrypick-js/src/consts.ts similarity index 100% rename from packages/misskey-js/src/consts.ts rename to packages/cherrypick-js/src/consts.ts diff --git a/packages/misskey-js/src/entities.ts b/packages/cherrypick-js/src/entities.ts similarity index 100% rename from packages/misskey-js/src/entities.ts rename to packages/cherrypick-js/src/entities.ts diff --git a/packages/misskey-js/src/index.ts b/packages/cherrypick-js/src/index.ts similarity index 100% rename from packages/misskey-js/src/index.ts rename to packages/cherrypick-js/src/index.ts diff --git a/packages/misskey-js/src/streaming.ts b/packages/cherrypick-js/src/streaming.ts similarity index 100% rename from packages/misskey-js/src/streaming.ts rename to packages/cherrypick-js/src/streaming.ts diff --git a/packages/misskey-js/src/streaming.types.ts b/packages/cherrypick-js/src/streaming.types.ts similarity index 100% rename from packages/misskey-js/src/streaming.types.ts rename to packages/cherrypick-js/src/streaming.types.ts diff --git a/packages/misskey-js/test-d/api.ts b/packages/cherrypick-js/test-d/api.ts similarity index 100% rename from packages/misskey-js/test-d/api.ts rename to packages/cherrypick-js/test-d/api.ts diff --git a/packages/misskey-js/test-d/streaming.ts b/packages/cherrypick-js/test-d/streaming.ts similarity index 100% rename from packages/misskey-js/test-d/streaming.ts rename to packages/cherrypick-js/test-d/streaming.ts diff --git a/packages/misskey-js/test/api.ts b/packages/cherrypick-js/test/api.ts similarity index 100% rename from packages/misskey-js/test/api.ts rename to packages/cherrypick-js/test/api.ts diff --git a/packages/misskey-js/test/streaming.ts b/packages/cherrypick-js/test/streaming.ts similarity index 100% rename from packages/misskey-js/test/streaming.ts rename to packages/cherrypick-js/test/streaming.ts diff --git a/packages/misskey-js/tsconfig.json b/packages/cherrypick-js/tsconfig.json similarity index 100% rename from packages/misskey-js/tsconfig.json rename to packages/cherrypick-js/tsconfig.json diff --git a/packages/frontend/.storybook/fakes.ts b/packages/frontend/.storybook/fakes.ts index 06d971501d..d179a3891f 100644 --- a/packages/frontend/.storybook/fakes.ts +++ b/packages/frontend/.storybook/fakes.ts @@ -1,4 +1,4 @@ -import type { entities } from 'misskey-js' +import type { entities } from 'cherrypick-js' export function abuseUserReport() { return { diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 82ddb32954..18266350ab 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -49,7 +49,7 @@ "json5": "2.2.3", "matter-js": "0.19.0", "cherrypick-mfm-js": "0.23.3-cp-1.0.0", - "misskey-js": "workspace:*", + "cherrypick-js": "workspace:*", "photoswipe": "5.3.7", "prismjs": "1.29.0", "punycode": "2.3.0", diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index a754eaf1c6..9a0713d169 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -1,5 +1,5 @@ import { defineAsyncComponent, reactive, ref } from 'vue'; -import * as misskey from 'misskey-js'; +import * as misskey from 'cherrypick-js'; import { showSuspendedDialog } from './scripts/show-suspended-dialog'; import { i18n } from './i18n'; import { miLocalStorage } from './local-storage'; diff --git a/packages/frontend/src/cache.ts b/packages/frontend/src/cache.ts index c95da64bba..14e44001e4 100644 --- a/packages/frontend/src/cache.ts +++ b/packages/frontend/src/cache.ts @@ -1,4 +1,4 @@ -import * as misskey from 'misskey-js'; +import * as misskey from 'cherrypick-js'; import { Cache } from '@/scripts/cache'; export const clipsCache = new Cache(Infinity); diff --git a/packages/frontend/src/components/MkAbuseReportWindow.vue b/packages/frontend/src/components/MkAbuseReportWindow.vue index 48236782d9..25a9ea47c9 100644 --- a/packages/frontend/src/components/MkAbuseReportWindow.vue +++ b/packages/frontend/src/components/MkAbuseReportWindow.vue @@ -26,7 +26,7 @@