@contentstack/cli-audit 1.10.0 → 1.12.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/lib/util/flags.js CHANGED
@@ -1,30 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getJsonInputFlags = exports.getTableFlags = void 0;
3
+ exports.tableFlags = void 0;
4
+ exports.getJsonInputFlags = getJsonInputFlags;
4
5
  const cli_utilities_1 = require("@contentstack/cli-utilities");
5
- const messages_1 = require("../messages");
6
6
  const defaultJSONOptions = { description: 'Provide JSON input' };
7
- /**
8
- * The function `getTableFlags` returns a set of table flags based on the specified columns, with
9
- * updated descriptions and help groups.
10
- * @param {(keyof IFlags)[]} columns - An optional array of column keys from the IFlags interface. The
11
- * default value is ['columns', 'sort', 'filter', 'csv', 'no-truncate'].
12
- * @returns an object of type `IncludeFlags<IFlags, keyof IFlags>`.
13
- */
14
- function getTableFlags(columns = ['columns', 'sort', 'filter', 'csv', 'no-truncate']) {
15
- const flags = cli_utilities_1.ux.table.flags({
16
- only: columns,
17
- });
18
- // NOTE Assign group and update Descriptions
19
- columns.forEach((element) => {
20
- var _a;
21
- flags[element].helpGroup = 'TABLE';
22
- const descriptionKey = `TABLE_${element.toUpperCase()}`;
23
- flags[element].description = (_a = messages_1.tableColumnDescriptions[descriptionKey]) !== null && _a !== void 0 ? _a : flags[element].description;
24
- });
25
- return flags;
26
- }
27
- exports.getTableFlags = getTableFlags;
28
7
  /**
29
8
  * The function `getJsonInputFlags` returns a flag definition for parsing JSON input.
30
9
  * @param {JSONFlagOptions} options - The `options` parameter is an object that contains the following
@@ -46,4 +25,5 @@ function getJsonInputFlags(options = defaultJSONOptions) {
46
25
  },
47
26
  });
48
27
  }
49
- exports.getJsonInputFlags = getJsonInputFlags;
28
+ const tableFlags = cli_utilities_1.CLITable.getTableFlags(['columns', 'sort', 'filter', 'csv', 'no-truncate', 'no-header', 'output']);
29
+ exports.tableFlags = tableFlags;
package/lib/util/log.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.print = void 0;
3
+ exports.print = print;
4
4
  const tslib_1 = require("tslib");
5
5
  const map_1 = tslib_1.__importDefault(require("lodash/map"));
6
6
  const winston_1 = tslib_1.__importDefault(require("winston"));
@@ -150,4 +150,3 @@ function print(printInput) {
150
150
  }).join(' ');
151
151
  cli_utilities_1.cliux.print(str);
152
152
  }
153
- exports.print = print;
@@ -1,18 +1,12 @@
1
1
  {
2
- "version": "1.10.0",
3
2
  "commands": {
4
3
  "cm:stacks:audit:fix": {
5
- "id": "cm:stacks:audit:fix",
6
- "description": "Perform audits and fix possible errors in the exported Contentstack data.",
7
- "strict": true,
8
- "pluginName": "@contentstack/cli-audit",
9
- "pluginAlias": "@contentstack/cli-audit",
10
- "pluginType": "core",
11
4
  "aliases": [
12
5
  "audit:fix",
13
6
  "cm:stacks:audit:fix"
14
7
  ],
15
- "hiddenAliases": [],
8
+ "args": {},
9
+ "description": "Perform audits and fix possible errors in the exported Contentstack data.",
16
10
  "examples": [
17
11
  "$ <%= config.bin %> <%= command.id %> --copy-dir",
18
12
  "$ <%= config.bin %> <%= command.id %> --report-path=<path> --copy-dir",
@@ -22,23 +16,49 @@
22
16
  "$ <%= config.bin %> <%= command.id %> --report-path=<path> --modules=content-types --filter=\"name=\"<filter-value>\" --copy-dir --copy-path=<path>"
23
17
  ],
24
18
  "flags": {
19
+ "config": {
20
+ "char": "c",
21
+ "description": "Path of the external config",
22
+ "helpGroup": "COMMON",
23
+ "name": "config",
24
+ "hasDynamicHelp": false,
25
+ "multiple": false,
26
+ "type": "option"
27
+ },
28
+ "data-dir": {
29
+ "char": "d",
30
+ "description": "Path where the data is stored",
31
+ "helpGroup": "COMMON",
32
+ "name": "data-dir",
33
+ "hasDynamicHelp": false,
34
+ "multiple": false,
35
+ "type": "option"
36
+ },
37
+ "show-console-output": {
38
+ "description": "Display the audit and audit fix result for individual modules",
39
+ "helpGroup": "COMMON",
40
+ "name": "show-console-output",
41
+ "allowNo": false,
42
+ "type": "boolean"
43
+ },
25
44
  "report-path": {
26
- "name": "report-path",
27
- "type": "option",
28
45
  "description": "Path to store the audit reports",
29
- "multiple": false
46
+ "name": "report-path",
47
+ "hasDynamicHelp": false,
48
+ "multiple": false,
49
+ "type": "option"
30
50
  },
31
51
  "reference-only": {
32
- "name": "reference-only",
33
- "type": "boolean",
34
52
  "description": "Checks only for missing references.",
35
53
  "hidden": true,
36
- "allowNo": false
54
+ "name": "reference-only",
55
+ "allowNo": false,
56
+ "type": "boolean"
37
57
  },
38
58
  "modules": {
39
- "name": "modules",
40
- "type": "option",
41
59
  "description": "Provide the list of modules to be audited",
60
+ "name": "modules",
61
+ "hasDynamicHelp": false,
42
62
  "multiple": true,
43
63
  "options": [
44
64
  "content-types",
@@ -47,28 +67,31 @@
47
67
  "extensions",
48
68
  "workflows",
49
69
  "custom-roles",
50
- "assets"
51
- ]
70
+ "assets",
71
+ "field-rules"
72
+ ],
73
+ "type": "option"
52
74
  },
53
75
  "copy-dir": {
54
- "name": "copy-dir",
55
- "type": "boolean",
56
76
  "description": "Create backup from the original data.",
57
- "allowNo": false
77
+ "name": "copy-dir",
78
+ "allowNo": false,
79
+ "type": "boolean"
58
80
  },
59
81
  "copy-path": {
60
- "name": "copy-path",
61
- "type": "option",
62
- "description": "Provide the path to backup the copied data",
63
- "multiple": false,
64
82
  "dependsOn": [
65
83
  "copy-dir"
66
- ]
84
+ ],
85
+ "description": "Provide the path to backup the copied data",
86
+ "name": "copy-path",
87
+ "hasDynamicHelp": false,
88
+ "multiple": false,
89
+ "type": "option"
67
90
  },
68
91
  "fix-only": {
69
- "name": "fix-only",
70
- "type": "option",
71
92
  "description": "Provide the list of fix options",
93
+ "name": "fix-only",
94
+ "hasDynamicHelp": false,
72
95
  "multiple": true,
73
96
  "options": [
74
97
  "reference",
@@ -78,82 +101,108 @@
78
101
  "blocks",
79
102
  "group",
80
103
  "content_types"
81
- ]
104
+ ],
105
+ "type": "option"
82
106
  },
83
107
  "yes": {
84
- "name": "yes",
85
- "type": "boolean",
86
108
  "char": "y",
87
109
  "description": "Use this flag to skip confirmation",
88
110
  "hidden": true,
89
- "allowNo": false
111
+ "name": "yes",
112
+ "allowNo": false,
113
+ "type": "boolean"
90
114
  },
91
115
  "external-config": {
92
- "name": "external-config",
93
- "type": "option",
94
116
  "description": "Provide JSON input",
95
117
  "hidden": true,
96
- "multiple": false
118
+ "name": "external-config",
119
+ "hasDynamicHelp": false,
120
+ "multiple": false,
121
+ "type": "option"
97
122
  },
98
123
  "columns": {
99
- "name": "columns",
100
- "type": "option",
101
- "description": "Show only the specified columns (comma-separated)",
124
+ "description": "Specify columns to display, comma-separated.",
102
125
  "helpGroup": "TABLE",
126
+ "name": "columns",
127
+ "hasDynamicHelp": false,
103
128
  "multiple": false,
104
- "exclusive": [
105
- "extended"
106
- ]
129
+ "type": "option"
107
130
  },
108
131
  "sort": {
109
- "name": "sort",
110
- "type": "option",
111
- "description": "Property to sort by (prepend '-' for descending)",
132
+ "description": "Sort the table by a column. Use \"-\" for descending.",
112
133
  "helpGroup": "TABLE",
113
- "multiple": false
134
+ "name": "sort",
135
+ "hasDynamicHelp": false,
136
+ "multiple": false,
137
+ "type": "option"
114
138
  },
115
139
  "filter": {
116
- "name": "filter",
117
- "type": "option",
118
- "description": "Filter property by partial string matching. For example: name=foo",
140
+ "description": "Filter rows by a column value (e.g., name=foo).",
119
141
  "helpGroup": "TABLE",
120
- "multiple": false
142
+ "name": "filter",
143
+ "hasDynamicHelp": false,
144
+ "multiple": false,
145
+ "type": "option"
121
146
  },
122
147
  "csv": {
123
- "name": "csv",
124
- "type": "boolean",
125
- "description": "The output is in the CSV format [alias: --output=csv]",
148
+ "description": "Output results in CSV format.",
126
149
  "helpGroup": "TABLE",
150
+ "name": "csv",
127
151
  "allowNo": false,
128
- "exclusive": [
129
- "no-truncate"
130
- ]
152
+ "type": "boolean"
131
153
  },
132
154
  "no-truncate": {
155
+ "description": "Prevent truncation of long text in columns.",
156
+ "helpGroup": "TABLE",
133
157
  "name": "no-truncate",
134
- "type": "boolean",
135
- "description": "The output is not truncated to fit the screen",
158
+ "allowNo": false,
159
+ "type": "boolean"
160
+ },
161
+ "no-header": {
162
+ "description": "Hide table headers in output.",
136
163
  "helpGroup": "TABLE",
164
+ "name": "no-header",
137
165
  "allowNo": false,
138
- "exclusive": [
139
- "csv"
140
- ]
166
+ "type": "boolean"
167
+ },
168
+ "output": {
169
+ "description": "Specify output format: csv, json, or yaml.",
170
+ "helpGroup": "TABLE",
171
+ "name": "output",
172
+ "hasDynamicHelp": false,
173
+ "multiple": false,
174
+ "options": [
175
+ "csv",
176
+ "json",
177
+ "yaml"
178
+ ],
179
+ "type": "option"
141
180
  }
142
181
  },
143
- "args": {}
144
- },
145
- "cm:stacks:audit": {
146
- "id": "cm:stacks:audit",
147
- "description": "Perform audits and find possible errors in the exported Contentstack data",
148
- "strict": true,
149
- "pluginName": "@contentstack/cli-audit",
182
+ "hasDynamicHelp": false,
183
+ "hiddenAliases": [],
184
+ "id": "cm:stacks:audit:fix",
150
185
  "pluginAlias": "@contentstack/cli-audit",
186
+ "pluginName": "@contentstack/cli-audit",
151
187
  "pluginType": "core",
188
+ "strict": true,
189
+ "isESM": false,
190
+ "relativePath": [
191
+ "lib",
192
+ "commands",
193
+ "cm",
194
+ "stacks",
195
+ "audit",
196
+ "fix.js"
197
+ ]
198
+ },
199
+ "cm:stacks:audit": {
152
200
  "aliases": [
153
201
  "audit",
154
202
  "cm:stacks:audit"
155
203
  ],
156
- "hiddenAliases": [],
204
+ "args": {},
205
+ "description": "Perform audits and find possible errors in the exported Contentstack data",
157
206
  "examples": [
158
207
  "$ <%= config.bin %> <%= command.id %>",
159
208
  "$ <%= config.bin %> <%= command.id %> --report-path=<path>",
@@ -162,23 +211,49 @@
162
211
  "$ <%= config.bin %> <%= command.id %> --report-path=<path> --modules=content-types --filter=\"name=\"<filter-value>\""
163
212
  ],
164
213
  "flags": {
214
+ "config": {
215
+ "char": "c",
216
+ "description": "Path of the external config",
217
+ "helpGroup": "COMMON",
218
+ "name": "config",
219
+ "hasDynamicHelp": false,
220
+ "multiple": false,
221
+ "type": "option"
222
+ },
223
+ "data-dir": {
224
+ "char": "d",
225
+ "description": "Path where the data is stored",
226
+ "helpGroup": "COMMON",
227
+ "name": "data-dir",
228
+ "hasDynamicHelp": false,
229
+ "multiple": false,
230
+ "type": "option"
231
+ },
232
+ "show-console-output": {
233
+ "description": "Display the audit and audit fix result for individual modules",
234
+ "helpGroup": "COMMON",
235
+ "name": "show-console-output",
236
+ "allowNo": false,
237
+ "type": "boolean"
238
+ },
165
239
  "report-path": {
166
- "name": "report-path",
167
- "type": "option",
168
240
  "description": "Path to store the audit reports",
169
- "multiple": false
241
+ "name": "report-path",
242
+ "hasDynamicHelp": false,
243
+ "multiple": false,
244
+ "type": "option"
170
245
  },
171
246
  "reference-only": {
172
- "name": "reference-only",
173
- "type": "boolean",
174
247
  "description": "Checks only for missing references.",
175
248
  "hidden": true,
176
- "allowNo": false
249
+ "name": "reference-only",
250
+ "allowNo": false,
251
+ "type": "boolean"
177
252
  },
178
253
  "modules": {
179
- "name": "modules",
180
- "type": "option",
181
254
  "description": "Provide the list of modules to be audited",
255
+ "name": "modules",
256
+ "hasDynamicHelp": false,
182
257
  "multiple": true,
183
258
  "options": [
184
259
  "content-types",
@@ -187,55 +262,87 @@
187
262
  "extensions",
188
263
  "workflows",
189
264
  "custom-roles",
190
- "assets"
191
- ]
265
+ "assets",
266
+ "field-rules"
267
+ ],
268
+ "type": "option"
192
269
  },
193
270
  "columns": {
194
- "name": "columns",
195
- "type": "option",
196
- "description": "Show only the specified columns (comma-separated)",
271
+ "description": "Specify columns to display, comma-separated.",
197
272
  "helpGroup": "TABLE",
273
+ "name": "columns",
274
+ "hasDynamicHelp": false,
198
275
  "multiple": false,
199
- "exclusive": [
200
- "extended"
201
- ]
276
+ "type": "option"
202
277
  },
203
278
  "sort": {
204
- "name": "sort",
205
- "type": "option",
206
- "description": "Property to sort by (prepend '-' for descending)",
279
+ "description": "Sort the table by a column. Use \"-\" for descending.",
207
280
  "helpGroup": "TABLE",
208
- "multiple": false
281
+ "name": "sort",
282
+ "hasDynamicHelp": false,
283
+ "multiple": false,
284
+ "type": "option"
209
285
  },
210
286
  "filter": {
211
- "name": "filter",
212
- "type": "option",
213
- "description": "Filter property by partial string matching. For example: name=foo",
287
+ "description": "Filter rows by a column value (e.g., name=foo).",
214
288
  "helpGroup": "TABLE",
215
- "multiple": false
289
+ "name": "filter",
290
+ "hasDynamicHelp": false,
291
+ "multiple": false,
292
+ "type": "option"
216
293
  },
217
294
  "csv": {
218
- "name": "csv",
219
- "type": "boolean",
220
- "description": "The output is in the CSV format [alias: --output=csv]",
295
+ "description": "Output results in CSV format.",
221
296
  "helpGroup": "TABLE",
297
+ "name": "csv",
222
298
  "allowNo": false,
223
- "exclusive": [
224
- "no-truncate"
225
- ]
299
+ "type": "boolean"
226
300
  },
227
301
  "no-truncate": {
302
+ "description": "Prevent truncation of long text in columns.",
303
+ "helpGroup": "TABLE",
228
304
  "name": "no-truncate",
229
- "type": "boolean",
230
- "description": "The output is not truncated to fit the screen",
305
+ "allowNo": false,
306
+ "type": "boolean"
307
+ },
308
+ "no-header": {
309
+ "description": "Hide table headers in output.",
231
310
  "helpGroup": "TABLE",
311
+ "name": "no-header",
232
312
  "allowNo": false,
233
- "exclusive": [
234
- "csv"
235
- ]
313
+ "type": "boolean"
314
+ },
315
+ "output": {
316
+ "description": "Specify output format: csv, json, or yaml.",
317
+ "helpGroup": "TABLE",
318
+ "name": "output",
319
+ "hasDynamicHelp": false,
320
+ "multiple": false,
321
+ "options": [
322
+ "csv",
323
+ "json",
324
+ "yaml"
325
+ ],
326
+ "type": "option"
236
327
  }
237
328
  },
238
- "args": {}
329
+ "hasDynamicHelp": false,
330
+ "hiddenAliases": [],
331
+ "id": "cm:stacks:audit",
332
+ "pluginAlias": "@contentstack/cli-audit",
333
+ "pluginName": "@contentstack/cli-audit",
334
+ "pluginType": "core",
335
+ "strict": true,
336
+ "isESM": false,
337
+ "relativePath": [
338
+ "lib",
339
+ "commands",
340
+ "cm",
341
+ "stacks",
342
+ "audit",
343
+ "index.js"
344
+ ]
239
345
  }
240
- }
346
+ },
347
+ "version": "1.12.0"
241
348
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/cli-audit",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Contentstack audit plugin",
5
5
  "author": "Contentstack CLI",
6
6
  "homepage": "https://github.com/contentstack/cli",
@@ -18,10 +18,10 @@
18
18
  "/oclif.manifest.json"
19
19
  ],
20
20
  "dependencies": {
21
- "@contentstack/cli-command": "~1.3.3",
22
- "@contentstack/cli-utilities": "~1.9.0",
23
- "@oclif/plugin-help": "^5.2.20",
24
- "@oclif/plugin-plugins": "^5.4.34",
21
+ "@contentstack/cli-command": "~1.5.0",
22
+ "@oclif/plugin-help": "^6.2.27",
23
+ "@contentstack/cli-utilities": "~1.11.0",
24
+ "@oclif/plugin-plugins": "^5.4.36",
25
25
  "chalk": "^4.1.2",
26
26
  "fast-csv": "^4.3.6",
27
27
  "fs-extra": "^11.3.0",
@@ -34,19 +34,19 @@
34
34
  "@types/chai": "^4.3.20",
35
35
  "@types/fs-extra": "^11.0.4",
36
36
  "@types/mocha": "^10.0.10",
37
- "@types/node": "^20.17.28",
37
+ "@types/node": "^20.17.30",
38
38
  "@types/uuid": "^9.0.8",
39
39
  "chai": "^4.5.0",
40
40
  "eslint": "^8.57.1",
41
- "eslint-config-oclif": "^4.0.0",
41
+ "eslint-config-oclif": "^6.0.42",
42
42
  "eslint-config-oclif-typescript": "^3.1.14",
43
43
  "mocha": "^10.8.2",
44
44
  "nyc": "^15.1.0",
45
- "oclif": "^3.17.2",
46
- "shx": "^0.3.4",
45
+ "oclif": "^4.17.43",
46
+ "shx": "^0.4.0",
47
47
  "sinon": "^19.0.5",
48
48
  "ts-node": "^10.9.2",
49
- "typescript": "^5.7.3"
49
+ "typescript": "^5.8.3"
50
50
  },
51
51
  "oclif": {
52
52
  "bin": "csdx",
@@ -69,11 +69,11 @@
69
69
  "lint": "eslint . --ext .ts --config .eslintrc",
70
70
  "postpack": "shx rm -f oclif.manifest.json",
71
71
  "posttest": "npm run lint",
72
- "compile": "shx rm -rf lib && tsc -b",
73
- "prepack": "npm run build && oclif manifest && oclif readme",
72
+ "compile": "shx rm -rf lib tsconfig.tsbuildinfo && tsc -b",
73
+ "prepack": "pnpm compile && oclif manifest && oclif readme",
74
74
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
75
75
  "version": "oclif readme && git add README.md",
76
- "clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo oclif.manifest.json",
76
+ "clean": "rm -rf ./lib ./node_modules .tsbuildinfo oclif.manifest.json",
77
77
  "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"",
78
78
  "test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.ts\""
79
79
  },