sks-maximo-utils 1.1.7 → 1.1.8
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.md +38 -9
- package/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Maximo 表结构和数据更新工具集。
|
|
|
14
14
|
|
|
15
15
|
### 全局安装(CLI 使用)
|
|
16
16
|
```bash
|
|
17
|
-
npm install -g
|
|
17
|
+
npm install -g sks-maximo-utils
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
### 项目中安装(引用使用)
|
|
@@ -26,18 +26,39 @@ npm install sks-maximo-utils
|
|
|
26
26
|
|
|
27
27
|
### CLI 命令
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
不带参数运行,检查配置并打开配置目录:
|
|
30
30
|
```bash
|
|
31
31
|
sks-maximo
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
导入命令通用格式:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
sks-maximo <import-command> <fileName> [env] [--logname <name>]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
环境既可以用位置参数,也可以用 `-e` / `--env` 指定,两者等价:
|
|
41
|
+
|
|
35
42
|
```bash
|
|
36
|
-
sks-maximo
|
|
37
|
-
sks-maximo
|
|
38
|
-
sks-maximo hd # 使用 hd 环境配置
|
|
43
|
+
sks-maximo import-presentation LIBRARY_EN.xml prod_en
|
|
44
|
+
sks-maximo import-presentation LIBRARY_EN.xml -e prod_en
|
|
39
45
|
```
|
|
40
46
|
|
|
47
|
+
导入命令:
|
|
48
|
+
|
|
49
|
+
| 命令 | 说明 |
|
|
50
|
+
|------|------|
|
|
51
|
+
| `sks-maximo import-object <fileName>` | 导入 Maximo 对象配置 |
|
|
52
|
+
| `sks-maximo import-appinfo <fileName>` | 导入应用信息配置 |
|
|
53
|
+
| `sks-maximo import-presentation <fileName>` | 导入应用 XML 配置 |
|
|
54
|
+
| `sks-maximo import-script <fileName>` | 导入自动化脚本 |
|
|
55
|
+
| `sks-maximo import-domain <fileName>` | 导入域配置 |
|
|
56
|
+
| `sks-maximo import-maxintobject <fileName>` | 导入对象结构(Integration Object)配置 |
|
|
57
|
+
|
|
58
|
+
环境名必须是 `~/.sks/nodeutils/config.json` 中 `envs` 下已存在的键(例如 `local`、`dev`、`dev_en`、`prod`、`prod_en`、`hd`)。请求会自动追加 `_langcode` 参数,取该环境配置的 `langcode`;环境未配置时取全局 `langcode`(默认 `zh`)。因此做英文数据导入时,要传入配置了 `"langcode": "en"` 的环境,例如 `prod_en`。
|
|
59
|
+
|
|
60
|
+
所有导入命令都支持 `-l` / `--logname <name>` 自定义日志前缀。
|
|
61
|
+
|
|
41
62
|
### 在脚本中引用
|
|
42
63
|
|
|
43
64
|
```javascript
|
|
@@ -128,17 +149,25 @@ fileUtils.readFileContent('test.txt');
|
|
|
128
149
|
"authType": "apiKey",
|
|
129
150
|
"langcode": "zh"
|
|
130
151
|
},
|
|
131
|
-
"
|
|
132
|
-
"baseUrl": "https://
|
|
152
|
+
"prod": {
|
|
153
|
+
"baseUrl": "https://main.manage.prod.example.com/maximo",
|
|
154
|
+
"apiKey": "your-api-key",
|
|
155
|
+
"maxauth": "",
|
|
156
|
+
"authType": "apiKey"
|
|
157
|
+
},
|
|
158
|
+
"prod_en": {
|
|
159
|
+
"baseUrl": "https://main.manage.prod.example.com/maximo",
|
|
133
160
|
"apiKey": "your-api-key",
|
|
134
161
|
"maxauth": "",
|
|
135
162
|
"authType": "apiKey",
|
|
136
|
-
"langcode": "
|
|
163
|
+
"langcode": "en"
|
|
137
164
|
}
|
|
138
165
|
}
|
|
139
166
|
}
|
|
140
167
|
```
|
|
141
168
|
|
|
169
|
+
`envs` 下的键就是环境名,可自行命名(如 `loc`、`dev`、`dev_en`、`prod`、`prod_en`、`hd`)。同一个 Maximo 服务可以配置多个环境名,仅 `langcode` 不同,用于分别导入中文/英文数据。
|
|
170
|
+
|
|
142
171
|
### 配置说明
|
|
143
172
|
|
|
144
173
|
| 字段 | 说明 |
|
package/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ if (!cmd || ['-h', '--help', '-?', '--version', '-v'].includes(cmd)) {
|
|
|
67
67
|
console.log('选项:');
|
|
68
68
|
console.log(' -h, --help # 显示帮助信息');
|
|
69
69
|
console.log(' -v, --version # 显示版本信息');
|
|
70
|
-
console.log(' --env, -e <env> #
|
|
70
|
+
console.log(' --env, -e <env> # 指定环境(直接输入sks-maximo 可进行打开配置目录)');
|
|
71
71
|
console.log(' --file <fileName> # 请求体文件路径(JSON)');
|
|
72
72
|
console.log(' --params <params> # URL参数(JSON格式)');
|
|
73
73
|
console.log('');
|