Additional changes for the merge

This commit is contained in:
Kagami Sascha Rosylight 2023-03-25 08:13:30 +01:00
parent 3b524f32bf
commit efb5e1d1cc
27 changed files with 1048 additions and 11178 deletions

36
.github/workflows/api.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: API report
on: [push, pull_request]
jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.x
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Build
run: pnpm --filter misskey-js build
- name: Check files
run: ls packages/misskey-js/built
- name: API report
run: pnpm --filter misskey-js api-prod
- name: Show report
if: always()
run: cat packages/misskey-js/temp/misskey-js.api.md

View file

@ -36,6 +36,7 @@ jobs:
- backend - backend
- frontend - frontend
- sw - sw
- misskey-js
steps: steps:
- uses: actions/checkout@v3.3.0 - uses: actions/checkout@v3.3.0
with: with:
@ -61,6 +62,7 @@ jobs:
matrix: matrix:
workspace: workspace:
- backend - backend
- misskey-js
steps: steps:
- uses: actions/checkout@v3.3.0 - uses: actions/checkout@v3.3.0
with: with:

View file

@ -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 # 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 # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Test name: Test (misskey.js)
on: on:
push: push:
@ -16,35 +16,37 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [16.5.0] node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3.3.0
- run: corepack enable
- name: Setup Node.js ${{ matrix.node-version }} - name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v3.6.0
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install dependencies - name: Install dependencies
run: npm ci run: pnpm i --frozen-lockfile
- name: Check pnpm-lock.yaml
run: git diff --exit-code pnpm-lock.yaml
- name: Build - name: Build
run: npm run build run: pnpm --filter misskey-js build
- name: Test - name: Test
run: npm test run: pnpm --filter misskey-js test
env: env:
CI: true CI: true
- name: Upload Coverage - name: Upload Coverage
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/misskey-js/coverage/coverage-final.json

1
.gitignore vendored
View file

@ -55,6 +55,7 @@ api-docs.json
.DS_Store .DS_Store
/files /files
ormconfig.json ormconfig.json
temp
# blender backups # blender backups
*.blend1 *.blend1

View file

@ -23,6 +23,7 @@ COPY --link ["scripts", "./scripts"]
COPY --link ["packages/backend/package.json", "./packages/backend/"] COPY --link ["packages/backend/package.json", "./packages/backend/"]
COPY --link ["packages/frontend/package.json", "./packages/frontend/"] COPY --link ["packages/frontend/package.json", "./packages/frontend/"]
COPY --link ["packages/sw/package.json", "./packages/sw/"] COPY --link ["packages/sw/package.json", "./packages/sw/"]
COPY --link ["packages/misskey-js/package.json", "./packages/misskey-js/"]
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \ RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \
pnpm i --frozen-lockfile --aggregate-output pnpm i --frozen-lockfile --aggregate-output

View file

@ -94,7 +94,7 @@
"jsrsasign": "10.6.1", "jsrsasign": "10.6.1",
"mfm-js": "0.23.3", "mfm-js": "0.23.3",
"mime-types": "2.1.35", "mime-types": "2.1.35",
"misskey-js": "0.0.15", "misskey-js": "../misskey-js",
"ms": "3.0.0-canary.1", "ms": "3.0.0-canary.1",
"nested-property": "4.0.0", "nested-property": "4.0.0",
"node-fetch": "3.3.0", "node-fetch": "3.3.0",

View file

@ -42,7 +42,7 @@
"json5": "2.2.3", "json5": "2.2.3",
"matter-js": "0.19.0", "matter-js": "0.19.0",
"mfm-js": "0.23.3", "mfm-js": "0.23.3",
"misskey-js": "0.0.15", "misskey-js": "../misskey-js",
"photoswipe": "5.3.6", "photoswipe": "5.3.6",
"prismjs": "1.29.0", "prismjs": "1.29.0",
"punycode": "2.3.0", "punycode": "2.3.0",

View file

