Skip to content

Commit

Permalink
Merge pull request #87 from caorushizi/dev/plugins
Browse files Browse the repository at this point in the history
fix: 🐛  types
  • Loading branch information
caorushizi authored Feb 11, 2024
2 parents 1cd7ede + 6316c8e commit 6d0f6e6
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 71 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-env node */
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
overrides: [],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {},
};
2 changes: 1 addition & 1 deletion .hintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
}
]
}
}
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
102 changes: 56 additions & 46 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,101 @@
// eslint-disable-next-line no-undef
module.exports = {
extends: ['@commitlint/config-conventional'], // extends can be nested
parserPreset: 'conventional-changelog-conventionalcommits',
extends: ["@commitlint/config-conventional"], // extends can be nested
parserPreset: "conventional-changelog-conventionalcommits",
prompt: {
settings: {},
messages: {
skip: ':skip',
max: 'upper %d chars',
min: '%d chars at least',
emptyWarning: 'can not be empty',
upperLimitWarning: 'over limit',
lowerLimitWarning: 'below limit'
skip: ":skip",
max: "upper %d chars",
min: "%d chars at least",
emptyWarning: "can not be empty",
upperLimitWarning: "over limit",
lowerLimitWarning: "below limit",
},
types: [
{ value: 'feat', name: 'feat: ✨ A new feature', emoji: '✨ ' },
{ value: 'fix', name: 'fix: 🐛 A bug fix', emoji: '🐛 ' },
{ value: 'docs', name: 'docs: 📝 Documentation only changes', emoji: '📝 ' },
{ value: "feat", name: "feat: ✨ A new feature", emoji: "✨ " },
{ value: "fix", name: "fix: 🐛 A bug fix", emoji: "🐛 " },
{
value: 'style',
name: 'style: 💄 Changes that do not affect the meaning of the code',
emoji: '💄 '
value: "docs",
name: "docs: 📝 Documentation only changes",
emoji: "📝 ",
},
{
value: 'refactor',
name: 'refactor: 📦️ A code change that neither fixes a bug nor adds a feature',
emoji: '📦️ '
value: "style",
name: "style: 💄 Changes that do not affect the meaning of the code",
emoji: "💄 ",
},
{
value: 'perf',
name: 'perf: 🚀 A code change that improves performance',
emoji: '🚀 '
value: "refactor",
name: "refactor: 📦️ A code change that neither fixes a bug nor adds a feature",
emoji: "📦️ ",
},
{
value: 'test',
name: 'test: 🚨 Adding missing tests or correcting existing tests',
emoji: '🚨 '
value: "perf",
name: "perf: 🚀 A code change that improves performance",
emoji: "🚀 ",
},
{
value: 'build',
name: 'build: 🛠 Changes that affect the build system or external dependencies',
emoji: '🛠 '
value: "test",
name: "test: 🚨 Adding missing tests or correcting existing tests",
emoji: "🚨 ",
},
{
value: 'ci',
name: 'ci: 🎡 Changes to our CI configuration files and scripts',
emoji: '🎡 '
value: "build",
name: "build: 🛠 Changes that affect the build system or external dependencies",
emoji: "🛠 ",
},
{
value: 'chore',
value: "ci",
name: "ci: 🎡 Changes to our CI configuration files and scripts",
emoji: "🎡 ",
},
{
value: "chore",
name: "chore: 🔨 Other changes that don't modify src or test files",
emoji: '🔨 '
emoji: "🔨 ",
},
{
value: "revert",
name: "revert: ⏪️ Reverts a previous commit",
emoji: ":rewind:",
},
{ value: 'revert', name: 'revert: ⏪️ Reverts a previous commit', emoji: ':rewind:' }
],
useEmoji: true,
confirmColorize: true,
emojiAlign: 'center',
emojiAlign: "center",
questions: {
scope: {
description: 'What is the scope of this change (e.g. component or file name)'
description:
"What is the scope of this change (e.g. component or file name)",
},
subject: {
description: 'Write a short, imperative tense description of the change'
description:
"Write a short, imperative tense description of the change",
},
body: {
description: 'Provide a longer description of the change'
description: "Provide a longer description of the change",
},
isBreaking: {
description: 'Are there any breaking changes?'
description: "Are there any breaking changes?",
},
breakingBody: {
description:
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself'
"A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
},
breaking: {
description: 'Describe the breaking changes'
description: "Describe the breaking changes",
},
isIssueAffected: {
description: 'Does this change affect any open issues?'
description: "Does this change affect any open issues?",
},
issuesBody: {
description:
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself'
"If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
},
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)'
}
}
}
}
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
},
},
};
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"**/docs/**",
"**/stats.html"
]
}
}
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@commitlint/cz-commitlint": "^18.6.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@waline/client": "^2.15.8",
"commitizen": "^4.3.0",
"cross-env": "^7.0.3",
"cspell": "^8.3.2",
"cz-git": "^1.8.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.10",
"lint-staged": "^15.2.2",
"prettier": "3.2.5",
"tsno": "^2.0.0",
"vitepress": "1.0.0-beta.3",
"vue": "^3.4.15",
Expand Down
3 changes: 1 addition & 2 deletions packages/plugin/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OneDialog, OneButton } from "./components";
import { OneButton } from "./components";
import { ElectronApi } from "../../main/types/preload";

