1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-01 07:35:57 +09:00
cherrypick/CONTRIBUTING.md

279 lines
12 KiB
Markdown
Raw Normal View History

2017-03-31 01:11:38 +09:00
# Contribution guide
2021-09-20 23:24:07 +09:00
We're glad you're interested in contributing Misskey! In this document you will find the information you need to contribute to the project.
2017-03-26 21:32:19 +09:00
2022-05-22 14:49:53 +09:00
> **Note**
> This project uses Japanese as its major language, **but you do not need to translate and write the Issues/PRs in Japanese.**
> Also, you might receive comments on your Issue/PR in Japanese, but you do not need to reply to them in Japanese as well.\
> The accuracy of machine translation into Japanese is not high, so it will be easier for us to understand if you write it in the original language.
> It will also allow the reader to use the translation tool of their preference if necessary.
2021-08-28 15:42:27 +09:00
2022-03-27 20:11:43 +09:00
## Roadmap
See [ROADMAP.md](./ROADMAP.md)
2018-09-01 18:02:04 +09:00
## Issues
2021-09-20 23:24:07 +09:00
Before creating an issue, please check the following:
- To avoid duplication, please search for similar issues before creating a new issue.
2021-10-17 05:21:36 +09:00
- Do not use Issues to ask questions or troubleshooting.
- Issues should only be used to feature requests, suggestions, and bug tracking.
- Please ask questions or troubleshooting in the [Misskey Forum](https://forum.misskey.io/) or [Discord](https://discord.gg/Wp8gVStHW3).
2022-05-22 14:49:53 +09:00
> **Warning**
> Do not close issues that are about to be resolved. It should remain open until a commit that actually resolves it is merged.
2021-09-20 23:24:07 +09:00
## Before implementation
2021-09-20 23:26:43 +09:00
When you want to add a feature or fix a bug, **first have the design and policy reviewed in an Issue** (if it is not there, please make one). Without this step, there is a high possibility that the PR will not be merged even if it is implemented.
2021-09-20 23:24:07 +09:00
2022-02-06 21:50:31 +09:00
At this point, you also need to clarify the goals of the PR you will create, and make sure that the other members of the team are aware of them.
2022-02-06 21:49:04 +09:00
PRs that do not have a clear set of do's and don'ts tend to be bloated and difficult to review.
2021-09-20 23:24:07 +09:00
Also, when you start implementation, assign yourself to the Issue (if you cannot do it yourself, ask another member to assign you). By expressing your intention to work the Issue, you can prevent conflicts in the work.
## Well-known branches
2021-08-30 20:11:22 +09:00
- **`master`** branch is tracking the latest release and used for production purposes.
- **`develop`** branch is where we work for the next release.
2021-09-20 23:24:07 +09:00
- When you create a PR, basically target it to this branch.
2021-08-30 20:11:22 +09:00
- **`l10n_develop`** branch is reserved for localization management.
2019-07-22 14:57:23 +09:00
2021-09-20 23:24:07 +09:00
## Creating a PR
Thank you for your PR! Before creating a PR, please check the following:
- If possible, prefix the title with a keyword that identifies the type of this PR, as shown below.
- `fix` / `refactor` / `feat` / `enhance` / `perf` / `chore` etc
- Also, make sure that the granularity of this PR is appropriate. Please do not include more than one type of change or interest in a single PR.
- If there is an Issue which will be resolved by this PR, please include a reference to the Issue in the text.
- Please add the summary of the changes to [`CHANGELOG.md`](/CHANGELOG.md). However, this is not necessary for changes that do not affect the users, such as refactoring.
- Check if there are any documents that need to be created or updated due to this change.
- If you have added a feature or fixed a bug, please add a test case if possible.
- Please make sure that tests and Lint are passed in advance.
refactor: migrate to Yarn Berry (v3.2.1) (#8764) * Yarn berry * Add `.yarn` to dockerignore * Mention in CHANGELOG * Update Dockerfile * Proper upgrade to yarn * use `"packageManager"` * Replace `install-packages.js` with workspaces * Replace `install-packages.js` with workspaces * Typo * `corepack enable` for linting * Remove `packages/*/yarn.lock` * Improve lint workflow * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Add `eslint` * Regenerate yarn.lock * 🙏‍ * Update lint.yml :thinking: * Fix workflow! * yarn lint my beloved * corepack enable for mocha/e2e * Update CHANGELOG.md * fix the code that depends on node_modules * tbh * tbh * More yarn workspaces stuff * 🍀 * Change `browser-image-resizer` * :finnadie: * :goberserk: * :godmode: * Remove yarnrc for workspaces * 🙏 * Add proper packages for eslint * Skip extra install * New steps for test.yml too * uhh * Update .dockerignore * Update lint.yml * Update test.yml * Make client/backend lints seperate workflows * package.json names * pnpm = dont change paths * Fix changelog * :bowtie: * I don't know why github workflows hates me... * test * ????? * continue-on-error: true * Fix yarn.lock Co-authored-by: ishowta <ishowta@gmail.com> * add @rollup/pluginutils * add packageExtensions for chartjs_date-fns Co-authored-by: acid-chicken <root@acid-chicken.com> * npm run => yarn * wip * yarn node => node 依存関係の記載不足の解消がかなり多いため、yarn nodeは使わない * fix * fix http-signature * fix * fix * add packageExtensions * :v: * remove `yarn set version berry` * yarn install --immutable Co-authored-by: ishowta <ishowta@gmail.com> * https://github.com/misskey-dev/misskey/pull/8764#discussion_r885749892 * enable actions/setup-node's global cache * Update .gitignore Co-authored-by: iwata <ishowta@gmail.com> * revival gulp build https://github.com/misskey-dev/misskey/pull/8764/files/66ab7591bff9b35255219057e33399a06260aa31#r885899944 * fix lockfile * Update packages/backend/package.json Co-authored-by: iwata <ishowta@gmail.com> * remove packagemanager * `yarn run gulp` in `build` instead of just `gulp` * Update CHANGELOG.md * update lockfile * Add .yarn/cache to gitignore for packages * ? * move resolutions * :v: * update lockfie * update-lockfile * update yarn.lock * fix build * fix * fix * fix: add @tensorflow/tfjs * ダメ * modify lockfile * use yarnrc * update yarnlock * add jest-mock * update-lockfile * update lockfile * update lockfile * move jest-mock, update lockfile Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: ishowta <ishowta@gmail.com>
2022-11-24 15:39:00 +09:00
- You can run it with `yarn test` and `yarn lint`. [See more info](#testing)
2021-09-20 23:24:07 +09:00
- If this PR includes UI changes, please attach a screenshot in the text.
Thanks for your cooperation 🤗
2022-02-06 21:58:14 +09:00
## Reviewers guide
2022-02-06 22:03:19 +09:00
Be willing to comment on the good points and not just the things you want fixed 💯
2022-02-06 21:58:14 +09:00
### Review perspective
- Scope
- Are the goals of the PR clear?
- Is the granularity of the PR appropriate?
- Security
- Does merging this PR create a vulnerability?
- Performance
- Will merging this PR cause unexpected performance degradation?
- Is there a more efficient way?
- Testing
- Does the test ensure the expected behavior?
- Are there any omissions or gaps?
- Does it check for anomalies?
2022-06-09 05:55:58 +09:00
## Deploy
The `/deploy` command by issue comment can be used to deploy the contents of a PR to the preview environment.
```
/deploy sha=<commit hash>
```
An actual domain will be assigned so you can test the federation.
2022-05-05 18:33:24 +09:00
## Merge
## Release
### Release Instructions
2022-06-04 16:01:11 +09:00
1. Commit version changes in the `develop` branch ([package.json](https://github.com/misskey-dev/misskey/blob/develop/package.json))
2. Create a release PR.
- Into `master` from `develop` branch.
- The title must be in the format `Release: x.y.z`.
- `x.y.z` is the new version you are trying to release.
2022-06-09 05:55:58 +09:00
3. Deploy and perform a simple QA check. Also verify that the tests passed.
2022-06-08 22:23:43 +09:00
4. Merge it.
5. Create a [release of GitHub](https://github.com/misskey-dev/misskey/releases)
2022-06-04 16:01:27 +09:00
- The target branch must be `master`
- The tag name must be the version
2022-05-05 18:33:24 +09:00
2018-09-01 18:02:04 +09:00
## Localization (l10n)
Misskey uses [Crowdin](https://crowdin.com/project/misskey) for localization management.
You can improve our translations with your Crowdin account.
2019-07-22 14:57:23 +09:00
Your changes in Crowdin are automatically submitted as a PR (with the title "New Crowdin translations") to the repository.
The owner [@syuilo](https://github.com/syuilo) merges the PR into the develop branch before the next release.
2019-07-22 14:57:23 +09:00
If your language is not listed in Crowdin, please open an issue.
2017-03-26 21:32:19 +09:00
2018-09-01 18:15:25 +09:00
![Crowdin](https://d322cqt584bo4o.cloudfront.net/misskey/localized.svg)
2017-03-26 21:32:19 +09:00
2021-11-19 14:57:07 +09:00
## Development
refactor: migrate to Yarn Berry (v3.2.1) (#8764) * Yarn berry * Add `.yarn` to dockerignore * Mention in CHANGELOG * Update Dockerfile * Proper upgrade to yarn * use `"packageManager"` * Replace `install-packages.js` with workspaces * Replace `install-packages.js` with workspaces * Typo * `corepack enable` for linting * Remove `packages/*/yarn.lock` * Improve lint workflow * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Add `eslint` * Regenerate yarn.lock * 🙏‍ * Update lint.yml :thinking: * Fix workflow! * yarn lint my beloved * corepack enable for mocha/e2e * Update CHANGELOG.md * fix the code that depends on node_modules * tbh * tbh * More yarn workspaces stuff * 🍀 * Change `browser-image-resizer` * :finnadie: * :goberserk: * :godmode: * Remove yarnrc for workspaces * 🙏 * Add proper packages for eslint * Skip extra install * New steps for test.yml too * uhh * Update .dockerignore * Update lint.yml * Update test.yml * Make client/backend lints seperate workflows * package.json names * pnpm = dont change paths * Fix changelog * :bowtie: * I don't know why github workflows hates me... * test * ????? * continue-on-error: true * Fix yarn.lock Co-authored-by: ishowta <ishowta@gmail.com> * add @rollup/pluginutils * add packageExtensions for chartjs_date-fns Co-authored-by: acid-chicken <root@acid-chicken.com> * npm run => yarn * wip * yarn node => node 依存関係の記載不足の解消がかなり多いため、yarn nodeは使わない * fix * fix http-signature * fix * fix * add packageExtensions * :v: * remove `yarn set version berry` * yarn install --immutable Co-authored-by: ishowta <ishowta@gmail.com> * https://github.com/misskey-dev/misskey/pull/8764#discussion_r885749892 * enable actions/setup-node's global cache * Update .gitignore Co-authored-by: iwata <ishowta@gmail.com> * revival gulp build https://github.com/misskey-dev/misskey/pull/8764/files/66ab7591bff9b35255219057e33399a06260aa31#r885899944 * fix lockfile * Update packages/backend/package.json Co-authored-by: iwata <ishowta@gmail.com> * remove packagemanager * `yarn run gulp` in `build` instead of just `gulp` * Update CHANGELOG.md * update lockfile * Add .yarn/cache to gitignore for packages * ? * move resolutions * :v: * update lockfie * update-lockfile * update yarn.lock * fix build * fix * fix * fix: add @tensorflow/tfjs * ダメ * modify lockfile * use yarnrc * update yarnlock * add jest-mock * update-lockfile * update lockfile * update lockfile * move jest-mock, update lockfile Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: ishowta <ishowta@gmail.com>
2022-11-24 15:39:00 +09:00
During development, it is useful to use the `yarn dev` command.
2021-11-19 14:57:07 +09:00
This command monitors the server-side and client-side source files and automatically builds them if they are modified.
In addition, it will also automatically start the Misskey server process.
2021-08-30 20:11:22 +09:00
## Testing
- Test codes are located in [`/test`](/test).
2018-09-01 18:02:04 +09:00
2021-08-30 20:11:22 +09:00
### Run test
Create a config file.
```
cp test/test.yml .config/
```
Prepare DB/Redis for testing.
```
docker-compose -f test/docker-compose.yml up
```
Alternatively, prepare an empty (data can be erased) DB and edit `.config/test.yml`.
Run all test.
2021-08-30 20:11:22 +09:00
```
refactor: migrate to Yarn Berry (v3.2.1) (#8764) * Yarn berry * Add `.yarn` to dockerignore * Mention in CHANGELOG * Update Dockerfile * Proper upgrade to yarn * use `"packageManager"` * Replace `install-packages.js` with workspaces * Replace `install-packages.js` with workspaces * Typo * `corepack enable` for linting * Remove `packages/*/yarn.lock` * Improve lint workflow * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Add `eslint` * Regenerate yarn.lock * 🙏‍ * Update lint.yml :thinking: * Fix workflow! * yarn lint my beloved * corepack enable for mocha/e2e * Update CHANGELOG.md * fix the code that depends on node_modules * tbh * tbh * More yarn workspaces stuff * 🍀 * Change `browser-image-resizer` * :finnadie: * :goberserk: * :godmode: * Remove yarnrc for workspaces * 🙏 * Add proper packages for eslint * Skip extra install * New steps for test.yml too * uhh * Update .dockerignore * Update lint.yml * Update test.yml * Make client/backend lints seperate workflows * package.json names * pnpm = dont change paths * Fix changelog * :bowtie: * I don't know why github workflows hates me... * test * ????? * continue-on-error: true * Fix yarn.lock Co-authored-by: ishowta <ishowta@gmail.com> * add @rollup/pluginutils * add packageExtensions for chartjs_date-fns Co-authored-by: acid-chicken <root@acid-chicken.com> * npm run => yarn * wip * yarn node => node 依存関係の記載不足の解消がかなり多いため、yarn nodeは使わない * fix * fix http-signature * fix * fix * add packageExtensions * :v: * remove `yarn set version berry` * yarn install --immutable Co-authored-by: ishowta <ishowta@gmail.com> * https://github.com/misskey-dev/misskey/pull/8764#discussion_r885749892 * enable actions/setup-node's global cache * Update .gitignore Co-authored-by: iwata <ishowta@gmail.com> * revival gulp build https://github.com/misskey-dev/misskey/pull/8764/files/66ab7591bff9b35255219057e33399a06260aa31#r885899944 * fix lockfile * Update packages/backend/package.json Co-authored-by: iwata <ishowta@gmail.com> * remove packagemanager * `yarn run gulp` in `build` instead of just `gulp` * Update CHANGELOG.md * update lockfile * Add .yarn/cache to gitignore for packages * ? * move resolutions * :v: * update lockfie * update-lockfile * update yarn.lock * fix build * fix * fix * fix: add @tensorflow/tfjs * ダメ * modify lockfile * use yarnrc * update yarnlock * add jest-mock * update-lockfile * update lockfile * update lockfile * move jest-mock, update lockfile Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: ishowta <ishowta@gmail.com>
2022-11-24 15:39:00 +09:00
yarn test
2021-08-30 20:11:22 +09:00
```
#### Run specify test
2021-08-19 11:26:26 +09:00
```
refactor: migrate to Yarn Berry (v3.2.1) (#8764) * Yarn berry * Add `.yarn` to dockerignore * Mention in CHANGELOG * Update Dockerfile * Proper upgrade to yarn * use `"packageManager"` * Replace `install-packages.js` with workspaces * Replace `install-packages.js` with workspaces * Typo * `corepack enable` for linting * Remove `packages/*/yarn.lock` * Improve lint workflow * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Add `eslint` * Regenerate yarn.lock * 🙏‍ * Update lint.yml :thinking: * Fix workflow! * yarn lint my beloved * corepack enable for mocha/e2e * Update CHANGELOG.md * fix the code that depends on node_modules * tbh * tbh * More yarn workspaces stuff * 🍀 * Change `browser-image-resizer` * :finnadie: * :goberserk: * :godmode: * Remove yarnrc for workspaces * 🙏 * Add proper packages for eslint * Skip extra install * New steps for test.yml too * uhh * Update .dockerignore * Update lint.yml * Update test.yml * Make client/backend lints seperate workflows * package.json names * pnpm = dont change paths * Fix changelog * :bowtie: * I don't know why github workflows hates me... * test * ????? * continue-on-error: true * Fix yarn.lock Co-authored-by: ishowta <ishowta@gmail.com> * add @rollup/pluginutils * add packageExtensions for chartjs_date-fns Co-authored-by: acid-chicken <root@acid-chicken.com> * npm run => yarn * wip * yarn node => node 依存関係の記載不足の解消がかなり多いため、yarn nodeは使わない * fix * fix http-signature * fix * fix * add packageExtensions * :v: * remove `yarn set version berry` * yarn install --immutable Co-authored-by: ishowta <ishowta@gmail.com> * https://github.com/misskey-dev/misskey/pull/8764#discussion_r885749892 * enable actions/setup-node's global cache * Update .gitignore Co-authored-by: iwata <ishowta@gmail.com> * revival gulp build https://github.com/misskey-dev/misskey/pull/8764/files/66ab7591bff9b35255219057e33399a06260aa31#r885899944 * fix lockfile * Update packages/backend/package.json Co-authored-by: iwata <ishowta@gmail.com> * remove packagemanager * `yarn run gulp` in `build` instead of just `gulp` * Update CHANGELOG.md * update lockfile * Add .yarn/cache to gitignore for packages * ? * move resolutions * :v: * update lockfie * update-lockfile * update yarn.lock * fix build * fix * fix * fix: add @tensorflow/tfjs * ダメ * modify lockfile * use yarnrc * update yarnlock * add jest-mock * update-lockfile * update lockfile * update lockfile * move jest-mock, update lockfile Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: ishowta <ishowta@gmail.com>
2022-11-24 15:39:00 +09:00
yarn jest -- foo.ts
2021-08-19 11:26:26 +09:00
```
2021-08-30 20:11:22 +09:00
### e2e tests
TODO
2018-09-01 18:02:04 +09:00
## Continuous integration
2021-06-11 12:19:48 +09:00
Misskey uses GitHub Actions for executing automated tests.
Configuration files are located in [`/.github/workflows`](/.github/workflows).
2018-12-20 03:01:02 +09:00
2021-12-10 20:42:01 +09:00
## Vue
Misskey uses Vue(v3) as its front-end framework.
2022-01-26 03:27:19 +09:00
- Use TypeScript.
- **When creating a new component, please use the Composition API (with [setup sugar](https://v3.vuejs.org/api/sfc-script-setup.html) and [ref sugar](https://github.com/vuejs/rfcs/discussions/369)) instead of the Options API.**
- Some of the existing components are implemented in the Options API, but it is an old implementation. Refactors that migrate those components to the Composition API are also welcome.
2021-12-10 20:42:01 +09:00
2022-07-22 00:35:30 +09:00
## nirax
niraxは、Misskeyで使用しているオリジナルのフロントエンドルーティングシステムです。
**vue-routerから影響を多大に受けているので、まずはvue-routerについて学ぶことをお勧めします。**
### ルート定義
ルート定義は、以下の形式のオブジェクトの配列です。
``` ts
{
name?: string;
path: string;
component: Component;
query?: Record<string, string>;
loginRequired?: boolean;
hash?: string;
globalCacheKey?: string;
children?: RouteDef[];
}
```
> **Warning**
> 現状、ルートは定義された順に評価されます。
> たとえば、`/foo/:id`ルート定義の次に`/foo/bar`ルート定義がされていた場合、後者がマッチすることはありません。
### 複数のルーター
vue-routerとの最大の違いは、niraxは複数のルーターが存在することを許可している点です。
これにより、アプリ内ウィンドウでブラウザとは個別にルーティングすることなどが可能になります。
## Notes
2019-07-15 20:47:09 +09:00
### How to resolve conflictions occurred at yarn.lock?
Just execute `yarn` to fix it.
2019-07-14 10:05:19 +09:00
2022-01-26 00:52:34 +09:00
### INSERTするときにはsaveではなくinsertを使用する
#6441
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 21:50:36 +09:00
### placeholder
SQLをクエリビルダで組み立てる際、使用するプレースホルダは重複してはならない
例えば
``` ts
query.andWhere(new Brackets(qb => {
for (const type of ps.fileType) {
qb.orWhere(`:type = ANY(note.attachedFileTypes)`, { type: type });
}
}));
```
と書くと、ループ中で`type`というプレースホルダが複数回使われてしまいおかしくなる
だから次のようにする必要がある
```ts
query.andWhere(new Brackets(qb => {
for (const type of ps.fileType) {
const i = ps.fileType.indexOf(type);
qb.orWhere(`:type${i} = ANY(note.attachedFileTypes)`, { [`type${i}`]: type });
}
}));
```
2019-05-20 21:44:16 +09:00
### Not `null` in TypeORM
```ts
const foo = await Foos.findOne({
bar: Not(null)
});
```
のようなクエリ(`bar`が`null`ではない)は期待通りに動作しない。
次のようにします:
```ts
const foo = await Foos.findOne({
bar: Not(IsNull())
});
```
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 21:50:36 +09:00
### `null` in SQL
SQLを発行する際、パラメータが`null`になる可能性のある場合はSQL文を出し分けなければならない
例えば
``` ts
query.where('file.folderId = :folderId', { folderId: ps.folderId });
```
という処理で、`ps.folderId`が`null`だと結果的に`file.folderId = null`のようなクエリが発行されてしまい、これは正しいSQLではないので期待した結果が得られない
だから次のようにする必要がある
``` ts
if (ps.folderId) {
query.where('file.folderId = :folderId', { folderId: ps.folderId });
} else {
query.where('file.folderId IS NULL');
}
```
### `[]` in SQL
SQLを発行する際、`IN`のパラメータが`[]`(空の配列)になる可能性のある場合はSQL文を出し分けなければならない
例えば
``` ts
const users = await Users.find({
id: In(userIds)
});
```
という処理で、`userIds`が`[]`だと結果的に`user.id IN ()`のようなクエリが発行されてしまい、これは正しいSQLではないので期待した結果が得られない
だから次のようにする必要がある
``` ts
const users = userIds.length > 0 ? await Users.find({
id: In(userIds)
}) : [];
```
2019-04-13 14:04:29 +09:00
### 配列のインデックス in SQL
SQLでは配列のインデックスは**1始まり**。
`[a, b, c]``a`にアクセスしたいなら`[0]`ではなく`[1]`と書く
### null IN
nullが含まれる可能性のあるカラムにINするときは、そのままだとおかしくなるのでORなどでnullのハンドリングをしよう。
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 21:50:36 +09:00
### `undefined`にご用心
MongoDBの時とは違い、findOneでレコードを取得する時に対象レコードが存在しない場合 **`undefined`** が返ってくるので注意。
MongoDBは`null`で返してきてたので、その感覚で`if (x === null)`とか書くとバグる。代わりに`if (x == null)`と書いてください
2019-04-13 14:31:05 +09:00
### Migration作成方法
packages/backendで:
```sh
refactor: migrate to Yarn Berry (v3.2.1) (#8764) * Yarn berry * Add `.yarn` to dockerignore * Mention in CHANGELOG * Update Dockerfile * Proper upgrade to yarn * use `"packageManager"` * Replace `install-packages.js` with workspaces * Replace `install-packages.js` with workspaces * Typo * `corepack enable` for linting * Remove `packages/*/yarn.lock` * Improve lint workflow * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update .github/workflows/lint.yml Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Add `eslint` * Regenerate yarn.lock * 🙏‍ * Update lint.yml :thinking: * Fix workflow! * yarn lint my beloved * corepack enable for mocha/e2e * Update CHANGELOG.md * fix the code that depends on node_modules * tbh * tbh * More yarn workspaces stuff * 🍀 * Change `browser-image-resizer` * :finnadie: * :goberserk: * :godmode: * Remove yarnrc for workspaces * 🙏 * Add proper packages for eslint * Skip extra install * New steps for test.yml too * uhh * Update .dockerignore * Update lint.yml * Update test.yml * Make client/backend lints seperate workflows * package.json names * pnpm = dont change paths * Fix changelog * :bowtie: * I don't know why github workflows hates me... * test * ????? * continue-on-error: true * Fix yarn.lock Co-authored-by: ishowta <ishowta@gmail.com> * add @rollup/pluginutils * add packageExtensions for chartjs_date-fns Co-authored-by: acid-chicken <root@acid-chicken.com> * npm run => yarn * wip * yarn node => node 依存関係の記載不足の解消がかなり多いため、yarn nodeは使わない * fix * fix http-signature * fix * fix * add packageExtensions * :v: * remove `yarn set version berry` * yarn install --immutable Co-authored-by: ishowta <ishowta@gmail.com> * https://github.com/misskey-dev/misskey/pull/8764#discussion_r885749892 * enable actions/setup-node's global cache * Update .gitignore Co-authored-by: iwata <ishowta@gmail.com> * revival gulp build https://github.com/misskey-dev/misskey/pull/8764/files/66ab7591bff9b35255219057e33399a06260aa31#r885899944 * fix lockfile * Update packages/backend/package.json Co-authored-by: iwata <ishowta@gmail.com> * remove packagemanager * `yarn run gulp` in `build` instead of just `gulp` * Update CHANGELOG.md * update lockfile * Add .yarn/cache to gitignore for packages * ? * move resolutions * :v: * update lockfie * update-lockfile * update yarn.lock * fix build * fix * fix * fix: add @tensorflow/tfjs * ダメ * modify lockfile * use yarnrc * update yarnlock * add jest-mock * update-lockfile * update lockfile * update lockfile * move jest-mock, update lockfile Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: ishowta <ishowta@gmail.com>
2022-11-24 15:39:00 +09:00
yarn dlx typeorm migration:generate -d ormconfig.js -o <migration name>
```
- 生成後、ファイルをmigration下に移してください
- 作成されたスクリプトは不必要な変更を含むため除去してください
2019-09-08 21:21:08 +09:00
### コネクションには`markRaw`せよ
**Vueのコンポーネントのdataオプションとして**misskey.jsのコネクションを設定するとき、必ず`markRaw`でラップしてください。インスタンスが不必要にリアクティブ化されることで、misskey.js内の処理で不具合が発生するとともに、パフォーマンス上の問題にも繋がる。なお、Composition APIを使う場合はこの限りではない(リアクティブ化はマニュアルなため)。
### JSONのimportに気を付けよう
TypeScriptでjsonをimportすると、tscでコンパイルするときにそのjsonファイルも一緒にdistディレクトリに吐き出されてしまう。この挙動により、意図せずファイルの書き換えが発生することがあるので、jsonをimportするときは書き換えられても良いものかどうか確認すること。書き換えされて欲しくない場合は、importで読み込むのではなく、`fs.readFileSync`などの関数を使って読み込むようにすればよい。
2021-09-30 00:50:45 +09:00
### コンポーネントのスタイル定義でmarginを持たせない
コンポーネント自身がmarginを設定するのは問題の元となることはよく知られている
marginはそのコンポーネントを使う側が設定する
2019-09-08 21:21:08 +09:00
## その他
### HTMLのクラス名で follow という単語は使わない
広告ブロッカーで誤ってブロックされる