Skip to content

Commit

Permalink
fix: optimize log output
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Mar 11, 2024
1 parent b24c86f commit a61d1c3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
]
},
"devDependencies": {
"@commitlint/cli": "^18.6.0",
"@mdx-js/react": "^3.0.0",
"@types/node": "^20.11.17",
"@commitlint/cli": "^18.6.1",
"@mdx-js/react": "^3.0.1",
"@types/node": "^20.11.25",
"commitlint-config-ali": "link:packages/commitlint-config-ali",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-ali": "link:packages/eslint-config-ali",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
Expand All @@ -53,8 +53,8 @@
"react": "^18.2.0",
"react-doc-ui": "^2.2.6",
"react-dom": "^18.2.0",
"rive": "^2.0.30",
"typescript": "^5.3.3"
"rive": "^2.0.33",
"typescript": "^5.4.2"
},
"rive": {
"doc": {
Expand Down
4 changes: 4 additions & 0 deletions packages/f2elint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志

## 4.2.1 - 2024-03-11

- 优化输出

## 4.2.0 - 2024-03-01

- 兼容老的 `f2elint init` 用法
Expand Down
6 changes: 3 additions & 3 deletions packages/f2elint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
"chalk": "^5.3.0",
"command-exists": "^1.2.9",
"commander": "^12.0.0",
"init-roll": "^1.0.10"
"init-roll": "^1.1.1"
},
"devDependencies": {
"@types/command-exists": "^1.2.3",
"@types/node": "^20.11.17",
"rive": "^2.0.27"
"@types/node": "^20.11.25",
"rive": "^2.0.33"
},
"rive": {
"template": "cli",
Expand Down
9 changes: 8 additions & 1 deletion packages/f2elint/src/f2elint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ if (process.argv.length > 2 && !process.argv.includes('init')) {
s1.start('🚧 正在初始化项目');

try {
await f2elint(projectPath, { template, stylelint, prettier, lintStaged, commitlint });
await f2elint(projectPath, {
template,
stylelint,
prettier,
lintStaged,
commitlint,
disableLog: true,
});
s1.stop('✅ 初始化项目完成');
} catch (error) {
s1.stop('❌ 初始化项目失败');
Expand Down
6 changes: 5 additions & 1 deletion packages/f2elint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ export interface F2elintOptions {
prettier?: boolean;
commitlint?: boolean;
lintStaged?: boolean;
disableLog?: boolean;
}

export async function f2elint(project: string | null, options: F2elintOptions = {}) {
const projectFullPath = project?.startsWith('/') ? project : join(process.cwd(), project || '.');

const __dirname = dirname(fileURLToPath(import.meta.url));
const template = options?.template || 'base-js';
const initTemplate = (t: string) => init(join(__dirname, '..', 'templates', t), projectFullPath, options);
const initTemplate = (t: string) =>
init(join(__dirname, '..', 'templates', t), projectFullPath, options, {
disableLog: options.disableLog,
});

await initTemplate('base');
await initTemplate(template);
Expand Down

0 comments on commit a61d1c3

Please sign in to comment.