Skip to content

Commit 13e942e

Browse files
committed
merged changes
2 parents 200ba62 + 075bdaa commit 13e942e

11 files changed

Lines changed: 224 additions & 121 deletions

File tree

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ fileignoreconfig:
22
- filename: packages/contentstack-import/src/utils/import-config-handler.ts
33
checksum: 3194f537cee8041f07a7ea91cdc6351c84e400766696d9c3cf80b98f99961f76
44
- filename: pnpm-lock.yaml
5-
checksum: f4bc99d0e633845924cbe8079c5dbb3c200022c13af6854ec38190c28d254813
5+
checksum: cea25dedde40bf962d825a088e505113c997ae666a4385d3eec0ae3f9f5d1404
66
version: '1.0'

packages/contentstack-audit/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
1919
$ csdx COMMAND
2020
running command...
2121
$ csdx (--version|-v)
22-
@contentstack/cli-audit/2.0.0-beta.6 darwin-arm64 node-v24.13.0
22+
@contentstack/cli-audit/2.0.0-beta.10 darwin-arm64 node-v22.13.1
2323
$ csdx --help [COMMAND]
2424
USAGE
2525
$ csdx COMMAND
@@ -157,5 +157,5 @@ DESCRIPTION
157157
Display help for csdx.
158158
```
159159

160-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_
160+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.44/src/commands/help.ts)_
161161
<!-- commandsstop -->

packages/contentstack-audit/src/config/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const config = {
110110
'publish_locale',
111111
'publish_environment',
112112
'asset_uid',
113+
'space_id',
113114
'selectedValue',
114115
'ct_uid',
115116
'action',

packages/contentstack-audit/src/messages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const auditMsg = {
4444
ENTRY_PUBLISH_DETAILS: `Removing the publish details for entry '{uid}' of ct '{ctuid}' in locale '{locale}' as locale '{publocale}' or environment '{environment}' does not exist`,
4545
CT_REFERENCE_FIELD: `The mentioned Reference field is not Array field reference is '{reference_to}' having display name '{display_name}''`,
4646
ASSET_NOT_EXIST: `The publish_details either does not exist or is not an array for asset uid '{uid}'`,
47+
AUDITING_SPACE: `Auditing assets for space: '{spaceId}'`,
4748
ENTRY_PUBLISH_DETAILS_NOT_EXIST: `The publish_details either does not exist or is not an array for entry uid '{uid}'`,
4849
FIELD_RULE_CONDITION_ABSENT: `The operand field '{condition_field}' is not present in the schema of the content-type {ctUid}`,
4950
FIELD_RULE_TARGET_ABSENT: `The target field '{target_field}' is not present in the schema of the content-type {ctUid}`,

packages/contentstack-audit/src/modules/assets.ts

Lines changed: 180 additions & 95 deletions
Large diffs are not rendered by default.

packages/contentstack-audit/src/modules/modulesData.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join, resolve } from 'path';
2-
import { existsSync, readFileSync } from 'fs';
2+
import { existsSync, readFileSync, readdirSync } from 'fs';
33
import { FsUtility, sanitizePath, log } from '@contentstack/cli-utilities';
44
import { ConfigType, ContentTypeStruct, CtConstructorParam, ModuleConstructorParam } from '../types';
55
import { keys, values } from 'lodash';
@@ -46,10 +46,25 @@ export default class ModuleDataReader {
4646
break;
4747
case 'assets': {
4848
log.debug(`Counting assets`, this.config.auditContext);
49-
const assetsPath = join(this.folderPath, 'assets');
50-
log.debug(`Assets path: ${assetsPath}`, this.config.auditContext);
51-
count = (await this.readEntryAssetsModule(assetsPath, 'assets')) || 0;
52-
log.debug(`Assets count: ${count}`, this.config.auditContext);
49+
const spacesDir = join(this.folderPath, 'spaces');
50+
if (existsSync(spacesDir)) {
51+
log.debug(`Multi-space structure detected at: ${spacesDir}`, this.config.auditContext);
52+
const spaceDirs = readdirSync(spacesDir, { withFileTypes: true }).filter(
53+
(entry) => entry.isDirectory() && existsSync(join(spacesDir, entry.name, 'assets')),
54+
);
55+
for (const spaceDir of spaceDirs) {
56+
const spaceAssetsPath = join(spacesDir, spaceDir.name, 'assets');
57+
log.debug(`Counting assets in space: ${spaceDir.name} at ${spaceAssetsPath}`, this.config.auditContext);
58+
const spaceCount = (await this.readEntryAssetsModule(spaceAssetsPath, 'assets')) || 0;
59+
log.debug(`Space ${spaceDir.name} asset count: ${spaceCount}`, this.config.auditContext);
60+
count += spaceCount;
61+
}
62+
} else {
63+
const assetsPath = join(this.folderPath, 'assets');
64+
log.debug(`Flat structure detected, assets path: ${assetsPath}`, this.config.auditContext);
65+
count = (await this.readEntryAssetsModule(assetsPath, 'assets')) || 0;
66+
}
67+
log.debug(`Total assets count: ${count}`, this.config.auditContext);
5368
break;
5469
}
5570
case 'entries':

packages/contentstack-audit/src/types/content-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ enum OutputColumn {
162162
'publish_locale' = 'publish_locale',
163163
'publish_environment' = 'publish_environment',
164164
'asset_uid' = 'asset_uid',
165+
'space_id' = 'space_id',
165166
'selectedValue' = 'selectedValue',
166167
'fixStatus' = 'fixStatus',
167168
'Content_type_uid' = 'ct_uid',

packages/contentstack-import-setup/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import-setup
4747
$ csdx COMMAND
4848
running command...
4949
$ csdx (--version)
50-
@contentstack/cli-cm-import-setup/2.0.0-beta.6 darwin-arm64 node-v24.13.0
50+
@contentstack/cli-cm-import-setup/2.0.0-beta.10 darwin-arm64 node-v22.13.1
5151
$ csdx --help [COMMAND]
5252
USAGE
5353
$ csdx COMMAND

packages/contentstack-import/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
4747
$ csdx COMMAND
4848
running command...
4949
$ csdx (--version)
50-
@contentstack/cli-cm-import/2.0.0-beta.11 darwin-arm64 node-v24.13.0
50+
@contentstack/cli-cm-import/2.0.0-beta.15 darwin-arm64 node-v22.13.1
5151
$ csdx --help [COMMAND]
5252
USAGE
5353
$ csdx COMMAND

packages/contentstack-migration/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration
2121
$ csdx COMMAND
2222
running command...
2323
$ csdx (--version)
24-
@contentstack/cli-migration/2.0.0-beta.10 darwin-arm64 node-v23.11.0
24+
@contentstack/cli-migration/2.0.0-beta.11 darwin-arm64 node-v22.13.1
2525
$ csdx --help [COMMAND]
2626
USAGE
2727
$ csdx COMMAND

0 commit comments

Comments
 (0)