wanzhuang-cli 1.0.0
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/.gitattributes +41 -0
- package/README.md +113 -0
- package/dist/commands/create.d.ts +10 -0
- package/dist/commands/create.js +145 -0
- package/dist/commands/generate.d.ts +8 -0
- package/dist/commands/generate.js +26 -0
- package/dist/commands/update.d.ts +6 -0
- package/dist/commands/update.js +26 -0
- package/dist/createApiTest/displayEnumLabel.d.ts +3 -0
- package/dist/createApiTest/displayEnumLabel.js +10 -0
- package/dist/createApiTest/displayTypeLabel.d.ts +19 -0
- package/dist/createApiTest/displayTypeLabel.js +135 -0
- package/dist/createApiTest/index.d.ts +6 -0
- package/dist/createApiTest/index.js +24 -0
- package/dist/createApiTest/pet.d.ts +58 -0
- package/dist/createApiTest/pet.js +102 -0
- package/dist/createApiTest/store.d.ts +28 -0
- package/dist/createApiTest/store.js +48 -0
- package/dist/createApiTest/types.d.ts +110 -0
- package/dist/createApiTest/types.js +17 -0
- package/dist/createApiTest/user.d.ts +50 -0
- package/dist/createApiTest/user.js +85 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +52 -0
- package/dist/utils/api.d.ts +1 -0
- package/dist/utils/api.js +48 -0
- package/dist/utils/configGen.d.ts +28 -0
- package/dist/utils/configGen.js +178 -0
- package/dist/utils/deps.d.ts +13 -0
- package/dist/utils/deps.js +47 -0
- package/dist/utils/fileOps.d.ts +29 -0
- package/dist/utils/fileOps.js +124 -0
- package/dist/utils/template.d.ts +12 -0
- package/dist/utils/template.js +31 -0
- package/package.json +44 -0
- package/src/commands/create.ts +141 -0
- package/src/commands/generate.ts +23 -0
- package/src/commands/update.ts +22 -0
- package/src/createApiTest/displayEnumLabel.ts +13 -0
- package/src/createApiTest/displayTypeLabel.ts +160 -0
- package/src/createApiTest/index.ts +10 -0
- package/src/createApiTest/pet.ts +159 -0
- package/src/createApiTest/store.ts +71 -0
- package/src/createApiTest/types.ts +134 -0
- package/src/createApiTest/user.ts +131 -0
- package/src/index.ts +54 -0
- package/src/utils/api.ts +47 -0
- package/src/utils/configGen.ts +139 -0
- package/src/utils/deps.ts +40 -0
- package/src/utils/fileOps.ts +86 -0
- package/src/utils/template.ts +32 -0
- package/templates/react/README.md +12 -0
- package/templates/react/eslint.config.js +33 -0
- package/templates/react/index.html +13 -0
- package/templates/react/package.json +27 -0
- package/templates/react/public/vite.svg +1 -0
- package/templates/react/src/App.css +42 -0
- package/templates/react/src/App.jsx +35 -0
- package/templates/react/src/assets/react.svg +1 -0
- package/templates/react/src/index.css +68 -0
- package/templates/react/src/main.jsx +10 -0
- package/templates/react/vite.config.js +7 -0
- package/templates/uniapp/index.html +20 -0
- package/templates/uniapp/package.json +67 -0
- package/templates/uniapp/shims-uni.d.ts +10 -0
- package/templates/uniapp/src/App.vue +17 -0
- package/templates/uniapp/src/main.js +10 -0
- package/templates/uniapp/src/manifest.json +72 -0
- package/templates/uniapp/src/pages/index/index.vue +48 -0
- package/templates/uniapp/src/pages.json +16 -0
- package/templates/uniapp/src/shime-uni.d.ts +6 -0
- package/templates/uniapp/src/static/logo.png +0 -0
- package/templates/uniapp/src/uni.scss +76 -0
- package/templates/uniapp/vite.config.js +8 -0
- package/templates/vue/.vscode/extensions.json +3 -0
- package/templates/vue/README.md +5 -0
- package/templates/vue/index.html +13 -0
- package/templates/vue/package.json +18 -0
- package/templates/vue/public/vite.svg +1 -0
- package/templates/vue/src/App.vue +30 -0
- package/templates/vue/src/assets/vue.svg +1 -0
- package/templates/vue/src/components/HelloWorld.vue +43 -0
- package/templates/vue/src/main.js +5 -0
- package/templates/vue/src/style.css +79 -0
- package/templates/vue/vite.config.js +7 -0
- package/tsconfig.json +19 -0
- package/vitest.config.ts +8 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 设置默认行为
|
|
2
|
+
* text=auto
|
|
3
|
+
|
|
4
|
+
# 源代码文件
|
|
5
|
+
*.ts text diff=typescript
|
|
6
|
+
*.js text diff=javascript
|
|
7
|
+
*.json text
|
|
8
|
+
*.md text
|
|
9
|
+
*.yml text
|
|
10
|
+
*.yaml text
|
|
11
|
+
*.html text
|
|
12
|
+
*.css text
|
|
13
|
+
*.scss text
|
|
14
|
+
*.less text
|
|
15
|
+
|
|
16
|
+
# 二进制文件
|
|
17
|
+
*.png binary
|
|
18
|
+
*.jpg binary
|
|
19
|
+
*.gif binary
|
|
20
|
+
*.ico binary
|
|
21
|
+
*.ttf binary
|
|
22
|
+
*.woff binary
|
|
23
|
+
*.woff2 binary
|
|
24
|
+
*.eot binary
|
|
25
|
+
*.pdf binary
|
|
26
|
+
|
|
27
|
+
# 行尾处理
|
|
28
|
+
*.ts eol=lf
|
|
29
|
+
*.js eol=lf
|
|
30
|
+
*.json eol=lf
|
|
31
|
+
*.md eol=lf
|
|
32
|
+
*.yml eol=lf
|
|
33
|
+
*.yaml eol=lf
|
|
34
|
+
*.html eol=lf
|
|
35
|
+
*.css eol=lf
|
|
36
|
+
*.scss eol=lf
|
|
37
|
+
*.less eol=lf
|
|
38
|
+
|
|
39
|
+
# 导出忽略
|
|
40
|
+
.gitattributes export-ignore
|
|
41
|
+
.gitignore export-ignore
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# wzcli
|
|
2
|
+
|
|
3
|
+
一个简单易用的前端项目脚手架工具,支持 React、Vue、UniApp 项目模板。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 快速创建 React/Vue/UniApp 项目
|
|
8
|
+
- 基于 Vite 构建,开发体验极佳
|
|
9
|
+
- TypeScript 支持
|
|
10
|
+
- ESLint 代码规范
|
|
11
|
+
- API 生成器(基于 Swagger/OpenAPI)
|
|
12
|
+
- 一键更新项目依赖
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# 使用 pnpm 安装(推荐)
|
|
18
|
+
pnpm add -g wzcli
|
|
19
|
+
|
|
20
|
+
# 或使用 npm 安装
|
|
21
|
+
npm install -g wzcli
|
|
22
|
+
|
|
23
|
+
# 或使用 yarn 安装
|
|
24
|
+
yarn global add wzcli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 使用指南
|
|
28
|
+
|
|
29
|
+
### 创建项目
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 创建项目
|
|
33
|
+
wz create my-project
|
|
34
|
+
|
|
35
|
+
# 指定模板类型
|
|
36
|
+
wz create my-project -t vue
|
|
37
|
+
wz create my-project -t react
|
|
38
|
+
wz create my-project -t uniapp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 生成 API
|
|
42
|
+
|
|
43
|
+
基于 Swagger/OpenAPI 规范自动生成 TypeScript API 代码:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 默认生成到 src/api 目录
|
|
47
|
+
wz api https://api.example.com/swagger.json
|
|
48
|
+
|
|
49
|
+
# 指定输出目录
|
|
50
|
+
wz api https://api.example.com/swagger.json -o ./src/services
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
生成的 API 包含:
|
|
54
|
+
|
|
55
|
+
- TypeScript 类型定义
|
|
56
|
+
- 请求函数
|
|
57
|
+
- 参数验证
|
|
58
|
+
|
|
59
|
+
### 更新依赖
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
wz update
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 项目模板
|
|
66
|
+
|
|
67
|
+
### React 模板
|
|
68
|
+
|
|
69
|
+
| 技术栈 | 版本 |
|
|
70
|
+
| ------ | ------- |
|
|
71
|
+
| React | ^19.1.0 |
|
|
72
|
+
| Vite | ^6.3.5 |
|
|
73
|
+
|
|
74
|
+
### Vue 模板
|
|
75
|
+
|
|
76
|
+
| 技术栈 | 版本 |
|
|
77
|
+
| ------ | ------- |
|
|
78
|
+
| Vue | ^3.5.13 |
|
|
79
|
+
| Vite | ^6.3.5 |
|
|
80
|
+
|
|
81
|
+
### UniApp 模板
|
|
82
|
+
|
|
83
|
+
跨平台开发框架,支持编译到多端:
|
|
84
|
+
|
|
85
|
+
| 技术栈 | 版本 |
|
|
86
|
+
| ------ | ------- |
|
|
87
|
+
| Vue | ^3.4.21 |
|
|
88
|
+
| Vite | 5.2.8 |
|
|
89
|
+
|
|
90
|
+
支持平台:
|
|
91
|
+
|
|
92
|
+
| 平台 | 命令 |
|
|
93
|
+
| ------------ | -------------------- |
|
|
94
|
+
| H5 | `pnpm dev:h5` |
|
|
95
|
+
| 微信小程序 | `pnpm dev:mp-weixin` |
|
|
96
|
+
| 支付宝小程序 | `pnpm dev:mp-alipay` |
|
|
97
|
+
|
|
98
|
+
## 命令一览
|
|
99
|
+
|
|
100
|
+
| 命令 | 说明 | 选项 |
|
|
101
|
+
| ------------------ | ---------- | --------------------------------------------------- |
|
|
102
|
+
| `wz create <name>` | 创建新项目 | `-t, --template` 模板类型<br>`-f, --force` 强制覆盖 |
|
|
103
|
+
| `wz api <url>` | 生成 API | `-o, --output` 输出目录 |
|
|
104
|
+
| `wz update` | 更新依赖 | - |
|
|
105
|
+
|
|
106
|
+
## 环境要求
|
|
107
|
+
|
|
108
|
+
| 项目 | Node.js 版本 |
|
|
109
|
+
| ----------- | ------------ |
|
|
110
|
+
| CLI 工具 | >= 14.0.0 |
|
|
111
|
+
| React 模板 | >= 18.0.0 |
|
|
112
|
+
| Vue 模板 | >= 18.0.0 |
|
|
113
|
+
| UniApp 模板 | >= 18.0.0 |
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createProject = createProject;
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
const ora_1 = __importDefault(require("ora"));
|
|
13
|
+
const template_1 = require("../utils/template");
|
|
14
|
+
const fs_extra_1 = require("fs-extra");
|
|
15
|
+
const fileOps_1 = require("../utils/fileOps");
|
|
16
|
+
const configGen_1 = require("../utils/configGen");
|
|
17
|
+
const deps_1 = require("../utils/deps");
|
|
18
|
+
/**
|
|
19
|
+
* 创建新项目的主函数
|
|
20
|
+
* 1. 交互选择模板和功能
|
|
21
|
+
* 2. 复制模板
|
|
22
|
+
* 3. 自动类型/配置/依赖集成
|
|
23
|
+
* 4. 安装依赖并输出提示
|
|
24
|
+
*/
|
|
25
|
+
async function createProject(projectName, options) {
|
|
26
|
+
// 目标目录
|
|
27
|
+
const targetDir = (0, path_1.join)(process.cwd(), projectName);
|
|
28
|
+
// 1. 检查目标目录是否已存在,处理覆盖逻辑
|
|
29
|
+
if ((0, fs_1.existsSync)(targetDir)) {
|
|
30
|
+
if (options.force) {
|
|
31
|
+
console.log(chalk_1.default.yellow(`正在删除目录: ${targetDir}`));
|
|
32
|
+
(0, fs_extra_1.removeSync)(targetDir);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const { action } = await inquirer_1.default.prompt([
|
|
36
|
+
{
|
|
37
|
+
name: 'action',
|
|
38
|
+
type: 'list',
|
|
39
|
+
message: '目标目录已存在,请选择操作:',
|
|
40
|
+
choices: [
|
|
41
|
+
{ name: '覆盖', value: 'overwrite' },
|
|
42
|
+
{ name: '取消', value: false },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
if (!action)
|
|
47
|
+
return;
|
|
48
|
+
if (action === 'overwrite') {
|
|
49
|
+
console.log(chalk_1.default.yellow(`正在删除目录: ${targetDir}`));
|
|
50
|
+
(0, fs_extra_1.removeSync)(targetDir);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// 2. 创建新目录
|
|
55
|
+
(0, fs_1.mkdirSync)(targetDir, { recursive: true });
|
|
56
|
+
// 3. 交互选择模板
|
|
57
|
+
const { template } = await inquirer_1.default.prompt([
|
|
58
|
+
{
|
|
59
|
+
name: 'template',
|
|
60
|
+
type: 'list',
|
|
61
|
+
message: '请选择项目模板:',
|
|
62
|
+
choices: [
|
|
63
|
+
{ name: 'React', value: 'react' },
|
|
64
|
+
{ name: 'Vue', value: 'vue' },
|
|
65
|
+
{ name: 'UniApp', value: 'uniapp' },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
// 4. 交互多选功能
|
|
70
|
+
const { features } = await inquirer_1.default.prompt([
|
|
71
|
+
{
|
|
72
|
+
name: 'features',
|
|
73
|
+
type: 'checkbox',
|
|
74
|
+
message: '请选择要包含的功能:',
|
|
75
|
+
choices: [
|
|
76
|
+
{ name: 'TypeScript', value: 'typescript' },
|
|
77
|
+
{ name: 'Prettier', value: 'prettier' },
|
|
78
|
+
{ name: 'ESLint', value: 'eslint' },
|
|
79
|
+
{ name: 'UnoCSS', value: 'unocss' },
|
|
80
|
+
{ name: 'Tailwind CSS', value: 'tailwindcss' },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
]);
|
|
84
|
+
console.log(chalk_1.default.cyan('已选择功能:'), features);
|
|
85
|
+
// 5. 复制模板到目标目录
|
|
86
|
+
await (0, template_1.copyTemplate)(template, targetDir);
|
|
87
|
+
// 6. 类型/文件自动转换(React: jsx->tsx,Vue/UniApp: js->ts + vue lang="ts")
|
|
88
|
+
const srcDir = (0, path_1.join)(targetDir, 'src');
|
|
89
|
+
if (features.includes('typescript')) {
|
|
90
|
+
if (template === 'react' && (0, fs_1.existsSync)(srcDir)) {
|
|
91
|
+
(0, fileOps_1.convertExtRecursive)(srcDir, '.jsx', '.tsx');
|
|
92
|
+
(0, fileOps_1.replaceImportExtRecursive)(srcDir, '.jsx', '.tsx');
|
|
93
|
+
}
|
|
94
|
+
if ((template === 'vue' || template === 'uniapp') && (0, fs_1.existsSync)(srcDir)) {
|
|
95
|
+
(0, fileOps_1.convertExtRecursive)(srcDir, '.js', '.ts');
|
|
96
|
+
(0, fileOps_1.replaceImportExtRecursive)(srcDir, '.js', '.ts');
|
|
97
|
+
(0, fileOps_1.addLangTsToAllVue)(srcDir);
|
|
98
|
+
}
|
|
99
|
+
// 新增:根目录 vite.config.js -> vite.config.ts
|
|
100
|
+
(0, fileOps_1.convertViteConfigToTs)(targetDir);
|
|
101
|
+
(0, configGen_1.genTsConfig)(targetDir, template);
|
|
102
|
+
}
|
|
103
|
+
// 7. 配置文件自动生成
|
|
104
|
+
if (features.includes('eslint'))
|
|
105
|
+
(0, configGen_1.genEslintConfig)(targetDir, template, features);
|
|
106
|
+
if (features.includes('prettier'))
|
|
107
|
+
(0, configGen_1.genPrettierConfig)(targetDir);
|
|
108
|
+
if (features.includes('unocss'))
|
|
109
|
+
(0, configGen_1.genUnoConfig)(targetDir);
|
|
110
|
+
if (features.includes('tailwindcss'))
|
|
111
|
+
(0, configGen_1.genTailwindConfig)(targetDir);
|
|
112
|
+
// 8. 安装开发依赖
|
|
113
|
+
const devDeps = (0, deps_1.getDevDeps)(template, features);
|
|
114
|
+
(0, deps_1.installDevDeps)(targetDir, devDeps);
|
|
115
|
+
// 9. 进度提示与最终依赖安装
|
|
116
|
+
const spinner = (0, ora_1.default)('正在创建项目...').start();
|
|
117
|
+
try {
|
|
118
|
+
// 更新 package.json
|
|
119
|
+
await (0, template_1.updatePackageJson)(targetDir, projectName);
|
|
120
|
+
// 安装依赖
|
|
121
|
+
spinner.text = '正在安装依赖...';
|
|
122
|
+
(0, child_process_1.execSync)('pnpm install', { cwd: targetDir, stdio: 'inherit' });
|
|
123
|
+
spinner.succeed(chalk_1.default.green('项目创建成功!'));
|
|
124
|
+
// 使用说明
|
|
125
|
+
if (template === 'uniapp') {
|
|
126
|
+
console.log('\n开始使用:');
|
|
127
|
+
console.log(` cd ${projectName}`);
|
|
128
|
+
console.log(' # 推荐用 HBuilderX 打开项目,或使用 dcloud 官方 CLI');
|
|
129
|
+
console.log(' # 例如:');
|
|
130
|
+
console.log(' pnpm build:alipay # 打包支付宝小程序');
|
|
131
|
+
console.log(' pnpm dev:alipay # 运行支付宝小程序');
|
|
132
|
+
console.log(' pnpm build:mp-weixin # 打包微信小程序');
|
|
133
|
+
console.log(' pnpm dev:mp-weixin # 运行微信小程序');
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
console.log('\n开始使用:');
|
|
137
|
+
console.log(` cd ${projectName}`);
|
|
138
|
+
console.log(' pnpm dev');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
spinner.fail(chalk_1.default.red('项目创建失败!'));
|
|
143
|
+
console.error(error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateApi = generateApi;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const api_1 = require("../utils/api");
|
|
10
|
+
/**
|
|
11
|
+
* 生成 API 的函数
|
|
12
|
+
* @param url - API 文档的 URL 地址
|
|
13
|
+
* @param options - 配置选项,包含输出目录
|
|
14
|
+
*/
|
|
15
|
+
async function generateApi(url, options) {
|
|
16
|
+
const spinner = (0, ora_1.default)('正在生成 API...').start();
|
|
17
|
+
try {
|
|
18
|
+
// 调用 API 生成工具函数
|
|
19
|
+
await (0, api_1.generateApi)(url, options.output);
|
|
20
|
+
spinner.succeed(chalk_1.default.green('API 生成成功!'));
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
spinner.fail(chalk_1.default.red('API 生成失败!'));
|
|
24
|
+
console.error(error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.updateDeps = updateDeps;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
/**
|
|
11
|
+
* 更新项目依赖的函数
|
|
12
|
+
* 使用 pnpm update 命令更新所有依赖包到最新版本
|
|
13
|
+
* 如果更新失败会显示错误信息
|
|
14
|
+
*/
|
|
15
|
+
async function updateDeps() {
|
|
16
|
+
const spinner = (0, ora_1.default)('正在更新依赖...').start();
|
|
17
|
+
try {
|
|
18
|
+
// 执行 pnpm update 命令更新依赖
|
|
19
|
+
(0, child_process_1.execSync)('pnpm update', { stdio: 'inherit' });
|
|
20
|
+
spinner.succeed(chalk_1.default.green('依赖更新成功!'));
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
spinner.fail(chalk_1.default.red('依赖更新失败!'));
|
|
24
|
+
console.error(error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayStatusEnum = displayStatusEnum;
|
|
4
|
+
exports.displayStatusEnum2 = displayStatusEnum2;
|
|
5
|
+
function displayStatusEnum(field) {
|
|
6
|
+
return { placed: 'placed', approved: 'approved', delivered: 'delivered' }[field];
|
|
7
|
+
}
|
|
8
|
+
function displayStatusEnum2(field) {
|
|
9
|
+
return { available: 'available', pending: 'pending', sold: 'sold' }[field];
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as API from './types';
|
|
2
|
+
export declare function displayApiResponse(field: keyof API.ApiResponse): string;
|
|
3
|
+
export declare function displayCategory(field: keyof API.Category): string;
|
|
4
|
+
export declare function displayOrder(field: keyof API.Order): string;
|
|
5
|
+
export declare function displayPet(field: keyof API.Pet): string;
|
|
6
|
+
export declare function displaypetFindByStatusUsingGetParams(field: keyof API.petFindByStatusUsingGetParams): string;
|
|
7
|
+
export declare function displaypetFindByTagsUsingGetParams(field: keyof API.petFindByTagsUsingGetParams): string;
|
|
8
|
+
export declare function displaypetPetIdUploadImageUsingPostParams(field: keyof API.petPetIdUploadImageUsingPostParams): string;
|
|
9
|
+
export declare function displaypetPetIdUsingDeleteParams(field: keyof API.petPetIdUsingDeleteParams): string;
|
|
10
|
+
export declare function displaypetPetIdUsingGetParams(field: keyof API.petPetIdUsingGetParams): string;
|
|
11
|
+
export declare function displaypetPetIdUsingPostParams(field: keyof API.petPetIdUsingPostParams): string;
|
|
12
|
+
export declare function displaystoreOrderOrderIdUsingDeleteParams(field: keyof API.storeOrderOrderIdUsingDeleteParams): string;
|
|
13
|
+
export declare function displaystoreOrderOrderIdUsingGetParams(field: keyof API.storeOrderOrderIdUsingGetParams): string;
|
|
14
|
+
export declare function displayTag(field: keyof API.Tag): string;
|
|
15
|
+
export declare function displayUser(field: keyof API.User): string;
|
|
16
|
+
export declare function displayuserLoginUsingGetParams(field: keyof API.userLoginUsingGetParams): string;
|
|
17
|
+
export declare function displayuserUsernameUsingDeleteParams(field: keyof API.userUsernameUsingDeleteParams): string;
|
|
18
|
+
export declare function displayuserUsernameUsingGetParams(field: keyof API.userUsernameUsingGetParams): string;
|
|
19
|
+
export declare function displayuserUsernameUsingPutParams(field: keyof API.userUsernameUsingPutParams): string;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayApiResponse = displayApiResponse;
|
|
4
|
+
exports.displayCategory = displayCategory;
|
|
5
|
+
exports.displayOrder = displayOrder;
|
|
6
|
+
exports.displayPet = displayPet;
|
|
7
|
+
exports.displaypetFindByStatusUsingGetParams = displaypetFindByStatusUsingGetParams;
|
|
8
|
+
exports.displaypetFindByTagsUsingGetParams = displaypetFindByTagsUsingGetParams;
|
|
9
|
+
exports.displaypetPetIdUploadImageUsingPostParams = displaypetPetIdUploadImageUsingPostParams;
|
|
10
|
+
exports.displaypetPetIdUsingDeleteParams = displaypetPetIdUsingDeleteParams;
|
|
11
|
+
exports.displaypetPetIdUsingGetParams = displaypetPetIdUsingGetParams;
|
|
12
|
+
exports.displaypetPetIdUsingPostParams = displaypetPetIdUsingPostParams;
|
|
13
|
+
exports.displaystoreOrderOrderIdUsingDeleteParams = displaystoreOrderOrderIdUsingDeleteParams;
|
|
14
|
+
exports.displaystoreOrderOrderIdUsingGetParams = displaystoreOrderOrderIdUsingGetParams;
|
|
15
|
+
exports.displayTag = displayTag;
|
|
16
|
+
exports.displayUser = displayUser;
|
|
17
|
+
exports.displayuserLoginUsingGetParams = displayuserLoginUsingGetParams;
|
|
18
|
+
exports.displayuserUsernameUsingDeleteParams = displayuserUsernameUsingDeleteParams;
|
|
19
|
+
exports.displayuserUsernameUsingGetParams = displayuserUsernameUsingGetParams;
|
|
20
|
+
exports.displayuserUsernameUsingPutParams = displayuserUsernameUsingPutParams;
|
|
21
|
+
function displayApiResponse(field) {
|
|
22
|
+
return {
|
|
23
|
+
code: 'code',
|
|
24
|
+
type: 'type',
|
|
25
|
+
message: 'message',
|
|
26
|
+
}[field];
|
|
27
|
+
}
|
|
28
|
+
function displayCategory(field) {
|
|
29
|
+
return {
|
|
30
|
+
id: 'id',
|
|
31
|
+
name: 'name',
|
|
32
|
+
}[field];
|
|
33
|
+
}
|
|
34
|
+
function displayOrder(field) {
|
|
35
|
+
return {
|
|
36
|
+
id: 'id',
|
|
37
|
+
petId: 'petId',
|
|
38
|
+
quantity: 'quantity',
|
|
39
|
+
shipDate: 'shipDate',
|
|
40
|
+
status: 'Order Status',
|
|
41
|
+
complete: 'complete',
|
|
42
|
+
}[field];
|
|
43
|
+
}
|
|
44
|
+
function displayPet(field) {
|
|
45
|
+
return {
|
|
46
|
+
id: 'id',
|
|
47
|
+
name: 'name',
|
|
48
|
+
category: 'category',
|
|
49
|
+
photoUrls: 'photoUrls',
|
|
50
|
+
tags: 'tags',
|
|
51
|
+
status: 'pet status in the store',
|
|
52
|
+
}[field];
|
|
53
|
+
}
|
|
54
|
+
function displaypetFindByStatusUsingGetParams(field) {
|
|
55
|
+
return {
|
|
56
|
+
status: 'Status values that need to be considered for filter',
|
|
57
|
+
}[field];
|
|
58
|
+
}
|
|
59
|
+
function displaypetFindByTagsUsingGetParams(field) {
|
|
60
|
+
return {
|
|
61
|
+
tags: 'Tags to filter by',
|
|
62
|
+
}[field];
|
|
63
|
+
}
|
|
64
|
+
function displaypetPetIdUploadImageUsingPostParams(field) {
|
|
65
|
+
return {
|
|
66
|
+
petId: 'ID of pet to update',
|
|
67
|
+
additionalMetadata: 'Additional Metadata',
|
|
68
|
+
}[field];
|
|
69
|
+
}
|
|
70
|
+
function displaypetPetIdUsingDeleteParams(field) {
|
|
71
|
+
return {
|
|
72
|
+
petId: 'Pet id to delete',
|
|
73
|
+
}[field];
|
|
74
|
+
}
|
|
75
|
+
function displaypetPetIdUsingGetParams(field) {
|
|
76
|
+
return {
|
|
77
|
+
petId: 'ID of pet to return',
|
|
78
|
+
}[field];
|
|
79
|
+
}
|
|
80
|
+
function displaypetPetIdUsingPostParams(field) {
|
|
81
|
+
return {
|
|
82
|
+
petId: 'ID of pet that needs to be updated',
|
|
83
|
+
name: 'Name of pet that needs to be updated',
|
|
84
|
+
status: 'Status of pet that needs to be updated',
|
|
85
|
+
}[field];
|
|
86
|
+
}
|
|
87
|
+
function displaystoreOrderOrderIdUsingDeleteParams(field) {
|
|
88
|
+
return {
|
|
89
|
+
orderId: 'ID of the order that needs to be deleted',
|
|
90
|
+
}[field];
|
|
91
|
+
}
|
|
92
|
+
function displaystoreOrderOrderIdUsingGetParams(field) {
|
|
93
|
+
return {
|
|
94
|
+
orderId: 'ID of order that needs to be fetched',
|
|
95
|
+
}[field];
|
|
96
|
+
}
|
|
97
|
+
function displayTag(field) {
|
|
98
|
+
return {
|
|
99
|
+
id: 'id',
|
|
100
|
+
name: 'name',
|
|
101
|
+
}[field];
|
|
102
|
+
}
|
|
103
|
+
function displayUser(field) {
|
|
104
|
+
return {
|
|
105
|
+
id: 'id',
|
|
106
|
+
username: 'username',
|
|
107
|
+
firstName: 'firstName',
|
|
108
|
+
lastName: 'lastName',
|
|
109
|
+
email: 'email',
|
|
110
|
+
password: 'password',
|
|
111
|
+
phone: 'phone',
|
|
112
|
+
userStatus: 'User Status',
|
|
113
|
+
}[field];
|
|
114
|
+
}
|
|
115
|
+
function displayuserLoginUsingGetParams(field) {
|
|
116
|
+
return {
|
|
117
|
+
username: 'The user name for login',
|
|
118
|
+
password: 'The password for login in clear text',
|
|
119
|
+
}[field];
|
|
120
|
+
}
|
|
121
|
+
function displayuserUsernameUsingDeleteParams(field) {
|
|
122
|
+
return {
|
|
123
|
+
username: 'The name that needs to be deleted',
|
|
124
|
+
}[field];
|
|
125
|
+
}
|
|
126
|
+
function displayuserUsernameUsingGetParams(field) {
|
|
127
|
+
return {
|
|
128
|
+
username: 'The name that needs to be fetched. Use user1 for testing',
|
|
129
|
+
}[field];
|
|
130
|
+
}
|
|
131
|
+
function displayuserUsernameUsingPutParams(field) {
|
|
132
|
+
return {
|
|
133
|
+
username: 'name that need to be deleted',
|
|
134
|
+
}[field];
|
|
135
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/* eslint-disable */
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./displayEnumLabel"), exports);
|
|
21
|
+
__exportStar(require("./displayTypeLabel"), exports);
|
|
22
|
+
__exportStar(require("./pet"), exports);
|
|
23
|
+
__exportStar(require("./store"), exports);
|
|
24
|
+
__exportStar(require("./user"), exports);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as API from './types';
|
|
2
|
+
/** Update an existing pet. Update an existing pet by Id. 返回值: Unexpected error PUT /pet */
|
|
3
|
+
export declare function petUsingPut({ body, options, }: {
|
|
4
|
+
body: API.Pet;
|
|
5
|
+
options?: {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
/** Add a new pet to the store. Add a new pet to the store. 返回值: Unexpected error POST /pet */
|
|
10
|
+
export declare function petUsingPost({ body, options, }: {
|
|
11
|
+
body: API.Pet;
|
|
12
|
+
options?: {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
}): Promise<any>;
|
|
16
|
+
/** Find pet by ID. Returns a single pet. 返回值: Unexpected error GET /pet/${param0} */
|
|
17
|
+
export declare function petPetIdUsingGet({ params, options, }: {
|
|
18
|
+
params: API.petPetIdUsingGetParams;
|
|
19
|
+
options?: {
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
/** Updates a pet in the store with form data. Updates a pet resource based on the form data. 返回值: Unexpected error POST /pet/${param0} */
|
|
24
|
+
export declare function petPetIdUsingPost({ params, options, }: {
|
|
25
|
+
params: API.petPetIdUsingPostParams;
|
|
26
|
+
options?: {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
/** Deletes a pet. Delete a pet. 返回值: Unexpected error DELETE /pet/${param0} */
|
|
31
|
+
export declare function petPetIdUsingDelete({ params, options, }: {
|
|
32
|
+
params: API.petPetIdUsingDeleteParams;
|
|
33
|
+
options?: {
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
}): Promise<any>;
|
|
37
|
+
/** Uploads an image. Upload image of the pet. 返回值: Unexpected error POST /pet/${param0}/uploadImage */
|
|
38
|
+
export declare function petPetIdUploadImageUsingPost({ params, body, options, }: {
|
|
39
|
+
params: API.petPetIdUploadImageUsingPostParams;
|
|
40
|
+
body: string;
|
|
41
|
+
options?: {
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
};
|
|
44
|
+
}): Promise<any>;
|
|
45
|
+
/** Finds Pets by status. Multiple status values can be provided with comma separated strings. 返回值: Unexpected error GET /pet/findByStatus */
|
|
46
|
+
export declare function petFindByStatusUsingGet({ params, options, }: {
|
|
47
|
+
params: API.petFindByStatusUsingGetParams;
|
|
48
|
+
options?: {
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
};
|
|
51
|
+
}): Promise<any>;
|
|
52
|
+
/** Finds Pets by tags. Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 返回值: Unexpected error GET /pet/findByTags */
|
|
53
|
+
export declare function petFindByTagsUsingGet({ params, options, }: {
|
|
54
|
+
params: API.petFindByTagsUsingGetParams;
|
|
55
|
+
options?: {
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
};
|
|
58
|
+
}): Promise<any>;
|