Skip to content

Commit

Permalink
feat: 兼容 f2elint init
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Mar 1, 2024
1 parent 569f6fa commit b24c86f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
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.0 - 2024-03-01

- 兼容老的 `f2elint init` 用法

## 4.1.0 - 2024-02-07

- 导出 `TemplateType`
Expand Down
2 changes: 1 addition & 1 deletion packages/f2elint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "f2elint",
"version": "4.1.1",
"version": "4.2.0",
"description": "Linter for Alibaba F2E Guidelines",
"keywords": [
"f2elint",
Expand Down
12 changes: 6 additions & 6 deletions packages/f2elint/src/f2elint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ import { TemplateType } from './types';
const __dirname = dirname(fileURLToPath(import.meta.url));
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));

if (process.argv.length > 2) {
if (process.argv.length > 2 && !process.argv.includes('init')) {
// Non-interactive

const program = new Command('f2elint');

program
.argument('[project]', '项目位置')
.option('--template <template>', '模版类型')
.option('--stylelint', '启用 Stylelint')
.option('--prettier', '启用 Prettier')
.option('--lint-staged', '启用 Lint-Staged')
.option('--commitlint', '启用 Commitlint')
.option('--template <template>', '模版类型', 'react-ts')
.option('--stylelint', '启用 Stylelint', false)
.option('--prettier', '启用 Prettier', false)
.option('--lint-staged', '启用 Lint-Staged', false)
.option('--commitlint', '启用 Commitlint', false)
.action(f2elint);

program.helpOption('-h, --help', '显示帮助');
Expand Down

0 comments on commit b24c86f

Please sign in to comment.