export enum DownloadType {
Expand All @@ -16,7 +16,6 @@ export interface WebSource {
declare global {
interface HTMLElementTagNameMap {
"one-button": OneButton;
"one-dialog": OneDialog;
}
interface Window {
electron: ElectronApi;
Expand Down
20 changes: 19 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/build-server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env zx
import { $,os } from "zx";
import { $, os } from "zx";

const platform = os.platform();

let GOOS = "";
let GOARCH = "amd64";
const GOARCH = "amd64";
let filename = `../packages/main/bin/${platform}/server`;

if (platform == "darwin") {
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { echo,$ } from "zx";
echo("开始构建 production ...");
echo("当前所在的目录是:", process.cwd());

await $`npm run types`;

await $`npm run build:server`;

await $`npm run build:plugin`;

await $`npm run build:mobile`;

await $`npm run types`;

await $`npm run build:main`;

await $`npm run build:renderer`;
6 changes: 3 additions & 3 deletions scripts/check.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env zx

import type { ProcessOutput } from 'zx'
import { $ } from 'zx'
import { printObject } from './utils'
// import type { ProcessOutput } from "zx";
// import { $ } from "zx";
// import { printObject } from "./utils";

// await $`pnpm spellcheck`.catch((out: ProcessOutput) => {
// console.log(out)
Expand Down
6 changes: 3 additions & 3 deletions scripts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const main = path.resolve(root, "packages/main");
const app = path.resolve(main, "app");
const bin = path.resolve(app, "bin");

let filename = path.resolve(bin, `${platform}/server`)
let filename = path.resolve(bin, `${platform}/server`);
if (platform == "win32") {
filename += ".exe";
}
Expand All @@ -21,11 +21,11 @@ if (!fs.existsSync(filename)) {
await $`npm run build:server`;
}

if (!fs.existsSync(path.resolve(app, 'mobile'))) {
if (!fs.existsSync(path.resolve(app, "mobile"))) {
await $`npm run build:mobile`;
}

if (!fs.existsSync(path.resolve(app, 'plugin'))) {
if (!fs.existsSync(path.resolve(app, "plugin"))) {
await $`npm run build:plugin`;
}

Expand Down
14 changes: 7 additions & 7 deletions scripts/pre-commit.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env zx

import { $ } from 'zx'
import { $ } from "zx";

console.log('开始执行代码质量评估...\n')
console.log("开始执行代码质量评估...\n");

await import('./check').catch((out) => {
throw new Error('代码质量评估失败, 请检查代码')
})
await import("./check").catch(() => {
throw new Error("代码质量评估失败, 请检查代码");
});

console.log('printf "检测通过, 创建 commit 中...\n')
console.log('printf "检测通过, 创建 commit 中...\n');

await $`git add .`
await $`git add .`;
6 changes: 3 additions & 3 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ProcessOutput } from 'zx/core'
import { ProcessOutput } from "zx/core";

export function printObject(
object: Record<string, unknown> | ProcessOutput,
method: 'log' | 'warn' | 'error' = 'log'
method: "log" | "warn" | "error" = "log",
) {
for (const [key, value] of Object.entries(object)) {
// eslint-disable-next-line no-console
console[method](`${key}:\n${value}\n`)
console[method](`${key}:\n${value}\n`);
}
}

0 comments on commit 6d0f6e6

Please sign in to comment.