@contentstack/cli-utilities 2.0.0-beta → 2.0.0-beta.2
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/constants/logging.d.ts +1 -1
- package/lib/constants/logging.js +1 -1
- package/lib/content-type-utils.d.ts +7 -0
- package/lib/content-type-utils.js +42 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/progress-summary/cli-progress-manager.d.ts +3 -1
- package/lib/progress-summary/cli-progress-manager.js +7 -1
- package/package.json +5 -4
|
@@ -13,4 +13,4 @@ export declare const levelColors: {
|
|
|
13
13
|
info: string;
|
|
14
14
|
debug: string;
|
|
15
15
|
};
|
|
16
|
-
export declare const PROGRESS_SUPPORTED_MODULES: readonly ["export", "import", "audit", "import-setup"];
|
|
16
|
+
export declare const PROGRESS_SUPPORTED_MODULES: readonly ["export", "import", "audit", "import-setup", "clone"];
|
package/lib/constants/logging.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads all content type schema files from a directory
|
|
3
|
+
* @param dirPath - Path to content types directory
|
|
4
|
+
* @param ignoredFiles - Files to ignore (defaults to schema.json, .DS_Store, __master.json, __priority.json)
|
|
5
|
+
* @returns Array of content type schemas
|
|
6
|
+
*/
|
|
7
|
+
export declare function readContentTypeSchemas(dirPath: string, ignoredFiles?: string[]): Record<string, unknown>[] | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readContentTypeSchemas = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const fs_utility_1 = require("./fs-utility");
|
|
6
|
+
/**
|
|
7
|
+
* Reads all content type schema files from a directory
|
|
8
|
+
* @param dirPath - Path to content types directory
|
|
9
|
+
* @param ignoredFiles - Files to ignore (defaults to schema.json, .DS_Store, __master.json, __priority.json)
|
|
10
|
+
* @returns Array of content type schemas
|
|
11
|
+
*/
|
|
12
|
+
function readContentTypeSchemas(dirPath, ignoredFiles = ['schema.json', '.DS_Store', '__master.json', '__priority.json', 'field_rules_uid.json']) {
|
|
13
|
+
const fsUtil = new fs_utility_1.FsUtility();
|
|
14
|
+
const files = fsUtil.readdir(dirPath);
|
|
15
|
+
if (!files || files.length === 0) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const contentTypes = [];
|
|
19
|
+
for (const file of files) {
|
|
20
|
+
// Skip if not a JSON file
|
|
21
|
+
if (!file.endsWith('.json')) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
// Skip ignored files
|
|
25
|
+
if (ignoredFiles.includes(file)) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const filePath = (0, node_path_1.resolve)(dirPath, file);
|
|
30
|
+
const contentType = fsUtil.readFile(filePath);
|
|
31
|
+
if (contentType) {
|
|
32
|
+
contentTypes.push(contentType);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// Skip files that cannot be parsed
|
|
37
|
+
console.warn(`Failed to read content type file ${file}:`, error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return contentTypes;
|
|
41
|
+
}
|
|
42
|
+
exports.readContentTypeSchemas = readContentTypeSchemas;
|
package/lib/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as managementSDKClient, managementSDKInitiator, ContentstackCli
|
|
|
10
10
|
export * from './management-types';
|
|
11
11
|
export * from './http-client';
|
|
12
12
|
export * from './fs-utility';
|
|
13
|
+
export * from './content-type-utils';
|
|
13
14
|
export { default as NodeCrypto } from './encrypter';
|
|
14
15
|
export { Args as args, Flags as flags, Command } from './cli-ux';
|
|
15
16
|
export * from './helpers';
|
package/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "managementSDKInitiator", { enumerable: true, get
|
|
|
26
26
|
tslib_1.__exportStar(require("./management-types"), exports);
|
|
27
27
|
tslib_1.__exportStar(require("./http-client"), exports);
|
|
28
28
|
tslib_1.__exportStar(require("./fs-utility"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./content-type-utils"), exports);
|
|
29
30
|
var encrypter_1 = require("./encrypter");
|
|
30
31
|
Object.defineProperty(exports, "NodeCrypto", { enumerable: true, get: function () { return tslib_1.__importDefault(encrypter_1).default; } });
|
|
31
32
|
var cli_ux_2 = require("./cli-ux");
|
|
@@ -31,7 +31,9 @@ export default class CLIProgressManager {
|
|
|
31
31
|
*/
|
|
32
32
|
static displayOperationHeader(branchName: string, headerTitle?: string): void;
|
|
33
33
|
/**
|
|
34
|
-
* Print the final summary for all modules using strategies
|
|
34
|
+
* Print the final summary for all modules using strategies.
|
|
35
|
+
* When showConsoleLogs is enabled, skip the Progress Manager summary block
|
|
36
|
+
* so output is pure timestamped log lines (per documentation).
|
|
35
37
|
*/
|
|
36
38
|
static printGlobalSummary(): void;
|
|
37
39
|
/**
|
|
@@ -53,7 +53,9 @@ class CLIProgressManager {
|
|
|
53
53
|
console.log(chalk_1.default.bold('='.repeat(80)) + '\n');
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Print the final summary for all modules using strategies
|
|
56
|
+
* Print the final summary for all modules using strategies.
|
|
57
|
+
* When showConsoleLogs is enabled, skip the Progress Manager summary block
|
|
58
|
+
* so output is pure timestamped log lines (per documentation).
|
|
57
59
|
*/
|
|
58
60
|
static printGlobalSummary() {
|
|
59
61
|
if (!CLIProgressManager.globalSummary) {
|
|
@@ -512,6 +514,10 @@ class CLIProgressManager {
|
|
|
512
514
|
}
|
|
513
515
|
}
|
|
514
516
|
printSummary() {
|
|
517
|
+
// In console logs mode, use only timestamped log lines (no Progress Manager blocks)
|
|
518
|
+
if (this.showConsoleLogs) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
515
521
|
if (!this.enableNestedProgress) {
|
|
516
522
|
// Simple summary for single progress
|
|
517
523
|
this.log('\n' + chalk_1.default.bold(`${this.moduleName} Summary:`));
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-utilities",
|
|
3
|
-
"version": "2.0.0-beta",
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "Utilities for contentstack projects",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"prepack": "pnpm compile",
|
|
9
|
-
"
|
|
9
|
+
"build": "pnpm compile",
|
|
10
|
+
"clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo",
|
|
10
11
|
"compile": "tsc -b tsconfig.json",
|
|
11
12
|
"test:report": "tsc -p test && nyc --reporter=lcov --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
|
12
13
|
"pretest": "tsc -p test",
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"author": "contentstack",
|
|
33
34
|
"license": "MIT",
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@contentstack/management": "~1.27.
|
|
36
|
+
"@contentstack/management": "~1.27.6",
|
|
36
37
|
"@contentstack/marketplace-sdk": "^1.5.0",
|
|
37
38
|
"@oclif/core": "^4.3.0",
|
|
38
39
|
"axios": "^1.13.5",
|
|
@@ -81,4 +82,4 @@
|
|
|
81
82
|
"ts-node": "^10.9.2",
|
|
82
83
|
"typescript": "^4.9.5"
|
|
83
84
|
}
|
|
84
|
-
}
|
|
85
|
+
}
|