From ef99b02b180c11684b269885de5ba062cf138429 Mon Sep 17 00:00:00 2001 From: alex8088 <244096523@qq.com> Date: Thu, 17 Mar 2022 16:21:02 +0800 Subject: [PATCH] chore: init --- .editorconfig | 9 + .eslintignore | 2 + .eslintrc.js | 38 + .github/ISSUE_TEMPLATE/bug_report.yml | 51 + .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.yml | 46 + .github/PULL_REQUEST_TEMPLATE.md | 24 + .github/commit-convention.md | 92 + .github/workflows/release-tag.yml | 24 + .gitignore | 4 + .prettierignore | 2 + .prettierrc.yaml | 5 + .vscode/extensions.json | 3 + CHANGELOG.md | 5 + CODE_OF_CONDUCT.md | 45 + CONTRIBUTING.md | 21 + LICENSE | 21 + README.md | 328 ++++ api-extractor.json | 52 + bin/electron-vite.js | 30 + package.json | 79 + pnpm-lock.yaml | 1888 ++++++++++++++++++++ scripts/build.js | 67 + scripts/verifyCommit.js | 22 + src/build.ts | 23 + src/cli.ts | 104 ++ src/config.ts | 340 ++++ src/index.ts | 6 + src/plugin.ts | 350 ++++ src/preview.ts | 27 + src/server.ts | 70 + src/utils.ts | 39 + tsconfig.json | 23 + 33 files changed, 3841 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/commit-convention.md create mode 100644 .github/workflows/release-tag.yml create mode 100644 .gitignore create mode 100644 .prettierignore create mode 100644 .prettierrc.yaml create mode 100644 .vscode/extensions.json create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 api-extractor.json create mode 100644 bin/electron-vite.js create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 scripts/build.js create mode 100644 scripts/verifyCommit.js create mode 100644 src/build.ts create mode 100644 src/cli.ts create mode 100644 src/config.ts create mode 100644 src/index.ts create mode 100644 src/plugin.ts create mode 100644 src/preview.ts create mode 100644 src/server.ts create mode 100644 src/utils.ts create mode 100644 tsconfig.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..cf640d5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f06235c --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules +dist diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..bf41030 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,38 @@ +module.exports = { + root: true, + env: { + commonjs: true, + es6: true, + node: true + }, + parser: '@typescript-eslint/parser', + parserOptions: { + sourceType: 'module', + ecmaVersion: 2021 + }, + plugins: ['@typescript-eslint'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:prettier/recommended' + ], + rules: { + 'no-empty': ['warn', { allowEmptyCatch: true }], + '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }], + '@typescript-eslint/explicit-function-return-type': 'error', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }], + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-var-requires': 'off' + }, + overrides: [ + { + files: ['*.js'], + rules: { + '@typescript-eslint/explicit-function-return-type': 'off' + } + } + ] +} diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..ee4df78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,51 @@ +name: "\U0001F41E Bug Report" +description: Report an issue with electron-vite +labels: ['bug', 'triage'] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: bug-description + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks! + placeholder: Bug description + validations: + required: true + - type: input + id: electron-vite-version + attributes: + label: Electron-Vite Version + description: What version of Electron-Vite are you using? + validations: + required: true + - type: input + id: electron-version + attributes: + label: Electron Version + description: What version of Electron are you using? + validations: + required: true + - type: input + id: vite-version + attributes: + label: Vite Version + description: What version of Vite are you using? + validations: + required: true + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Follow the [Code of Conduct](https://github.com/alex8088/electron-vite/blob/master/CODE_OF_CONDUCT.md). + required: true + - label: Read the [Contributing Guidelines](https://github.com/alex8088/electron-vite/blob/master/CONTRIBUTING.md). + required: true + - label: Read the [docs](https://github.com/alex8088/electron-vite#readme). + required: true + - label: Check that there isn't [already an issue](https://github.com/alex8088/electron-vite/issues) that reports the same bug to avoid creating a duplicate. + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..d91dcd4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,46 @@ +name: "\U0001F680 New Feature Proposal" +description: Propose a new feature to be added to electron-vite +labels: ['enhancement'] +body: + - type: markdown + attributes: + value: | + Thanks for your interest in the project and taking the time to fill out this feature report! + - type: textarea + id: feature-description + attributes: + label: Clear and concise description of the problem + description: 'As a developer using Vite I want [goal / wish] so that [benefit]. If you intend to submit a PR for this issue, tell us in the description. Thanks!' + validations: + required: true + - type: textarea + id: suggested-solution + attributes: + label: Suggested solution + description: 'In module [xy] we could provide following implementation...' + validations: + required: true + - type: textarea + id: alternative + attributes: + label: Alternative + description: Clear and concise description of any alternative solutions or features you've considered. + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Any other context or screenshots about the feature request here. + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Follow the [Code of Conduct](https://github.com/alex8088/electron-vite/blob/master/CODE_OF_CONDUCT.md). + required: true + - label: Read the [Contributing Guidelines](https://github.com/alex8088/electron-vite/blob/master/CONTRIBUTING.md). + required: true + - label: Read the [docs](https://github.com/alex8088/electron-vite#readme). + required: true + - label: Check that there isn't [already an issue](https://github.com/alex8088/electron-vite/issues) that reports the same bug to avoid creating a duplicate. + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..855c79f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,24 @@ + + +### Description + + + +### Additional context + + + +--- + +### What is the purpose of this pull request? + +- [ ] Bug fix +- [ ] New Feature +- [ ] Documentation update +- [ ] Other + +### Before submitting the PR, please make sure you do the following + +- [ ] Read the [Contributing Guidelines](https://github.com/alex8088/electron-vite/blob/master/CONTRIBUTING.md). +- [ ] Read the [Pull Request Guidelines](https://github.com/alex8088/electron-vite/blob/master/CONTRIBUTING.md#pull-request) and follow the [Commit Convention](https://github.com/alex8088/electron-vite/blob/master/.github/commit-convention.md). +- [ ] Provide a description in this PR that addresses **what** the PR is solving, or reference the issue that it solves (e.g. `fixes #123`). diff --git a/.github/commit-convention.md b/.github/commit-convention.md new file mode 100644 index 0000000..baa4474 --- /dev/null +++ b/.github/commit-convention.md @@ -0,0 +1,92 @@ +## Git Commit Message Convention + +> This is adapted from [Angular's commit convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular). + +#### TL;DR: + +Messages must be matched by the following regex: + + +```js +/^(revert: )?(feat|fix|docs|dx|refactor|perf|test|workflow|build|ci|chore|types|wip|release|deps)(\(.+\))?: .{1,50}/ +``` + +#### Examples + +Appears under "Features" header, `dev` subheader: + +``` +feat(dev): add 'comments' option +``` + +Appears under "Bug Fixes" header, `dev` subheader, with a link to issue #28: + +``` +fix(dev): fix dev error + +close #28 +``` + +Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation: + +``` +perf(build): remove 'foo' option + +BREAKING CHANGE: The 'foo' option has been removed. +``` + +The following commit and commit `667ecc1` do not appear in the changelog if they are under the same release. If not, the revert commit appears under the "Reverts" header. + +``` +revert: feat(compiler): add 'comments' option + +This reverts commit 667ecc1654a317a13331b17617d973392f415f02. +``` + +### Full Message Format + +A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**: + +``` +(): + + + +