@ -86,6 +86,11 @@ export default defineConfig(({ command, mode }) => {
__VUE_PROD_DEVTOOLS__: false, __VUE_PROD_DEVTOOLS__: false,
}, },
// https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies
optimizeDeps: {
include: ['misskey-js'],
},
build: { build: {
target: [ target: [
'chrome108', 'chrome108',
@ -110,6 +115,11 @@ export default defineConfig(({ command, mode }) => {
emptyOutDir: false, emptyOutDir: false,
sourcemap: process.env.NODE_ENV === 'development', sourcemap: process.env.NODE_ENV === 'development',
reportCompressedSize: false, reportCompressedSize: false,
// https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies
commonjsOptions: {
include: [/misskey-js/, /node_modules/],
},
}, },
test: { test: {

View file

@ -1,7 +0,0 @@
root = true
[*]
indent_style = tab
indent_size = 2
charset = utf-8
insert_final_newline = true

View file

@ -1,7 +0,0 @@
contact_links:
- name: 👪 Misskey Forum
url: https://forum.misskey.io/
about: Ask questions and share knowledge
- name: 💬 Misskey official Discord
url: https://discord.gg/Wp8gVStHW3
about: Chat freely about Misskey

View file

@ -1,20 +0,0 @@
<!-- お読みください
PRありがとうございます PRを作成する前に、コントリビューションガイドをご確認ください:
https://github.com/misskey-dev/misskey.js/blob/develop/CONTRIBUTING.md
-->
<!-- README
Thank you for your PR! Before creating a PR, please check the contribution guide:
https://github.com/misskey-dev/misskey.js/blob/develop/docs/CONTRIBUTING.en.md
-->
# What
<!-- このPRで何をしたのか どう変わるのか? -->
<!-- What did you do with this PR? How will it change things? -->
# Why
<!-- なぜそうするのか? どういう意図なのか? 何が困っているのか? -->
<!-- Why do you do it? What are your intentions? What is the problem? -->
# Additional info (optional)
<!-- テスト観点など -->
<!-- Test perspective, etc -->

View file

@ -1,40 +0,0 @@
name: API report
on: [push, pull_request]
jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16.5.0
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Check files
run: ls built
- name: API report
run: npm run api-prod
- name: Show report
if: always()
run: cat temp/misskey-js.api.md

View file

@ -1,30 +0,0 @@
name: Lint
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16.5.0
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint

View file

@ -1,108 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# App
temp
built

View file

@ -1,29 +0,0 @@
# 0.0.14
- remove needless Object.freeze()
# 0.0.13
- expose ChannelConnection and Channels types
# 0.0.12
- fix a bug that cannot connect to streaming
# 0.0.11
- update user type
- add missing main stream types
# 0.0.10
- add consts
# 0.0.9
- add list of api permission
- Update Note type
# 0.0.8
- add type definition for `messagingMessage` event to main stream channel
- Update Note type
# 0.0.7
- Notificationsの型を修正
- MessagingMessageの型を修正
- UserLiteの型を修正
- apiでネイティブfetchを格納する際に無名関数でラップするように

View file

@ -1,128 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
syuilotan@yahoo.co.jp.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View file

@ -1,2 +0,0 @@
codecov:
token: d55e1270-f20a-4727-aa05-2bd57793315a

View file

@ -12,7 +12,7 @@ export type Acct = {
host: string | null; host: string | null;
}; };
// Warning: (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "TODO_2" needs to be exported by the entry point index.d.ts
// //
// @public (undocumented) // @public (undocumented)
type Ad = TODO_2; type Ad = TODO_2;
@ -2247,17 +2247,17 @@ type FollowRequest = {
// @public (undocumented) // @public (undocumented)
type GalleryPost = { type GalleryPost = {
id: ID; id: ID;
createdAt: DateString; createdAt: DateString;
updatedAt: DateString; updatedAt: DateString;
userId: User['id']; userId: User['id'];
user: User; user: User;
title: string; title: string;
description: string | null; description: string | null;
fileIds: DriveFile['id'][]; fileIds: DriveFile['id'][];
files: DriveFile[]; files: DriveFile[];
isSensitive: boolean; isSensitive: boolean;
likedCount: number; likedCount: number;
isLiked?: boolean; isLiked?: boolean;
}; };
// @public (undocumented) // @public (undocumented)

File diff suppressed because it is too large Load diff

View file

@ -5,14 +5,16 @@
"main": "./built/index.js", "main": "./built/index.js",
"types": "./built/index.d.ts", "types": "./built/index.d.ts",
"scripts": { "scripts": {
"build": "npm run tsc", "build": "tsc",
"tsc": "tsc", "tsc": "tsc",
"tsd": "tsd", "tsd": "tsd",
"api": "npx api-extractor run --local --verbose", "api": "pnpm api-extractor run --local --verbose",
"api-prod": "npx api-extractor run --verbose", "api-prod": "pnpm api-extractor run --verbose",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"jest": "jest --coverage --detectOpenHandles", "jest": "jest --coverage --detectOpenHandles",
"test": "npm run jest && npm run tsd" "test": "pnpm jest && pnpm tsd",
"eslint": "pnpm lint",
"typecheck": "tsc --noEmit"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -20,16 +22,16 @@
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "^7.19.3", "@microsoft/api-extractor": "^7.19.3",
"@types/jest": "^27.4.0", "@types/jest": "^29.5.0",
"@types/node": "17.0.5", "@types/node": "18.15.0",
"@typescript-eslint/eslint-plugin": "5.8.1", "@typescript-eslint/eslint-plugin": "5.8.1",
"@typescript-eslint/parser": "5.8.1", "@typescript-eslint/parser": "5.8.1",
"eslint": "8.6.0", "eslint": "8.6.0",
"jest": "^27.4.5", "jest": "^29.5.0",
"jest-fetch-mock": "^3.0.3", "jest-fetch-mock": "^3.0.3",
"jest-websocket-mock": "^2.2.1", "jest-websocket-mock": "^2.2.1",
"mock-socket": "^9.0.8", "mock-socket": "^9.0.8",
"ts-jest": "^27.1.2", "ts-jest": "^29.0.5",
"ts-node": "10.4.0", "ts-node": "10.4.0",
"tsd": "^0.19.1", "tsd": "^0.19.1",
"typescript": "4.5.4" "typescript": "4.5.4"

View file

@ -1,4 +1,4 @@
import { Endpoints } from './api.types'; import type { Endpoints } from './api.types';
const MK_API_ERROR = Symbol(); const MK_API_ERROR = Symbol();
@ -83,7 +83,7 @@ export class APIClient {
cache: 'no-cache', cache: 'no-cache',
}).then(async (res) => { }).then(async (res) => {
const body = res.status === 204 ? null : await res.json(); const body = res.status === 204 ? null : await res.json();
if (res.status === 200) { if (res.status === 200) {
resolve(body); resolve(body);
} else if (res.status === 204) { } else if (res.status === 204) {
@ -96,7 +96,7 @@ export class APIClient {
} }
}).catch(reject); }).catch(reject);
}); });
return promise as any; return promise as any;
} }
} }

