diff --git a/.github/workflows/api-misskey-js.yml b/.github/workflows/api-misskey-js.yml index 5cffbd81bc..e52cbc33e4 100644 --- a/.github/workflows/api-misskey-js.yml +++ b/.github/workflows/api-misskey-js.yml @@ -1,6 +1,12 @@ name: API report (misskey.js) -on: [push, pull_request] +on: + push: + paths: + - packages/misskey-js/** + pull_request: + paths: + - packages/misskey-js/** jobs: report: diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml new file mode 100644 index 0000000000..d4cdf64f70 --- /dev/null +++ b/.github/workflows/changelog-check.yml @@ -0,0 +1,43 @@ +name: Check the description in CHANGELOG.md + +on: + pull_request: + branches: + - master + - develop + +jobs: + check-changelog: + runs-on: ubuntu-latest + + steps: + - name: Checkout head + uses: actions/checkout@v4.1.1 + - name: Setup Node.js + uses: actions/setup-node@v4.0.1 + with: + node-version-file: '.node-version' + + - name: Checkout base + run: | + mkdir _base + cp -r .git _base/.git + cd _base + git fetch --depth 1 origin ${{ github.base_ref }} + git checkout origin/${{ github.base_ref }} CHANGELOG.md + + - name: Copy to Checker directory for CHANGELOG-base.md + run: cp _base/CHANGELOG.md scripts/changelog-checker/CHANGELOG-base.md + - name: Copy to Checker directory for CHANGELOG-head.md + run: cp CHANGELOG.md scripts/changelog-checker/CHANGELOG-head.md + - name: diff + continue-on-error: true + run: diff -u CHANGELOG-base.md CHANGELOG-head.md + working-directory: scripts/changelog-checker + + - name: Setup Checker + run: npm install + working-directory: scripts/changelog-checker + - name: Run Checker + run: npm run run + working-directory: scripts/changelog-checker diff --git a/.github/workflows/check-misskey-js-autogen.yml b/.github/workflows/check-misskey-js-autogen.yml new file mode 100644 index 0000000000..545b215756 --- /dev/null +++ b/.github/workflows/check-misskey-js-autogen.yml @@ -0,0 +1,134 @@ +name: Check Misskey JS autogen + +on: + pull_request_target: + branches: + - master + - develop + paths: + - packages/backend/** + +jobs: + check-misskey-js-autogen: + runs-on: ubuntu-latest + permissions: + pull-requests: write + + env: + api_json_name: "api-head.json" + + steps: + - name: checkout + uses: actions/checkout@v4 + with: + submodules: true + ref: ${{ github.event.pull_request.head.sha }} + + - name: setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: setup node + id: setup-node + uses: actions/setup-node@v4 + with: + node-version-file: '.node-version' + cache: pnpm + + - name: install dependencies + run: pnpm i --frozen-lockfile + + - name: wait get-api-diff + uses: lewagon/wait-on-check-action@v1.3.3 + with: + ref: ${{ github.event.pull_request.head.sha }} + check-regexp: get-from-misskey .+ + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 30 + + - name: Download artifact + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + + const workflows = await github.rest.actions.listWorkflowRunsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + head_sha: `${{ github.event.pull_request.head.sha }}` + }).then(x => x.data.workflow_runs); + + console.log(workflows.map(x => ({name: x.name, title: x.display_title}))); + + const run_id = workflows.find(x => x.name.includes("Get api.json from Misskey")).id; + + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: run_id, + }); + + let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name.startsWith("api-artifact-") || artifact.name == "api-artifact" + }); + + await Promise.all(matchArtifacts.map(async (artifact) => { + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: artifact.id, + archive_format: 'zip', + }); + await fs.promises.writeFile(`${process.env.GITHUB_WORKSPACE}/${artifact.name}.zip`, Buffer.from(download.data)); + })); + + - name: unzip artifacts + run: |- + find . -mindepth 1 -maxdepth 1 -type f -name '*.zip' -exec unzip {} -d . ';' + ls -la + + - name: get head checksum + run: |- + checksum=$(realpath head_checksum) + + cd packages/misskey-js/src + find autogen -type f -exec sh -c 'echo $(sed -E "s/^\s+\*\s+generatedAt:.+$//" {} | sha256sum | cut -d" " -f 1) {}' \; > $checksum + cd ../../.. + + - name: build autogen + run: |- + checksum=$(realpath ${api_json_name}_checksum) + mv $api_json_name packages/misskey-js/generator/api.json + + cd packages/misskey-js/generator + pnpm run generate + cd built + find autogen -type f -exec sh -c 'echo $(sed -E "s/^\s+\*\s+generatedAt:.+$//" {} | sha256sum | cut -d" " -f 1) {}' \; > $checksum + cd ../../../.. + + - name: check update for type definitions + run: diff head_checksum ${api_json_name}_checksum + + - name: send message + if: failure() + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: check-misskey-js-autogen + message: |- + Thank you for sending us a great Pull Request! 👍 + Please regenerate misskey-js type definitions! 🙏 + + example: + ```sh + pnpm run build-misskey-js-with-types + ``` + + - name: send message + if: success() + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: check-misskey-js-autogen + mode: delete + message: "Thank you!" + create_if_not_exists: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f3074ab0a4..86fca995d2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,7 +5,19 @@ on: branches: - master - develop + paths: + - packages/backend/** + - packages/frontend/** + - packages/sw/** + - packages/misskey-js/** + - packages/shared/.eslintrc.js pull_request: + paths: + - packages/backend/** + - packages/frontend/** + - packages/sw/** + - packages/misskey-js/** + - packages/shared/.eslintrc.js jobs: pnpm_install: @@ -80,4 +92,6 @@ jobs: - run: pnpm i --frozen-lockfile - run: pnpm --filter misskey-js run build if: ${{ matrix.workspace == 'backend' }} + - run: pnpm --filter misskey-reversi run build:tsc + if: ${{ matrix.workspace == 'backend' }} - run: pnpm --filter ${{ matrix.workspace }} run typecheck diff --git a/.github/workflows/on-release-created.yml b/.github/workflows/on-release-created.yml new file mode 100644 index 0000000000..3cc0e5007b --- /dev/null +++ b/.github/workflows/on-release-created.yml @@ -0,0 +1,45 @@ +name: On Release Created (Publish misskey-js) + +on: + release: + types: [created] + + workflow_dispatch: + +jobs: + publish-misskey-js: + name: Publish misskey-js + runs-on: ubuntu-latest + + permissions: + contents: read + id-token: write + + strategy: + matrix: + node-version: [20.10.0] + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + registry-url: 'https://registry.npmjs.org' + - name: Publish package + run: | + corepack enable + pnpm i --frozen-lockfile + pnpm build + pnpm --filter misskey-js publish --access public --no-git-checks --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} + NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 9681cbec59..a6c12e2824 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -5,10 +5,18 @@ on: branches: - master - develop + paths: + - packages/backend/** + # for permissions + - packages/misskey-js/** pull_request: + paths: + - packages/backend/** + # for permissions + - packages/misskey-js/** jobs: - jest: + unit: runs-on: ubuntu-latest strategy: @@ -51,9 +59,59 @@ jobs: - name: Build run: pnpm build - name: Test - run: pnpm jest-and-coverage - - name: Upload Coverage + run: pnpm --filter backend test-and-coverage + - name: Upload to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/backend/coverage/coverage-final.json + + e2e: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.10.0] + + services: + postgres: + image: postgres:15 + ports: + - 54312:5432 + env: + POSTGRES_DB: test-misskey + POSTGRES_HOST_AUTH_METHOD: trust + redis: + image: redis:7 + ports: + - 56312:6379 + + steps: + - uses: actions/checkout@v4.1.1 + with: + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4.0.1 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .github/misskey/test.yml .config + - name: Build + run: pnpm build + - name: Test + run: pnpm --filter backend test-and-coverage:e2e + - name: Upload to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./packages/backend/coverage/coverage-final.json diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index 83740bf156..3fb880fac2 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -5,7 +5,20 @@ on: branches: - master - develop + paths: + - packages/frontend/** + # for permissions + - packages/misskey-js/** + # for e2e + - packages/backend/** + pull_request: + paths: + - packages/frontend/** + # for permissions + - packages/misskey-js/** + # for e2e + - packages/backend/** jobs: vitest: diff --git a/.github/workflows/test-misskey-js.yml b/.github/workflows/test-misskey-js.yml index 055152f321..5aed385df9 100644 --- a/.github/workflows/test-misskey-js.yml +++ b/.github/workflows/test-misskey-js.yml @@ -6,8 +6,12 @@ name: Test (misskey.js) on: push: branches: [ develop ] + paths: + - packages/misskey-js/** pull_request: branches: [ develop ] + paths: + - packages/misskey-js/** jobs: test: @@ -50,3 +54,17 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/misskey-js/coverage/coverage-final.json + + check-version: + # ルートの package.json と packages/misskey-js/package.json のバージョンが一致しているかを確認する + name: Check version + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + - name: Check version + run: | + if [ "$(jq -r '.version' package.json)" != "$(jq -r '.version' packages/misskey-js/package.json)" ]; then + echo "Version mismatch!" + exit 1 + fi diff --git a/.github/workflows/validate-api-json.yml b/.github/workflows/validate-api-json.yml new file mode 100644 index 0000000000..93c4cf4cd1 --- /dev/null +++ b/.github/workflows/validate-api-json.yml @@ -0,0 +1,47 @@ +name: Test (backend) + +on: + push: + branches: + - master + - develop + paths: + - packages/backend/** + pull_request: + paths: + - packages/backend/** + +jobs: + validate-api-json: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.10.0] + + steps: + - uses: actions/checkout@v4.1.1 + with: + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4.0.1 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: Install Redocly CLI + run: npm i -g @redocly/cli + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .config/example.yml .config/default.yml + - name: Build and generate + run: pnpm build && pnpm --filter backend generate-api-json + - name: Validation + run: npx @redocly/cli lint --extends=minimal ./packages/backend/built/api.json diff --git a/.gitignore b/.gitignore index a66e527db0..bdc14fea0a 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ docker-compose.yml # misskey /build built +built-test /data /.cache-loader /db @@ -57,6 +58,7 @@ api-docs.json ormconfig.json temp /packages/frontend/src/**/*.stories.ts +tsdoc-metadata.json # blender backups *.blend1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 474fcad674..cff0fc07cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ diff --git a/packages/frontend/src/components/MkCustomEmojiDetailedDialog.vue b/packages/frontend/src/components/MkCustomEmojiDetailedDialog.vue new file mode 100644 index 0000000000..1952369b6d --- /dev/null +++ b/packages/frontend/src/components/MkCustomEmojiDetailedDialog.vue @@ -0,0 +1,104 @@ + + + + + + + diff --git a/packages/frontend/src/components/MkCwButton.vue b/packages/frontend/src/components/MkCwButton.vue index 4a6d2dfba2..ca19a2122d 100644 --- a/packages/frontend/src/components/MkCwButton.vue +++ b/packages/frontend/src/components/MkCwButton.vue @@ -41,9 +41,9 @@ const emit = defineEmits<{ const label = computed(() => { return concat([ - props.text ? [i18n.t('_cw.chars', { count: props.text.length })] : [], + props.text ? [i18n.tsx._cw.chars({ count: props.text.length })] : [], props.renote ? [i18n.ts.quote] : [], - props.files.length !== 0 ? [i18n.t('_cw.files', { count: props.files.length })] : [], + props.files.length !== 0 ? [i18n.tsx._cw.files({ count: props.files.length })] : [], props.poll != null ? [i18n.ts.poll] : [], ] as string[][]).join(' / '); }); diff --git a/packages/frontend/src/components/MkDateSeparatedList.vue b/packages/frontend/src/components/MkDateSeparatedList.vue index 0a71b689fe..7b9a052868 100644 --- a/packages/frontend/src/components/MkDateSeparatedList.vue +++ b/packages/frontend/src/components/MkDateSeparatedList.vue @@ -46,7 +46,7 @@ export default defineComponent({ function getDateText(time: string) { const date = new Date(time).getDate(); const month = new Date(time).getMonth() + 1; - return i18n.t('monthAndDay', { + return i18n.tsx.monthAndDay({ month: month.toString(), day: date.toString(), }); diff --git a/packages/frontend/src/components/MkDialog.vue b/packages/frontend/src/components/MkDialog.vue index 3c1f83d335..3fc9f0e357 100644 --- a/packages/frontend/src/components/MkDialog.vue +++ b/packages/frontend/src/components/MkDialog.vue @@ -30,8 +30,8 @@ SPDX-License-Identifier: AGPL-3.0-only diff --git a/packages/frontend/src/components/MkDrive.vue b/packages/frontend/src/components/MkDrive.vue index dbf98cd622..560d5502d4 100644 --- a/packages/frontend/src/components/MkDrive.vue +++ b/packages/frontend/src/components/MkDrive.vue @@ -82,8 +82,8 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.loadMore }}
-
{{ i18n.t('empty-draghover') }}
-
{{ i18n.ts.emptyDrive }}
{{ i18n.t('empty-drive-description') }}
+
{{ i18n.ts['empty-draghover'] }}
+
{{ i18n.ts.emptyDrive }}
{{ i18n.ts['empty-drive-description'] }}
{{ i18n.ts.emptyFolder }}
diff --git a/packages/frontend/src/components/MkEmojiPicker.vue b/packages/frontend/src/components/MkEmojiPicker.vue index f36d46506f..84424c58ed 100644 --- a/packages/frontend/src/components/MkEmojiPicker.vue +++ b/packages/frontend/src/components/MkEmojiPicker.vue @@ -221,6 +221,19 @@ watch(q, () => { } } } else { + if (customEmojisMap.has(newQ)) { + matches.add(customEmojisMap.get(newQ)!); + } + if (matches.size >= max) return matches; + + for (const emoji of emojis) { + if (emoji.aliases.some(alias => alias === newQ)) { + matches.add(emoji); + if (matches.size >= max) break; + } + } + if (matches.size >= max) return matches; + for (const emoji of emojis) { if (emoji.name.startsWith(newQ)) { matches.add(emoji); diff --git a/packages/frontend/src/components/MkFlashPreview.vue b/packages/frontend/src/components/MkFlashPreview.vue index ab435585d9..1be8a6d8f7 100644 --- a/packages/frontend/src/components/MkFlashPreview.vue +++ b/packages/frontend/src/components/MkFlashPreview.vue @@ -9,7 +9,9 @@ SPDX-License-Identifier: AGPL-3.0-only

{{ flash.title }}

-

{{ flash.summary.length > 85 ? flash.summary.slice(0, 85) + '…' : flash.summary }}

+

+ +