diff --git a/.gitignore b/.gitignore index 636bcbe56e..329aeebd38 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ oclif.manifest.json contentstack-cli-logs packages/**/package-lock.json .dccache -yarn.lock \ No newline at end of file +yarn.lock +contents-* \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f2bf30e239..faa07f1527 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2599,9 +2599,9 @@ "dev": true }, "node_modules/@types/fs-extra": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.1.tgz", - "integrity": "sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.2.tgz", + "integrity": "sha512-c0hrgAOVYr21EX8J0jBMXGLMgJqVf/v6yxi0dLaJboW9aQPh16Id+z6w2Tx1hm+piJOLv8xPfVKZCLfjPw/IMQ==", "dev": true, "dependencies": { "@types/jsonfile": "*", @@ -2903,6 +2903,12 @@ "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.2.tgz", "integrity": "sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==" }, + "node_modules/@types/uuid": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.4.tgz", + "integrity": "sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA==", + "dev": true + }, "node_modules/@types/vinyl": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.7.tgz", @@ -8116,6 +8122,19 @@ } ] }, + "node_modules/fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, "node_modules/fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -21174,9 +21193,13 @@ } }, "node_modules/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } @@ -22744,13 +22767,13 @@ "version": "1.9.2", "license": "MIT", "dependencies": { - "@contentstack/cli-audit": "~1.0.0", + "@contentstack/cli-audit": "~1.2.0", "@contentstack/cli-auth": "~1.3.14", "@contentstack/cli-cm-bootstrap": "~1.5.1", "@contentstack/cli-cm-branches": "~1.0.14", "@contentstack/cli-cm-bulk-publish": "~1.3.12", "@contentstack/cli-cm-clone": "~1.5.1", - "@contentstack/cli-cm-export": "~1.9.1", + "@contentstack/cli-cm-export": "~1.9.2", "@contentstack/cli-cm-export-to-csv": "~1.4.3", "@contentstack/cli-cm-import": "~1.9.2", "@contentstack/cli-cm-migrate-rte": "~1.4.12", @@ -22809,17 +22832,19 @@ }, "packages/contentstack-audit": { "name": "@contentstack/cli-audit", - "version": "1.0.0", + "version": "1.2.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.11", "@contentstack/cli-utilities": "~1.5.1", - "@oclif/plugin-help": "^5.2.20", + "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^3.8.4", "chalk": "^4.1.2", "fast-csv": "^4.3.6", + "fs-extra": "^11.1.1", "lodash": "^4.17.21", - "winston": "^3.9.0" + "uuid": "^9.0.1", + "winston": "^3.10.0" }, "bin": { "audit": "bin/run" @@ -22827,7 +22852,9 @@ "devDependencies": { "@oclif/test": "^2.0.3", "@types/chai": "^4.3.5", + "@types/fs-extra": "^11.0.2", "@types/node": "^20.3.1", + "@types/uuid": "^9.0.4", "chai": "^4.3.7", "eslint": "^8.43.0", "eslint-config-oclif": "^4.0.0", @@ -24108,7 +24135,7 @@ }, "packages/contentstack-export": { "name": "@contentstack/cli-cm-export", - "version": "1.9.1", + "version": "1.9.2", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.13", @@ -24523,19 +24550,6 @@ "@types/node": "*" } }, - "packages/contentstack-import/node_modules/fs-extra": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", - "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, "packages/contentstack-import/node_modules/sinon": { "version": "11.1.2", "resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz", @@ -26824,13 +26838,13 @@ "@contentstack/cli": { "version": "file:packages/contentstack", "requires": { - "@contentstack/cli-audit": "~1.0.0", + "@contentstack/cli-audit": "~1.2.0", "@contentstack/cli-auth": "~1.3.14", "@contentstack/cli-cm-bootstrap": "~1.5.1", "@contentstack/cli-cm-branches": "~1.0.14", "@contentstack/cli-cm-bulk-publish": "~1.3.12", "@contentstack/cli-cm-clone": "~1.5.1", - "@contentstack/cli-cm-export": "~1.9.1", + "@contentstack/cli-cm-export": "~1.9.2", "@contentstack/cli-cm-export-to-csv": "~1.4.3", "@contentstack/cli-cm-import": "~1.9.2", "@contentstack/cli-cm-migrate-rte": "~1.4.12", @@ -26884,17 +26898,20 @@ "requires": { "@contentstack/cli-command": "~1.2.11", "@contentstack/cli-utilities": "~1.5.1", - "@oclif/plugin-help": "^5.2.20", + "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^3.8.4", "@oclif/test": "^2.0.3", "@types/chai": "^4.3.5", + "@types/fs-extra": "^11.0.2", "@types/node": "^20.3.1", + "@types/uuid": "^9.0.4", "chai": "^4.3.7", "chalk": "^4.1.2", "eslint": "^8.43.0", "eslint-config-oclif": "^4.0.0", "eslint-config-oclif-typescript": "^1.0.3", "fast-csv": "^4.3.6", + "fs-extra": "^11.1.1", "lodash": "^4.17.21", "mocha": "^10.2.0", "nyc": "^15.1.0", @@ -26903,7 +26920,8 @@ "ts-node": "^10.9.1", "tslib": "^2.5.3", "typescript": "^5.1.3", - "winston": "^3.9.0" + "uuid": "^9.0.1", + "winston": "^3.10.0" }, "dependencies": { "@babel/code-frame": { @@ -27921,16 +27939,6 @@ "@types/node": "*" } }, - "fs-extra": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", - "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, "sinon": { "version": "11.1.2", "resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz", @@ -31074,9 +31082,9 @@ "dev": true }, "@types/fs-extra": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.1.tgz", - "integrity": "sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.2.tgz", + "integrity": "sha512-c0hrgAOVYr21EX8J0jBMXGLMgJqVf/v6yxi0dLaJboW9aQPh16Id+z6w2Tx1hm+piJOLv8xPfVKZCLfjPw/IMQ==", "dev": true, "requires": { "@types/jsonfile": "*", @@ -31379,6 +31387,12 @@ "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.2.tgz", "integrity": "sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==" }, + "@types/uuid": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.4.tgz", + "integrity": "sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA==", + "dev": true + }, "@types/vinyl": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.7.tgz", @@ -35254,6 +35268,16 @@ "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", "dev": true }, + "fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -44903,9 +44927,9 @@ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" }, "uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" }, "v8-compile-cache": { "version": "2.3.0", diff --git a/packages/contentstack-audit/README.md b/packages/contentstack-audit/README.md index 6f4b4c946b..b6fd5a967d 100644 --- a/packages/contentstack-audit/README.md +++ b/packages/contentstack-audit/README.md @@ -12,15 +12,13 @@ $ csdx plugins:install @contentstack/cli-audit ## How to use this plugin -This plugin requires you to be authenticated using [csdx auth:login](https://www.contentstack.com/docs/developers/cli/authenticate-with-the-cli/). - ```sh-session $ npm install -g @contentstack/cli-audit $ csdx COMMAND running command... $ csdx (--version|-v) -@contentstack/cli-audit/0.0.0-alpha darwin-arm64 node-v16.19.0 +@contentstack/cli-audit/1.2.0 darwin-arm64 node-v20.8.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND @@ -30,9 +28,10 @@ USAGE # Commands -* [`csdx cm::stacks:audit:fix`](#csdx-cmstacksauditfix) +* [`csdx audit`](#csdx-audit) +* [`csdx audit:fix`](#csdx-auditfix) * [`csdx cm:stacks:audit`](#csdx-cmstacksaudit) -* [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix-1) +* [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix) * [`csdx help [COMMANDS]`](#csdx-help-commands) * [`csdx plugins`](#csdx-plugins) * [`csdx plugins:install PLUGIN...`](#csdx-pluginsinstall-plugin) @@ -44,33 +43,93 @@ USAGE * [`csdx plugins:uninstall PLUGIN...`](#csdx-pluginsuninstall-plugin-2) * [`csdx plugins:update`](#csdx-pluginsupdate) -## `csdx cm::stacks:audit:fix` +## `csdx audit` -Audit fix command +Perform audits and find possible errors in the exported Contentstack data ``` USAGE - $ csdx cm::stacks:audit:fix [-c ] [-d ] + $ csdx audit [-c ] [-d ] [--report-path ] [--modules + content-types|global-fields|entries] [--columns | ] [--sort ] [--filter ] [--csv | + --no-truncate] FLAGS -c, --config= Path of the external config. -d, --data-dir= Path where the data is stored. + --columns= only show provided columns (comma-separated) + --csv output is csv format [alias: --output=csv] + --filter= filter property by partial string matching, ex: name=foo + --modules=