View file

@ -1,5 +1,5 @@
import { import type {
Ad, Announcement, Antenna, App, AuthSession, Blocking, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance, InstanceMetadata, Ad, Announcement, Antenna, App, AuthSession, Blocking, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance,
LiteInstanceMetadata, LiteInstanceMetadata,
MeDetailed, MeDetailed,
Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage, Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage,

View file

@ -1,7 +1,7 @@
import autobind from 'autobind-decorator'; import autobind from 'autobind-decorator';
import { EventEmitter } from 'eventemitter3'; import { EventEmitter } from 'eventemitter3';
import ReconnectingWebsocket from 'reconnecting-websocket'; import ReconnectingWebsocket from 'reconnecting-websocket';
import { BroadcastEvents, Channels } from './streaming.types'; import type { BroadcastEvents, Channels } from './streaming.types';
export function urlQuery(obj: Record<string, string | number | boolean | undefined>): string { export function urlQuery(obj: Record<string, string | number | boolean | undefined>): string {
const params = Object.entries(obj) const params = Object.entries(obj)
@ -40,7 +40,7 @@ export default class Stream extends EventEmitter<StreamEvents> {
const query = urlQuery({ const query = urlQuery({
i: user?.token, i: user?.token,
// To prevent cache of an HTML such as error screen // To prevent cache of an HTML such as error screen
_t: Date.now(), _t: Date.now(),
}); });

View file

@ -1,4 +1,4 @@
import { Antenna, CustomEmoji, DriveFile, MeDetailed, MessagingMessage, Note, Notification, PageEvent, User, UserGroup } from './entities'; import type { Antenna, CustomEmoji, DriveFile, MeDetailed, MessagingMessage, Note, Notification, PageEvent, User, UserGroup } from './entities';
type FIXME = any; type FIXME = any;

View file

@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"esbuild": "0.14.42", "esbuild": "0.14.42",
"idb-keyval": "6.2.0", "idb-keyval": "6.2.0",
"misskey-js": "0.0.15" "misskey-js": "../misskey-js"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/parser": "5.52.0", "@typescript-eslint/parser": "5.52.0",

File diff suppressed because it is too large Load diff

View file

@ -2,3 +2,4 @@ packages:
- 'packages/backend' - 'packages/backend'
- 'packages/frontend' - 'packages/frontend'
- 'packages/sw' - 'packages/sw'
- 'packages/misskey-js'