anl 1.5.13 → 1.5.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ar.md CHANGED
@@ -2,23 +2,38 @@
2
2
 
3
3
  [English](./README.en.md) | [Español](./README.es.md) | العربية | [Français](./README.fr.md) | [Русский](./README.ru.md) | [日本語](./README.jp.md) | [简体中文](./README.md)
4
4
 
5
- أداة سطر الأوامر للواجهة الأمامية
5
+ ## الوصف
6
6
 
7
- أداة سطر أوامر تقوم تلقائياً بإنشاء تعريفات أنواع TypeScript ودوال طلبات API استناداً إلى Swagger JSON.
7
+ an-cli هي أداة سطر الأوامر للواجهة الأمامية، وتتضمن الأمرين التاليين:
8
+
9
+ [أمر anl type](#أمر anl type): أداة سطر أوامر تقوم تلقائياً بإنشاء تعريفات أنواع TypeScript ودوال طلبات API استناداً إلى Swagger JSON.
10
+
11
+ [أمر anl lint](#أمر anl lint): يقوم بإنشاء إعدادات eslint و stylelint و prettier و commitLint و VSCode لمشاريع react أو vue
8
12
 
9
13
  ## المميزات
10
14
 
11
- - 🚀 التحليل التلقائي لوثائق Swagger JSON
12
- - 📦 إنشاء ملفات تعريف أنواع TypeScript
13
- - 🔄 إنشاء دوال طلبات API آمنة النوع
14
- - 🎯 دعم معلمات المسار والاستعلام وجسم الطلب
15
- - 📝 إنشاء تلقائي لتعريفات الأنواع المعدودة
16
- - 🎨 دعم تنسيق الكود
17
- - ⚡️ دعم رفع الملفات
18
- - 🛠 خيارات قابلة للتكوين لإنشاء الكود
15
+ - `anl type`
16
+ - 🚀 التحليل التلقائي لوثائق Swagger JSON
17
+ - 📦 إنشاء ملفات تعريف أنواع TypeScript
18
+ - 🔄 إنشاء دوال طلبات API آمنة النوع
19
+ - 🎯 دعم معلمات المسار والاستعلام وجسم الطلب
20
+ - 📝 إنشاء تلقائي لتعريفات الأنواع المعدودة
21
+ - 🎨 دعم تنسيق الكود
22
+ - ⚡️ دعم رفع الملفات
23
+ - 🛠 خيارات قابلة للتكوين لإنشاء الكود
24
+ - `anl lint`
25
+ - 🔍 تكوين جميع أدوات lint بنقرة واحدة
26
+ - 🎨 تكوين تلقائي لـ ESLint
27
+ - 🎯 تكوين تنسيق Prettier
28
+ - 🔄 معايير الالتزام CommitLint
29
+ - 📦 إعدادات محرر VSCode
19
30
 
20
31
  ## التثبيت
21
32
 
33
+ > [!NOTE]
34
+ >
35
+ > يتطلب التثبيت العالمي
36
+
22
37
  ```bash
23
38
  $ npm install anl -g
24
39
 
@@ -189,3 +204,54 @@ npm run blink
189
204
  ## الترخيص
190
205
 
191
206
  ISC License
207
+
208
+ # أمر anl lint
209
+
210
+ ### نظرة عامة على الوظائف
211
+
212
+ يوفر وظيفة تكوين أدوات lint المختلفة لمشروع الواجهة الأمامية بنقرة واحدة، بما في ذلك:
213
+
214
+ - فحص الكود ESLint
215
+ - تنسيق الكود Prettier
216
+ - معايير رسائل الالتزام CommitLint
217
+ - إعدادات محرر VSCode
218
+
219
+ ### طريقة الاستخدام
220
+
221
+ ```bash
222
+ $ anl lint
223
+ ```
224
+
225
+ ### تفاصيل التكوين
226
+
227
+ #### 1. تكوين ESLint
228
+
229
+ - تثبيت تلقائي للتبعيات المطلوبة
230
+ - دعم إطار عمل React/Vue
231
+ - إنشاء تلقائي لـ `.eslintrc.js` و `.eslintignore`
232
+ - دمج دعم TypeScript
233
+
234
+ #### 2. تكوين Prettier
235
+
236
+ - تثبيت تلقائي لتبعيات prettier
237
+ - إنشاء ملف تكوين `.prettierrc.js`
238
+ - التكوين الافتراضي يشمل:
239
+ - عرض السطر: 80
240
+ - مسافة بادئة Tab
241
+ - استخدام علامات اقتباس فردية
242
+ - أقواس دوال السهم
243
+ - معايير نمط الكود الأخرى
244
+
245
+ #### 3. تكوين CommitLint
246
+
247
+ - تثبيت تبعيات commitlint
248
+ - تكوين خطاطيف git مع husky
249
+ - إنشاء `commitlint.config.js`
250
+ - توحيد رسائل git commit
251
+
252
+ #### 4. تكوين VSCode
253
+
254
+ - إنشاء `.vscode/settings.json`
255
+ - تكوين التنسيق التلقائي للمحرر
256
+ - تعيين أداة التنسيق الافتراضية
257
+ - دعم تحديث ملفات التكوين الموجودة
package/README.en.md CHANGED
@@ -2,30 +2,54 @@
2
2
 
3
3
  English | [Español](./README.es.md) | [العربية](./README.ar.md) | [Français](./README.fr.md) | [Русский](./README.ru.md) | [日本語](./README.jp.md) | [简体中文](./README.md)
4
4
 
5
- Frontend Command Line Tool
5
+ ## Description
6
6
 
7
- A command-line tool that automatically generates TypeScript type definitions and API request functions based on Swagger JSON.
7
+ an-cli is a frontend command line tool that includes the following two commands:
8
+
9
+ [anl type command](#anl-type-command): A command-line tool that automatically generates TypeScript type definitions and API request functions based on Swagger JSON.
10
+
11
+ `anl lint` command: Generates eslint, stylelint, prettier, commitLint, and VSCode related configurations for React or Vue projects.
8
12
 
9
13
  ## Features
10
14
 
11
- - 🚀 Automatic parsing of Swagger JSON documentation
12
- - 📦 Generate TypeScript type definition files
13
- - 🔄 Generate type-safe API request functions
14
- - 🎯 Support for path parameters, query parameters, and request body
15
- - 📝 Automatic generation of enum type definitions
16
- - 🎨 Support for code formatting
17
- - ⚡️ Support for file uploads
18
- - 🛠 Configurable code generation options
15
+ - `anl type`
16
+
17
+ - 🚀 Automatic parsing of Swagger JSON documentation
18
+ - 📦 Generate TypeScript type definition files
19
+ - 🔄 Generate type-safe API request functions
20
+ - 🎯 Support for path parameters, query parameters, and request body
21
+ - 📝 Automatic generation of enum type definitions
22
+ - 🎨 Support for code formatting
23
+ - ⚡️ Support for file uploads
24
+ - 🛠 Configurable code generation options
25
+
26
+ - `anl lint`
27
+ - 🔍 One-click configuration for various lint tools
28
+ - 🎨 ESLint configuration automation
29
+ - 🎯 Prettier formatting configuration
30
+ - 🔄 CommitLint submission specifications
31
+ - 📦 VSCode editor configuration
19
32
 
20
33
  ## Installation
21
34
 
35
+ > [!NOTE]
36
+ >
37
+ > Global installation is required
38
+
22
39
  ```bash
23
40
  $ npm install anl -g
24
41
 
25
42
  $ yarn global add anl
26
43
  ```
27
44
 
28
- ## Usage
45
+ ## Usage Notes
46
+
47
+ > [!TIP]
48
+ >
49
+ > 1. If you are using it for the first time and are unsure about the results, it is recommended to execute the command first, observe what changes will occur in the project, then combine with the documentation to further modify the configuration and generate again until you achieve your desired outcome
50
+ > 2. Or follow the steps below one by one, and you will gain understanding
51
+
52
+ # anl type command
29
53
 
30
54
  1. Execute command
31
55
 
@@ -189,3 +213,54 @@ Issues and Pull Requests are welcome!
189
213
  ## License
190
214
 
191
215
  ISC License
216
+
217
+ # anl lint command
218
+
219
+ ### Feature Overview
220
+
221
+ Provides one-click configuration functionality for various frontend project lint tools, including:
222
+
223
+ - ESLint code checking
224
+ - Prettier code formatting
225
+ - CommitLint commit message specifications
226
+ - VSCode editor configuration
227
+
228
+ ### Usage
229
+
230
+ ```bash
231
+ $ anl lint
232
+ ```
233
+
234
+ ### Configuration Details
235
+
236
+ #### 1. ESLint Configuration
237
+
238
+ - Automatically installs required dependencies
239
+ - Supports React/Vue frameworks
240
+ - Automatically generates `.eslintrc.js` and `.eslintignore`
241
+ - Integrates TypeScript support
242
+
243
+ #### 2. Prettier Configuration
244
+
245
+ - Automatically installs prettier-related dependencies
246
+ - Generates `.prettierrc.js` configuration file
247
+ - Default configurations include:
248
+ - Line width: 80
249
+ - Tab indentation
250
+ - Use single quotes
251
+ - Arrow function parentheses
252
+ - Other code style specifications
253
+
254
+ #### 3. CommitLint Configuration
255
+
256
+ - Installs commitlint-related dependencies
257
+ - Configures husky git hooks
258
+ - Generates `commitlint.config.js`
259
+ - Standardizes git commit messages
260
+
261
+ #### 4. VSCode Configuration
262
+
263
+ - Creates `.vscode/settings.json`
264
+ - Configures editor auto-formatting
265
+ - Sets default formatting tools
266
+ - Supports updating existing configuration files
package/README.es.md CHANGED
@@ -2,20 +2,33 @@
2
2
 
3
3
  [English](./README.en.md) | Español | [العربية](./README.ar.md) | [Français](./README.fr.md) | [Русский](./README.ru.md) | [日本語](./README.jp.md) | [简体中文](./README.md)
4
4
 
5
- Herramienta de Línea de Comandos Frontend
5
+ ## Descripción
6
6
 
7
- Una herramienta de línea de comandos que genera automáticamente definiciones de tipos TypeScript y funciones de solicitud de API basadas en Swagger JSON.
7
+ an-cli es una herramienta de línea de comandos frontend que incluye dos comandos:
8
+
9
+ [Comando anl type](#comando-anl-type): Una herramienta de línea de comandos que genera automáticamente definiciones de tipos TypeScript y funciones de solicitud de API basadas en Swagger JSON.
10
+
11
+ Comando `anl lint`: Genera configuraciones relacionadas con eslint, stylelint, prettier, commitLint y VSCode para proyectos React o Vue.
8
12
 
9
13
  ## Características
10
14
 
11
- - 🚀 Análisis automático de documentación Swagger JSON
12
- - 📦 Genera archivos de definición de tipos TypeScript
13
- - 🔄 Genera funciones de solicitud de API con seguridad de tipos
14
- - 🎯 Soporte para parámetros de ruta, consulta y cuerpo de solicitud
15
- - 📝 Generación automática de definiciones de tipos enum
16
- - 🎨 Soporte para formateo de código
17
- - ⚡️ Soporte para carga de archivos
18
- - 🛠 Opciones configurables de generación de código
15
+ - `anl type`
16
+
17
+ - 🚀 Análisis automático de documentación Swagger JSON
18
+ - 📦 Genera archivos de definición de tipos TypeScript
19
+ - 🔄 Genera funciones de solicitud de API con seguridad de tipos
20
+ - 🎯 Soporte para parámetros de ruta, consulta y cuerpo de solicitud
21
+ - 📝 Generación automática de definiciones de tipos enum
22
+ - 🎨 Soporte para formateo de código
23
+ - ⚡️ Soporte para carga de archivos
24
+ - 🛠 Opciones configurables de generación de código
25
+
26
+ - `anl lint`
27
+ - 🔍 Configuración con un solo comando para varias herramientas lint
28
+ - 🎨 Configuración automatizada de ESLint
29
+ - 🎯 Configuración de formato Prettier
30
+ - 🔄 Estándares de commit con CommitLint
31
+ - 📦 Configuración del editor VSCode
19
32
 
20
33
  ## Instalación
21
34
 
@@ -188,3 +201,54 @@ npm run blink
188
201
  ## Licencia
189
202
 
190
203
  Licencia ISC
204
+
205
+ # Comando anl lint
206
+
207
+ ### Descripción General
208
+
209
+ Proporciona la funcionalidad de configurar varias herramientas lint para proyectos frontend con un solo comando, incluyendo:
210
+
211
+ - Verificación de código con ESLint
212
+ - Formateo de código con Prettier
213
+ - Estandarización de mensajes de commit con CommitLint
214
+ - Configuración del editor VSCode
215
+
216
+ ### Uso
217
+
218
+ ```bash
219
+ $ anl lint
220
+ ```
221
+
222
+ ### Detalles de Configuración
223
+
224
+ #### 1. Configuración de ESLint
225
+
226
+ - Instalación automática de dependencias necesarias
227
+ - Soporte para frameworks React/Vue
228
+ - Generación automática de `.eslintrc.js` y `.eslintignore`
229
+ - Integración con soporte TypeScript
230
+
231
+ #### 2. Configuración de Prettier
232
+
233
+ - Instalación automática de dependencias de prettier
234
+ - Generación del archivo de configuración `.prettierrc.js`
235
+ - Configuración predeterminada que incluye:
236
+ - Ancho de línea: 80
237
+ - Indentación con tabulaciones
238
+ - Uso de comillas simples
239
+ - Paréntesis en funciones flecha
240
+ - Otras normas de estilo de código
241
+
242
+ #### 3. Configuración de CommitLint
243
+
244
+ - Instalación de dependencias relacionadas con commitlint
245
+ - Configuración de git hooks con husky
246
+ - Generación de `commitlint.config.js`
247
+ - Estandarización de mensajes git commit
248
+
249
+ #### 4. Configuración de VSCode
250
+
251
+ - Creación de `.vscode/settings.json`
252
+ - Configuración de formato automático del editor
253
+ - Configuración de la herramienta de formato predeterminada
254
+ - Soporte para actualización de archivos de configuración existentes
package/README.fr.md CHANGED
@@ -2,30 +2,52 @@
2
2
 
3
3
  [English](./README.en.md) | [Español](./README.es.md) | [العربية](./README.ar.md) | Français | [Русский](./README.ru.md) | [日本語](./README.jp.md) | [简体中文](./README.md)
4
4
 
5
- Outil en Ligne de Commande Frontend
5
+ ## Description
6
6
 
7
- Un outil en ligne de commande qui génère automatiquement des définitions de types TypeScript et des fonctions de requête API basées sur Swagger JSON.
7
+ an-cli est un outil en ligne de commande frontend qui comprend les deux commandes suivantes :
8
8
 
9
- ## Fonctionnalités
9
+ [Commande anl type](#commande-anl-type) : Un outil en ligne de commande qui génère automatiquement des définitions de types TypeScript et des fonctions de requête API basées sur Swagger JSON.
10
10
 
11
- - 🚀 Analyse automatique de la documentation Swagger JSON
12
- - 📦 Génération de fichiers de définition de types TypeScript
13
- - 🔄 Génération de fonctions de requête API typées
14
- - 🎯 Prise en charge des paramètres de chemin, de requête et de corps
15
- - 📝 Génération automatique de définitions de types énumérés
16
- - 🎨 Prise en charge du formatage du code
17
- - ⚡️ Prise en charge du téléchargement de fichiers
18
- - 🛠 Options de génération de code configurables
11
+ Commande `anl lint` : Génère des configurations ESLint, Stylelint, Prettier, CommitLint et VSCode pour les projets React ou Vue.
12
+
13
+ ## Caractéristiques
14
+
15
+ - `anl type`
16
+
17
+ - 🚀 Analyse automatique de la documentation Swagger JSON
18
+ - 📦 Génération de fichiers de définition de types TypeScript
19
+ - 🔄 Génération de fonctions de requête API typées
20
+ - 🎯 Prise en charge des paramètres de chemin, de requête et de corps
21
+ - 📝 Génération automatique de définitions de types énumérés
22
+ - 🎨 Prise en charge du formatage du code
23
+ - ⚡️ Prise en charge du téléchargement de fichiers
24
+ - 🛠 Options de génération de code configurables
25
+
26
+ - `anl lint`
27
+ - 🔍 Configuration en un clic de divers outils lint
28
+ - 🎨 Configuration automatique d'ESLint
29
+ - 🎯 Configuration du formatage Prettier
30
+ - 🔄 Normes de commit avec CommitLint
31
+ - 📦 Configuration de l'éditeur VSCode
19
32
 
20
33
  ## Installation
21
34
 
35
+ > [!NOTE]
36
+ >
37
+ > Installation globale requise
38
+
22
39
  ```bash
23
40
  $ npm install anl -g
24
41
 
25
42
  $ yarn global add anl
26
43
  ```
27
44
 
28
- ## Utilisation
45
+ ## Instructions d'utilisation
46
+
47
+ > [!TIP]
48
+ >
49
+ > 1. Si c'est votre première utilisation et que vous n'êtes pas sûr des résultats, il est recommandé d'exécuter d'abord la commande, d'observer les changements dans le projet, puis de consulter la documentation pour modifier la configuration et générer à nouveau jusqu'à obtenir le résultat souhaité.
50
+ > 2. Ou suivez les étapes ci-dessous une par une pour obtenir des résultats.
29
51
 
30
52
  1. Exécuter la commande
31
53
 
package/README.jp.md CHANGED
@@ -2,23 +2,40 @@
2
2
 
3
3
  [English](./README.en.md) | [Español](./README.es.md) | [العربية](./README.ar.md) | [Français](./README.fr.md) | [Русский](./README.ru.md) | 日本語 | [简体中文](./README.md)
4
4
 
5
- フロントエンドコマンドラインツール
5
+ ## 概要
6
6
 
7
- Swagger JSONに基づいてTypeScriptの型定義とAPIリクエスト関数を自動生成するコマンドラインツール。
7
+ an-cliは、以下の2つのコマンドを含むフロントエンドコマンドラインツールです:
8
+
9
+ [anl typeコマンド](#anl-typeコマンド):Swagger JSONに基づいてTypeScriptの型定義とAPIリクエスト関数を自動生成するツール。
10
+
11
+ `anl lint`コマンド:ReactまたはVueプロジェクトのeslint、stylelint、prettier、commitLint、VSCode関連の設定を生成するツール。
8
12
 
9
13
  ## 特徴
10
14
 
11
- - 🚀 Swagger JSON文書の自動解析
12
- - 📦 TypeScript型定義ファイルの生成
13
- - 🔄 型安全なAPIリクエスト関数の生成
14
- - 🎯 パスパラメータ、クエリパラメータ、リクエストボディのサポート
15
- - 📝 列挙型定義の自動生成
16
- - 🎨 コードフォーマットのサポート
17
- - ⚡️ ファイルアップロードのサポート
18
- - 🛠 設定可能なコード生成オプション
15
+ - `anl type`
16
+
17
+ - 🚀 Swagger JSON文書の自動解析
18
+ - 📦 TypeScript型定義ファイルの生成
19
+ - 🔄 型安全なAPIリクエスト関数の生成
20
+ - 🎯 パスパラメータ、クエリパラメータ、リクエストボディのサポート
21
+ - 📝 列挙型定義の自動生成
22
+ - 🎨 コードフォーマットのサポート
23
+ - ⚡️ ファイルアップロードのサポート
24
+ - 🛠 設定可能なコード生成オプション
25
+
26
+ - `anl lint`
27
+ - 🔍 各種リントツールのワンクリック設定
28
+ - 🎨 ESLint設定の自動化
29
+ - 🎯 Prettierフォーマット設定
30
+ - 🔄 CommitLintコミット規約
31
+ - 📦 VSCodeエディタ設定
19
32
 
20
33
  ## インストール
21
34
 
35
+ > [!NOTE]
36
+ >
37
+ > グローバルインストールが必要です
38
+
22
39
  ```bash
23
40
  $ npm install anl -g
24
41
 
@@ -184,8 +201,59 @@ npm run blink
184
201
 
185
202
  ## 貢献ガイド
186
203
 
187
- IssueやPull Requestを歓迎します!
204
+ [Issue](https://github.com/bianliuzhu/an-cli/issues)[Pull Request](https://github.com/bianliuzhu/an-cli/pulls)を歓迎します!
188
205
 
189
206
  ## ライセンス
190
207
 
191
208
  ISC License
209
+
210
+ # anl lintコマンド
211
+
212
+ ### 機能概要
213
+
214
+ フロントエンドプロジェクトの各種リントツールをワンクリックで設定する機能を提供します:
215
+
216
+ - ESLintコード検査
217
+ - Prettierコードフォーマット
218
+ - CommitLintコミットメッセージ規約
219
+ - VSCodeエディタ設定
220
+
221
+ ### 使用方法
222
+
223
+ ```bash
224
+ $ anl lint
225
+ ```
226
+
227
+ ### 設定詳細
228
+
229
+ #### 1. ESLint設定
230
+
231
+ - 必要な依存関係を自動インストール
232
+ - React/Vueフレームワークをサポート
233
+ - `.eslintrc.js`と`.eslintignore`を自動生成
234
+ - TypeScriptサポートを統合
235
+
236
+ #### 2. Prettier設定
237
+
238
+ - prettier関連の依存関係を自動インストール
239
+ - `.prettierrc.js`設定ファイルを生成
240
+ - デフォルト設定には以下が含まれます:
241
+ - 行幅:80
242
+ - タブインデント
243
+ - シングルクォートの使用
244
+ - アロー関数の括弧
245
+ - その他のコードスタイル規約
246
+
247
+ #### 3. CommitLint設定
248
+
249
+ - commitlint関連の依存関係をインストール
250
+ - husky git hooksを設定
251
+ - `commitlint.config.js`を生成
252
+ - gitコミットメッセージを標準化
253
+
254
+ #### 4. VSCode設定
255
+
256
+ - `.vscode/settings.json`を作成
257
+ - エディタの自動フォーマットを設定
258
+ - デフォルトフォーマッタを設定
259
+ - 既存の設定ファイルの更新をサポート
package/README.md CHANGED
@@ -2,30 +2,56 @@
2
2
 
3
3
  [English](./README.en.md) | [Español](./README.es.md) | [العربية](./README.ar.md) | [Français](./README.fr.md) | [Русский](./README.ru.md) | [日本語](./README.jp.md) | 简体中文
4
4
 
5
- 前端命令行工具
5
+ ## 说明
6
6
 
7
- 一个基于 Swagger JSON 自动生成 TypeScript 类型定义和 API 请求函数的命令行工具。
7
+ an-cli 前端命令行工具,包含以下两个命令
8
+
9
+ [anl type 命令](#anl type 命令):基于 Swagger JSON 自动生成 TypeScript 类型定义和 API 请求函数的命令行工具。
10
+
11
+ [anl lint 命令](#anl lint 命令)命令,生成 react 或 vue 项目 eslint、stylelint、prettier、commitLint、VSCode相关配置
8
12
 
9
13
  ## 功能特点
10
14
 
11
- - 🚀 自动解析 Swagger JSON 文档
12
- - 📦 生成 TypeScript 类型定义文件
13
- - 🔄 生成类型安全的 API 请求函数
14
- - 🎯 支持路径参数、查询参数和请求体
15
- - 📝 自动生成枚举类型定义
16
- - 🎨 支持代码格式化
17
- - ⚡️ 支持文件上传
18
- - 🛠 可配置的代码生成选项
15
+ - `anl type`
16
+
17
+ - 🚀 自动解析 Swagger JSON 文档
18
+ - 📦 生成 TypeScript 类型定义文件
19
+ - 🔄 生成类型安全的 API 请求函数
20
+ - 🎯 支持路径参数、查询参数和请求体
21
+ - 📝 自动生成枚举类型定义
22
+ - 🎨 支持代码格式化
23
+ - ⚡️ 支持文件上传
24
+ - 🛠 可配置的代码生成选项
25
+
26
+ - `anl lint`
27
+ - 🔍 一键配置各种 lint 工具
28
+ - 🎨 ESLint 配置自动化
29
+ - 🎯Prettier 格式化配置
30
+ - 🔄 CommitLint 提交规范
31
+ - 📦 VSCode 编辑器配置
19
32
 
20
33
  ## 安装
21
34
 
35
+ > [!NOTE]
36
+ >
37
+ > 需要全局安装
38
+
22
39
  ```bash
23
40
  $ npm install anl -g
24
41
 
25
42
  $ yarn global add anl
26
43
  ```
27
44
 
28
- ## 使用方法
45
+ ## 使用说明
46
+
47
+ > [!TIP]
48
+ >
49
+ > 1. 如果初次使用,不清楚会产生什么结果,建议先执行命令,观察会在项目中发生什么变化,然后在结合文档,进一步修改配置,再次生成,最终达到自己理想中的样子
50
+ > 2. 或者跟着下面步骤 一步一步做,就会有收获
51
+
52
+ # anl type 命令
53
+
54
+ ## 使用说明
29
55
 
30
56
  1. 执行命令
31
57
 
@@ -33,11 +59,17 @@ $ yarn global add anl
33
59
  $ anl type
34
60
  ```
35
61
 
36
- 2. 完善配置项目
62
+ 2. 配置文件说明
63
+
64
+ - 首次执行 `anl type`, 命令,会在*项目根目录下*, _自动创建_ 以 `an.config.json` 为名的配置文件(手动创建也可以)。
65
+ - 执行 `anl type` 命令时,会找用户项目根目录下的 `an.config.json` 配置文件,并读取其配置信息,生成对应的axios封装、配置、接口列表、接口请求及响应类型
66
+ - 配置文件内的配置项是可自由修改的
37
67
 
38
- - 首次执行 `anl type`, 命令,会在*项目根目录下*, _自动创建_ 以 `an.config.json` 为名的配置文件(手动创建也可以),
39
- - 具体参数说明请看配置项说明
40
- - 配置文件名不可修改
68
+ 3. `an.config.json`配置项示例
69
+
70
+ - 配置文件必须在项目根目录下,不可移动位置
71
+ - 配置文件名称不可更改
72
+ - 具体参数说明请看[配置项说明](#配置项说明)
41
73
 
42
74
  ```json
43
75
  {
@@ -56,12 +88,16 @@ $ anl type
56
88
  }
57
89
  ```
58
90
 
59
- 3. 生成 TypeScript 类型定义和 API 请求函数,再次执行生成命令即可
91
+ 3. 按照自己的需要更新配置文件,然后再次执行 `anl type` 命令,会依照配置文件中的指定配置信息生成,生成对应的类型信息
60
92
 
61
93
  ```bash
62
94
  $ anl type
63
95
  ```
64
96
 
97
+ > [!NOTE]
98
+ >
99
+ > 如果不清楚这些配置,可以先执行 anl type 命令,将类型先生成,然后检查项目目录,结合配置项说明,调整配置项,再次生成,最终达到想要的效果
100
+
65
101
  ## 配置项说明
66
102
 
67
103
  | 配置项 | 类型 | 必填 | 说明 |
@@ -84,7 +120,7 @@ $ anl type
84
120
  project/
85
121
  ├── apps/
86
122
  │ ├── types/
87
- │ │ ├── models/ # 所有类型定义文件(不包含枚举类型)
123
+ │ │ ├── models/ # 所有类型定义文件(不包含枚举类型)
88
124
  │ │ ├── connectors/ # API 类型定义(接口定义文件)
89
125
  │ │ └── enums/ # 枚举类型定义
90
126
  │ └── api/
@@ -184,10 +220,61 @@ npm run blink
184
220
  - 检查 requestMethodsImportPath 配置是否正确
185
221
  - 确认请求方法文件是否存在
186
222
 
187
- ## 贡献指南
223
+ # anl lint 命令
224
+
225
+ ### 功能概述
226
+
227
+ 提供一键配置前端项目各种 lint 工具的功能,包括:
228
+
229
+ - ESLint 代码检查
230
+ - Prettier 代码格式化
231
+ - CommitLint 提交信息规范
232
+ - VSCode 编辑器配置
188
233
 
189
- 欢迎提交 Issue 和 Pull Request!
234
+ ### 使用方法
190
235
 
191
- ## 许可证
236
+ ```bash
237
+ $ anl lint
238
+ ```
239
+
240
+ ### 配置详情
241
+
242
+ #### 1. ESLint 配置
243
+
244
+ - 自动安装所需依赖
245
+ - 支持 React/Vue 框架
246
+ - 自动生成 `.eslintrc.js` 和 `.eslintignore`
247
+ - 集成 TypeScript 支持
248
+
249
+ #### 2. Prettier 配置
250
+
251
+ - 自动安装 prettier 相关依赖
252
+ - 生成 `.prettierrc.js` 配置文件
253
+ - 默认配置包括:
254
+ - 行宽:80
255
+ - Tab 缩进
256
+ - 使用单引号
257
+ - 箭头函数括号
258
+ - 其他代码风格规范
259
+
260
+ #### 3. CommitLint 配置
261
+
262
+ - 安装 commitlint 相关依赖
263
+ - 配置 husky git hooks
264
+ - 生成 `commitlint.config.js`
265
+ - 规范化 git commit message
266
+
267
+ #### 4. VSCode 配置
268
+
269
+ - 创建 `.vscode/settings.json`
270
+ - 配置编辑器自动格式化
271
+ - 设置默认格式化工具
272
+ - 支持已有配置文件更新
273
+
274
+ # 许可证
192
275
 
193
276
  ISC License
277
+
278
+ # 贡献指南
279
+
280
+ 欢迎提交 [Issue](https://github.com/bianliuzhu/an-cli/issues) 和 [Pull Request](https://github.com/bianliuzhu/an-cli/pulls)!
package/README.ru.md CHANGED
@@ -2,20 +2,37 @@
2
2
 
3
3
  [English](./README.en.md) | [Español](./README.es.md) | [العربية](./README.ar.md) | [Français](./README.fr.md) | Русский | [日本語](./README.jp.md) | [简体中文](./README.md)
4
4
 
5
+ ## Описание
6
+
7
+ an-cli - это инструмент командной строки для фронтенд-разработки, включающий следующие две команды:
8
+
9
+ [Команда anl type](#команда-anl-type): Инструмент командной строки для автоматической генерации определений типов TypeScript и функций запросов API на основе Swagger JSON.
10
+
11
+ Команда `anl lint`: Генерирует конфигурации eslint, stylelint, prettier, commitLint и VSCode для проектов React или Vue.
12
+
5
13
  Инструмент Командной Строки для Frontend
6
14
 
7
15
  Инструмент командной строки, который автоматически генерирует определения типов TypeScript и функции запросов API на основе Swagger JSON.
8
16
 
9
17
  ## Особенности
10
18
 
11
- - 🚀 Автоматический разбор документации Swagger JSON
12
- - 📦 Генерация файлов определения типов TypeScript
13
- - 🔄 Генерация типобезопасных функций запросов API
14
- - 🎯 Поддержка параметров пути, запроса и тела запроса
15
- - 📝 Автоматическая генерация определений перечислений
16
- - 🎨 Поддержка форматирования кода
17
- - ⚡️ Поддержка загрузки файлов
18
- - 🛠 Настраиваемые параметры генерации кода
19
+ - `anl type`
20
+
21
+ - 🚀 Автоматический разбор документации Swagger JSON
22
+ - 📦 Генерация файлов определения типов TypeScript
23
+ - 🔄 Генерация типобезопасных функций запросов API
24
+ - 🎯 Поддержка параметров пути, запроса и тела запроса
25
+ - 📝 Автоматическая генерация определений перечислений
26
+ - 🎨 Поддержка форматирования кода
27
+ - ⚡️ Поддержка загрузки файлов
28
+ - 🛠 Настраиваемые параметры генерации кода
29
+
30
+ - `anl lint`
31
+ - 🔍 Настройка всех инструментов линтинга одной командой
32
+ - 🎨 Автоматическая конфигурация ESLint
33
+ - 🎯 Конфигурация форматирования Prettier
34
+ - 🔄 Стандарты коммитов с CommitLint
35
+ - 📦 Настройка редактора VSCode
19
36
 
20
37
  ## Установка
21
38
 
@@ -186,3 +203,54 @@ npm run blink
186
203
  ## Лицензия
187
204
 
188
205
  ISC License
206
+
207
+ # Команда anl lint
208
+
209
+ ### Обзор функциональности
210
+
211
+ Предоставляет возможность настройки различных инструментов линтинга для фронтенд-проекта одной командой, включая:
212
+
213
+ - Проверка кода с ESLint
214
+ - Форматирование кода с Prettier
215
+ - Стандартизация сообщений коммитов с CommitLint
216
+ - Настройка редактора VSCode
217
+
218
+ ### Использование
219
+
220
+ ```bash
221
+ $ anl lint
222
+ ```
223
+
224
+ ### Подробности конфигурации
225
+
226
+ #### 1. Конфигурация ESLint
227
+
228
+ - Автоматическая установка необходимых зависимостей
229
+ - Поддержка фреймворков React/Vue
230
+ - Автоматическая генерация `.eslintrc.js` и `.eslintignore`
231
+ - Интеграция с TypeScript
232
+
233
+ #### 2. Конфигурация Prettier
234
+
235
+ - Автоматическая установка зависимостей prettier
236
+ - Генерация файла конфигурации `.prettierrc.js`
237
+ - Стандартные настройки включают:
238
+ - Ширина строки: 80
239
+ - Отступы табуляцией
240
+ - Использование одинарных кавычек
241
+ - Скобки для стрелочных функций
242
+ - Другие правила форматирования кода
243
+
244
+ #### 3. Конфигурация CommitLint
245
+
246
+ - Установка зависимостей commitlint
247
+ - Настройка git hooks с помощью husky
248
+ - Генерация `commitlint.config.js`
249
+ - Стандартизация сообщений git commit
250
+
251
+ #### 4. Конфигурация VSCode
252
+
253
+ - Создание `.vscode/settings.json`
254
+ - Настройка автоматического форматирования
255
+ - Установка инструмента форматирования по умолчанию
256
+ - Поддержка обновления существующих конфигураций
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="1.5.13",i="FE command line tool",s="bin/an-cli.js",p={dev:"rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript -w",build:"rimraf lib && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",pub:"bash publish.sh",ts:"tsc ./src/int.ts --noEmit --watch",blink:"npm run build && npm link","sync-docs":"node scripts/sync-docs.js"},l={anl:"bin/an-cli.js"},o="Gleason <bianliuzhu@gmail.com>",t={"@commitlint/cli":"^17.4.3","@commitlint/config-conventional":"^17.4.3","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.1.3","@rollup/plugin-typescript":"^8.3.0","@types/inquirer":"^9.0.7","@types/shelljs":"^0.8.11","@typescript-eslint/eslint-plugin":"^5.52.0","@typescript-eslint/parser":"^5.52.0","cross-env":"^7.0.3",eslint:"^8.7.0",husky:"^8.0.3","openapi-types":"^12.1.3",prettier:"^3.3.2",rimraf:"^5.0.7",rollup:"^2.64.0","rollup-plugin-cleandir":"^2.0.0","rollup-plugin-copy":"^3.5.0","rollup-plugin-terser":"^7.0.2",typescript:"^4.5.4"},r={"app-root-path":"^3.1.0",cac:"^6.7.12",chalk:"4.*","clear-console":"^1.1.0",commander:"^10.0.0",figures:"^6.1.0",inquirer:"^10.1.8","log-symbols":"^5.1.0",ora:"5.*","progress-estimator":"^0.3.0",shelljs:"^0.8.5"},n=["typescript","cli","typescript 脚手架","ts 脚手架","ts-cli","脚手架"],c=["package.json","README.md","lib","template"],u={type:"git",url:"https://github.com/bianliuzhu/an-cli.git"},a="commonjs",m={name:"anl",version:e,description:i,main:s,scripts:p,bin:l,author:o,license:"ISC",devDependencies:t,dependencies:r,keywords:n,files:c,repository:u,type:a};exports.author=o,exports.bin=l,exports.default=m,exports.dependencies=r,exports.description=i,exports.devDependencies=t,exports.files=c,exports.keywords=n,exports.license="ISC",exports.main=s,exports.name="anl",exports.repository=u,exports.scripts=p,exports.type=a,exports.version=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="1.5.15",i="FE command line tool",s="bin/an-cli.js",p={dev:"rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript -w",build:"rimraf lib && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",pub:"bash publish.sh",ts:"tsc ./src/int.ts --noEmit --watch",blink:"npm run build && npm link","sync-docs":"node scripts/sync-docs.js"},l={anl:"bin/an-cli.js"},o="Gleason <bianliuzhu@gmail.com>",t={"@commitlint/cli":"^17.4.3","@commitlint/config-conventional":"^17.4.3","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.1.3","@rollup/plugin-typescript":"^8.3.0","@types/inquirer":"^9.0.7","@types/shelljs":"^0.8.11","@typescript-eslint/eslint-plugin":"^5.52.0","@typescript-eslint/parser":"^5.52.0","cross-env":"^7.0.3",eslint:"^8.7.0",husky:"^8.0.3","openapi-types":"^12.1.3",prettier:"^3.3.2",rimraf:"^5.0.7",rollup:"^2.64.0","rollup-plugin-cleandir":"^2.0.0","rollup-plugin-copy":"^3.5.0","rollup-plugin-terser":"^7.0.2",typescript:"^4.5.4"},r={"app-root-path":"^3.1.0",cac:"^6.7.12",chalk:"4.*","clear-console":"^1.1.0",commander:"^10.0.0",figures:"^6.1.0",inquirer:"^10.1.8","log-symbols":"^5.1.0",ora:"5.*","progress-estimator":"^0.3.0",shelljs:"^0.8.5"},n=["typescript","cli","typescript 脚手架","ts 脚手架","ts-cli","脚手架"],c=["package.json","README.md","lib","template"],u={type:"git",url:"https://github.com/bianliuzhu/an-cli.git"},a="commonjs",m={name:"anl",version:e,description:i,main:s,scripts:p,bin:l,author:o,license:"ISC",devDependencies:t,dependencies:r,keywords:n,files:c,repository:u,type:a};exports.author=o,exports.bin=l,exports.default=m,exports.dependencies=r,exports.description=i,exports.devDependencies=t,exports.files=c,exports.keywords=n,exports.license="ISC",exports.main=s,exports.name="anl",exports.repository=u,exports.scripts=p,exports.type=a,exports.version=e;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs"),t=require("../utils/index.js"),s=require("./core/components.js"),a=require("./core/get-data.js"),r=require("./core/path.js"),o=require("shelljs"),i=require("chalk"),n=require("path");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(e),p=c(i),u=c(n);let d;const h="development"===process.env.NODE_ENV,f={saveTypeFolderPath:h?"apps/types":"src/api/types",saveApiListFolderPath:h?"apps/types":"src/api",saveEnumFolderPath:h?"apps/types/enums":"src/enums",importEnumPath:"../../../enums",requestMethodsImportPath:"./fetch",dataLevel:"serve",swaggerJsonUrl:"www.example.swagger.json.url",headers:{},formatting:{indentation:"\t",lineEnding:"\n"}};class w{schemas={};paths={};async handle(e){try{let t;if(t="development"===process.env.NODE_ENV?(await Promise.resolve().then((function(){return require("../../data/open-api.json.js")}))).default:await a.getSwaggerJson(e),!t)throw new Error("无法获取 Swagger 数据");this.schemas=t.components?.schemas||{},this.paths=t.paths||{};const o=new s.default(this.schemas,e),i=new r.PathParse(this.paths,t.components?.parameters,e);return await Promise.all([o.handle(),i.handle()]),!0}catch(e){if(e instanceof Error)throw new Error(`处理 Swagger 数据失败: ${e.message}`);throw new Error("处理 Swagger 数据失败: 未知错误")}}async formatGeneratedFiles(e){const s=`npx prettier --write "${e.saveTypeFolderPath}/**/*.{ts,d.ts}"`;try{await l.default.promises.access(e.saveTypeFolderPath);const{stderr:a}=await new Promise(((e,t)=>{o.exec(s,((s,a,r)=>{s?t(s):e({stdout:a,stderr:r})}))}));if(a)throw new Error(a);t.log.success("文件格式化成功")}catch(e){console.log(""),t.log.error("格式化失败,请手动执行以下命令:"),console.log("$",p.default.yellow(s)),console.log("")}}async copyAjaxConfigFiles(e){try{const s=["config.ts","error-message.ts","fetch.ts","api-type.d.ts"],a=u.default.join(__dirname,"..","..","ajax-config"),r=e;for(const e of s){const s=u.default.join(a,e),o=u.default.join(r,e);try{await l.default.promises.access(s);try{await l.default.promises.access(o),t.log.info(`${e} 已存在,跳过生成.`)}catch{await l.default.promises.copyFile(s,o),t.log.success(`${e} create done.`)}}catch(e){t.log.error(`源文件 ${s} 不存在`);continue}}}catch(e){return e}}async initialize(){const e=process.cwd()+"/an.config.json";try{const s=await this.getConfig(e);if(!d)return;await l.default.promises.mkdir(s.saveApiListFolderPath,{recursive:!0}),await this.copyAjaxConfigFiles(s.saveApiListFolderPath),await t.clearDir(s.saveTypeFolderPath),await t.clearDir(s.saveEnumFolderPath),await this.handle(s),await this.formatGeneratedFiles(s)}catch(e){const s=e instanceof Error?e.message:"未知错误";t.log.error(`初始化失败: ${s}`)}}async getConfig(e){try{const t=await l.default.promises.readFile(e,"utf8");return d=!0,JSON.parse(t)}catch(s){return d=!1,t.log.warning("配置文件不存在,将自动创建配置文件。"),await t.writeFileRecursive(e,JSON.stringify(f,null,2)),t.log.success("请查看项目根目录下的 an.config.json 文件"),f}}}if("development"===process.env.NODE_ENV){(new w).initialize()}exports.Main=w;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs"),t=require("../utils/index.js"),s=require("./core/components.js"),a=require("./core/get-data.js"),r=require("./core/path.js"),o=require("shelljs"),i=require("chalk"),n=require("path");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(e),p=c(i),h=c(n);let d;const u="development"===process.env.NODE_ENV,f={saveTypeFolderPath:u?"apps/types":"src/api/types",saveApiListFolderPath:u?"apps/types":"src/api",saveEnumFolderPath:u?"apps/types/enums":"src/enums",importEnumPath:"../../../enums",requestMethodsImportPath:"./fetch",dataLevel:"serve",swaggerJsonUrl:"https://generator3.swagger.io/openapi.json",headers:{},formatting:{indentation:"\t",lineEnding:"\n"}};class g{schemas={};paths={};async handle(e){try{let t;if(t="development"===process.env.NODE_ENV?(await Promise.resolve().then((function(){return require("../../data/open-api.json.js")}))).default:await a.getSwaggerJson(e),!t)throw new Error("无法获取 Swagger 数据");this.schemas=t.components?.schemas||{},this.paths=t.paths||{};const o=new s.default(this.schemas,e),i=new r.PathParse(this.paths,t.components?.parameters,e);return await Promise.all([o.handle(),i.handle()]),!0}catch(e){if(e instanceof Error)throw new Error(`处理 Swagger 数据失败: ${e.message}`);throw new Error("处理 Swagger 数据失败: 未知错误")}}async formatGeneratedFiles(e){const s=`npx prettier --write "${e.saveTypeFolderPath}/**/*.{ts,d.ts}"`;try{await l.default.promises.access(e.saveTypeFolderPath);const{stderr:a}=await new Promise(((e,t)=>{o.exec(s,((s,a,r)=>{s?t(s):e({stdout:a,stderr:r})}))}));if(a)throw new Error(a);t.log.success("文件格式化成功")}catch(e){console.log(""),t.log.error("格式化失败,请手动执行以下命令:"),console.log("$",p.default.yellow(s)),console.log("")}}async copyAjaxConfigFiles(e){try{const s=["config.ts","error-message.ts","fetch.ts","api-type.d.ts"],a=h.default.join(__dirname,"..","..","ajax-config"),r=e;for(const e of s){const s=h.default.join(a,e),o=h.default.join(r,e);try{await l.default.promises.access(s);try{await l.default.promises.access(o),t.log.info(`${e} 已存在,跳过生成.`)}catch{await l.default.promises.copyFile(s,o),t.log.success(`${e} create done.`)}}catch(e){t.log.error(`源文件 ${s} 不存在`);continue}}}catch(e){return e}}async initialize(){const e=process.cwd()+"/an.config.json";try{const s=await this.getConfig(e);if(!d)return;await l.default.promises.mkdir(s.saveApiListFolderPath,{recursive:!0}),await this.copyAjaxConfigFiles(s.saveApiListFolderPath),await t.clearDir(s.saveTypeFolderPath),await t.clearDir(s.saveEnumFolderPath),await this.handle(s),await this.formatGeneratedFiles(s)}catch(e){const s=e instanceof Error?e.message:"未知错误";t.log.error(`初始化失败: ${s}`)}}async getConfig(e){try{const t=await l.default.promises.readFile(e,"utf8");return d=!0,JSON.parse(t)}catch(s){return d=!1,t.log.warning("配置文件不存在,将自动创建配置文件。"),await t.writeFileRecursive(e,JSON.stringify(f,null,2)),t.log.success("请查看项目根目录下的 an.config.json 文件"),f}}}if("development"===process.env.NODE_ENV){(new g).initialize()}exports.Main=g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anl",
3
- "version": "1.5.13",
3
+ "version": "1.5.15",
4
4
  "description": "FE command line tool",
5
5
  "main": "bin/an-cli.js",
6
6
  "scripts": {