# 開発体制/指針について ###### tags: `Engeneering` # 開発のはじめかた 各言語毎に「スターターテンプレートレポジトリ」を作成しそのテンプレートを使って開発を開始する。 (Typescript server/frontend は別物なので別テンプレートとする。) 基本的に次項以降で指定する大まかなルールに従っていればそれ以外については各々の裁量で決めてOK。 また、基本的にソースコードは全てパブリックで行うが、Wallet(オフチェーンパーのサーバサイドなど)は非公開。 # 開発の進め方 チケット駆動(詳細は @okamu- さんに任せます) # ライセンス 要相談(with @9xRLeRQcTWiSlwWnGiQEsA @serinuntius) zkSync は APACHIE + MIT https://github.com/matter-labs/zksync PUBLIC に関しては **MIT** or **GPL**(コピー防止) PRIVATE に関してはその他コピー禁止系ライセンス # フォーマット ## Rust Rust fmt に従う。 ## Go Go fmt に従う ## Typescript ESLint + Prettier setup の参考 https://zenn.dev/teppeis/articles/2021-02-eslint-prettier-vscode ### .eslintignore ``` *.d.ts *.js coingecko.provider.ts ``` ### .eslintrc.js ```javascript= module.exports = { // プログラムの実行環境をESLintに教える env: { browser: true, es2020: true, jest: true, }, // 共有設定を適用する。共有設定はESLintに標準で含まれているものか別途インストールしたもの、またはインストール済みのプラグインのパッケージに含まれているものを指定する // 共有設定: 複数のルールの適用をまとめて設定するもの extends: [ 'plugin:import/errors', 'plugin:import/warnings', 'plugin:import/typescript', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'plugin:prettier/recommended', 'prettier', 'prettier/@typescript-eslint', 'prettier/standard', ], // ESLintが使用するパーサを指定する parser: '@typescript-eslint/parser', // パーサの各種実行オプションを設定する parserOptions: { ecmaVersion: 2020, project: './tsconfig.eslint.json', sourceType: 'module', tsconfigRootDir: __dirname, }, // 任意のプラグインを読み込む // プラグイン: ESLintの組み込みルール以外に独自のルールを追加するもの // プラグインは読み込んだだけではなんの効力も持たず、extendsかrulesで設定する必要がある plugins: [ '@typescript-eslint', 'import', 'unused-imports', 'prefer-arrow', 'prettier', ], root: true, // 適用する個別のルールと、エラーレベルや例外などその設定値を記述する // 基本的にはextendsで適用した共有設定が読み込まれているので、そのうちのいくつかを個別で無効にしたいときに設定する rules: { 'lines-between-class-members': [ 'error', 'always', { exceptAfterSingleLine: true, }, ], // should be rewritten as `['error', { allowAsStatement: true }]` in ESLint 7 or later // SEE: https://github.com/typescript-eslint/typescript-eslint/issues/1184 'no-void': 'off', 'padding-line-between-statements': [ 'error', { blankLine: 'always', prev: '*', next: 'return', }, ], '@typescript-eslint/no-unused-vars': [ 'error', { 'vars': 'all', 'args': 'after-used', 'argsIgnorePattern': '_|type|of|returns', 'ignoreRestSiblings': false, 'varsIgnorePattern': '_', }, ], 'import/extensions': [ 'error', 'ignorePackages', { js: 'never', ts: 'never', }, ], 'prefer-arrow/prefer-arrow-functions': [ 'error', { disallowPrototype: true, singleReturnOnly: false, classPropertiesAllowed: false, }, ], 'unused-imports/no-unused-imports-ts': 'warn', 'sort-imports': 0, 'import/order': [ 2, { 'alphabetize': { 'order': 'asc' } } ], '@typescript-eslint/no-floating-promises': 0, 'import/no-unresolved': 'off', // TODO }, settings: { 'import/resolver': { node: { paths: ['src'], }, } }, }; ``` ### .prettierc ``` { "bracketSpacing": true, "printWidth": 100, "semi": true, "singleQuote": true, "trailingComma": "all", "useTabs": false } ``` # GitHub Flow(How to contribute) 参考: [GitHub Flow](https://gist.github.com/Gab-km/3705015) GitHub Flow を参考にさらにルールを削ぎ落としました。開発が忙しくなるとだいたいのルールが形骸化すると思っているのでそれでも守れる最低限のルールに留めます。 ### 機能追加、バグ報告 Issueを作成して該当するラベルがあれば付与します。 ### コード修正を行いたい場合 PushしたコードにPull requestを作成し、該当するラベルがあれば付与します。レビュー依頼はAssigneeを追加するか、Discordに投稿する。 ## Branch Rules mainブランチは削除しないよう保護設定します。 リリース時にgithub上でリリースを作成し、タグを付与します。 ### アプリ - **`main` メインブランチ(削除しない)** - `dev` 開発環境用(開発環境のCodePipelineから参照(自動))(削除しない) - `prod` 本番環境用(本番環境のCodePipelineから参照(手動))(タグ付けはここで)(削除しない) - `feat/*` 新規機能の追加 - `fix/*` バグ修正 ```mermaid sequenceDiagram participant main as main participant feat as feat/* participant fix as fix/* participant dev participant prod participant tag as tag:v[0-9\.]+ opt 機能開発 main->>feat: 新機能の開発 feat->>main: PR マージ end opt デプロイ main->>dev: 開発環境デプロイ dev->>prod: 本番環境デプロイ prod->>tag: バージョンでタグを切る prod->>main: バージョン更新を反映 end opt バグ修正 opt 通常のバグ修正 main->>fix: バグ修正 fix->>main: PR マージ end opt 開発環境からバグ修正 dev->>fix: バグ修正 fix->>dev: PR マージ dev->>main: 修正をマージ end end ``` ## ISSUE_TEMPLATE_FEAT ```markdown # Description {write description of what the feature should be} ## Required Tasks - [ ] {task 1} - [ ] {task 2} - [ ] ... ## Expired(Estimating). {When finished this task?} ## Dependencies {Dependencies issue or PR.} ``` ## ISSUE_TEMPLATE_FIX ```markdown --- name: Report a Bug about: Report a problem with this project. title: '' labels: bug assignees: '' --- **Description** > Tell us what happened. In particular, tell us how and why you are using this project, and describe the bug that you encountered. Please note that we are not able to support all conceivable use cases, but the more information you are able to provide the more equipped we will be to help. **Steps to Reproduce** > Replace the example steps below with actual steps to reproduce the bug you're reporting. 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected vs. Actual Behavior** > What did you expect to happen after you followed the steps you described in the last section? What actually happened? **Environment** > Describe the environment in which you encountered this bug. Use the list below as a starting point and add additional information if you think it's relevant. - Operating system: - Project version/tag: - Rust version (run `rustup show`): **Logs, Errors or Screenshots** > Please provide the text of any logs or errors that you experienced; if applicable, provide screenshots to help illustrate the problem. **Additional Information** > Please add any other details that you think may help us solve your problem. ```