Skip to content
8 changes: 7 additions & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: a90a8f0dbfa98da53ecb9e63f021ae8a1ac44c03cfe5dccd52a539c948d1625a
checksum: 8566e316dd7026214e8863568c72dcf946ba10648ac5c076a7c55215b5ab3422
- filename: packages/contentstack-export/src/utils/export-config-handler.ts
checksum: 3ff8e8ea60f92311f8224bce457f7aaab026194de61e13eebdc6ca5a39f66bc9
- filename: packages/contentstack-asset-management/src/utils/export-helpers.ts
Expand All @@ -9,4 +9,10 @@ fileignoreconfig:
checksum: bc4a53f96be6a10786e00133245c7bdc43c965c8a98b753e3879e1110cf9c601
- filename: packages/contentstack-asset-management/test/unit/utils/cs-assets-api-adapter.test.ts
checksum: 63c6bff4d51842d8fa3cce88545259d0a2c3cfe71df95d303d993f692cee883b
- filename: packages/contentstack-migration/src/commands/cm/stacks/migration.ts
checksum: 529431473623cf6bbefb35bc898be2a60dcb453e0c9273ecb97923de658769b3
- filename: packages/contentstack-seed/src/commands/cm/stacks/seed.ts
checksum: 9a3fd45a57c6ebf63d6c154657f2ebf799befbbacb9a255944c2d89ae89b22ed
- filename: packages/contentstack-seed/test/commands/cm/stacks/seed.test.ts
checksum: b54f572a614e5d80f7fa27a51e679147cb537fd76ac922eed981d1156a261e50
Comment thread
cs-raj marked this conversation as resolved.
version: '1.0'
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export default class AuditFix extends AuditBaseCommand {
'report-path': Flags.string({
description: auditMsg.REPORT_PATH,
}),
'reference-only': Flags.boolean({
hidden: true,
description: auditMsg.REFERENCE_ONLY,
}),
modules: Flags.string({
multiple: true,
options: config.modules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ export default class Audit extends AuditBaseCommand {
'report-path': Flags.string({
description: auditMsg.REPORT_PATH,
}),
'reference-only': Flags.boolean({
hidden: true,
description: auditMsg.REFERENCE_ONLY,
}),
modules: Flags.string({
multiple: true,
options: config.modules,
Expand Down
21 changes: 2 additions & 19 deletions packages/contentstack-bootstrap/src/commands/cm/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Bootstrap, { BootstrapOptions, SeedParams } from '../../bootstrap';
import {
inquireCloneDirectory,
inquireApp,
inquireAppType,
inquireLivePreviewSupport,
inquireRunDevServer,
} from '../../bootstrap/interactive';
Expand Down Expand Up @@ -40,12 +39,6 @@ export default class BootstrapCommand extends Command {
multiple: false,
required: false,
}),
'app-type': flags.string({
description: 'Sample or Starter app',
multiple: false,
required: false,
hidden: true,
}),
'stack-api-key': flags.string({
char: 'k',
description: 'Provide stack API key to seed content',
Expand Down Expand Up @@ -98,23 +91,13 @@ export default class BootstrapCommand extends Command {
});

// inquire user inputs
let appType =
(bootstrapCommandFlags.appType as string) || (bootstrapCommandFlags['app-type'] as string) || 'starterapp';
if (!appType) {
appType = await inquireAppType();
}
const appType = 'starterapp';

const selectedAppName =
(bootstrapCommandFlags.appName as string) || (bootstrapCommandFlags['app-name'] as string);
let selectedApp;
if (!selectedAppName) {
if (appType === 'sampleapp') {
selectedApp = await inquireApp(config.sampleApps);
} else if (appType === 'starterapp') {
selectedApp = await inquireApp(config.starterApps);
} else {
this.error('Invalid app type provided: ' + appType, { exit: 1 });
}
selectedApp = await inquireApp(config.starterApps);
}

if (!selectedAppName && !selectedApp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe('Bootstrap Integration Tests', () => {
expect(BootstrapCommand.flags).to.have.property('stack-name');
expect(BootstrapCommand.flags).to.have.property('yes');
expect(BootstrapCommand.flags).to.have.property('alias');
expect(BootstrapCommand.flags).to.have.property('app-type');
});

it('should validate alias flag properties', () => {
Expand Down
31 changes: 10 additions & 21 deletions packages/contentstack-bootstrap/test/bootstrap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe('Bootstrapping an app', () => {
'app-name': 'kickstart-next',
org: 'org-uid',
'stack-name': 'test-bootstrap-cmd',
'app-type': 'kickstart-next',

yes: true,
};
return Promise.resolve(responses[question.name] || {});
Expand All @@ -171,16 +171,6 @@ describe('Bootstrapping an app', () => {
delete process.env.CONTENTSTACK_AUTH_TOKEN;
});

it('should handle invalid app type gracefully', async () => {
try {
await runCommand(['cm:bootstrap', '--app-type', 'invalidtype']);
} catch (error) {
expect(error).to.exist;
expect(error?.oclif?.exit).to.equal(1);
expect(error.message).to.contain('Invalid app type provided invalidtype');
}
});

it('should bootstrap a Contentstack app with the correct flags', async () => {
// Mock the BootstrapCommand class
const MockBootstrapCommand = class extends Command {
Expand Down Expand Up @@ -351,7 +341,7 @@ describe('Bootstrapping an app', () => {
flags: {
alias: testAlias,
'app-name': undefined,
'app-type': undefined,

'project-dir': undefined,
'stack-api-key': undefined,
org: undefined,
Expand Down Expand Up @@ -428,7 +418,7 @@ describe('Bootstrapping an app', () => {
flags: {
alias: undefined,
'app-name': undefined,
'app-type': undefined,

'project-dir': undefined,
'stack-api-key': undefined,
org: undefined,
Expand Down Expand Up @@ -485,7 +475,7 @@ describe('Bootstrapping an app', () => {
flags: {
alias: undefined,
'app-name': undefined,
'app-type': undefined,

'project-dir': undefined,
'stack-api-key': undefined,
org: undefined,
Expand Down Expand Up @@ -542,7 +532,7 @@ describe('Bootstrapping an app', () => {
flags: {
alias: undefined,
'app-name': undefined,
'app-type': undefined,

'project-dir': undefined,
'stack-api-key': undefined,
org: undefined,
Expand Down Expand Up @@ -598,7 +588,6 @@ describe('Bootstrapping an app', () => {
flags: {
alias: undefined,
'app-name': undefined,
'app-type': 'sampleapp',
'project-dir': undefined,
'stack-api-key': undefined,
org: undefined,
Expand All @@ -613,11 +602,11 @@ describe('Bootstrapping an app', () => {
command.cmaHost = mock.region.cma;

await command.run();
// Verify that appType is set correctly
// Verify that appType is hardcoded to 'starterapp'
expect(bootstrapOptions).to.not.be.null;
expect(bootstrapOptions.appType).to.equal('sampleapp');
// Verify that inquireApp was called with sampleApps (config.default in compiled CJS)
expect(interactive.inquireApp.calledWith(config.default.sampleApps)).to.be.true;
expect(bootstrapOptions.appType).to.equal('starterapp');
// Verify that inquireApp was called with starterApps
expect(interactive.inquireApp.calledWith(config.default.starterApps)).to.be.true;
});

it('should handle app-name flag correctly', async () => {
Expand Down Expand Up @@ -655,7 +644,7 @@ describe('Bootstrapping an app', () => {
flags: {
alias: undefined,
'app-name': 'kickstart-next',
'app-type': undefined,

'project-dir': undefined,
'stack-api-key': undefined,
org: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export default class MigrationCommand extends Command {
static description = 'Contentstack migration script.';

static examples: string[] = [
'$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>',
'$ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>',
'$ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>',
'$ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>',
'$ csdx cm:migration --multiple --file-path <migration/scripts/dir/path> ',
'$ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>',
'$ csdx cm:stacks:migration --file-path <migration/script/file/path> -k <api-key>',
'$ csdx cm:stacks:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>',
'$ csdx cm:stacks:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>',
'$ csdx cm:stacks:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>',
'$ csdx cm:stacks:migration --multiple --file-path <migration/scripts/dir/path> ',
'$ csdx cm:stacks:migration --alias <management-token-alias> --file-path <migration/script/file/path>',
];

static flags: FlagInput = {
Expand Down Expand Up @@ -79,37 +79,9 @@ export default class MigrationCommand extends Command {
description:
'This flag helps you to migrate multiple content files in a single instance. Mention the folder path where your migration script files are stored.',
}),

// To be deprecated
'api-key': flags.string({
description: 'With this flag add the API key of your stack.',
// dependsOn: ['authtoken'],
exclusive: ['alias'],
hidden: true,
}),
authtoken: flags.boolean({
description:
'Use this flag to use the auth token of the current session. After logging in CLI, an auth token is generated for each new session.',
dependsOn: ['api-key'],
exclusive: ['alias'],
hidden: true,
}),
'management-token-alias': flags.string({
description: 'Alias of the management token.',
exclusive: ['authtoken'],
hidden: true,
}),
filePath: flags.string({
description: 'Use this flag to provide the path of the file of the migration script provided by the user.',
hidden: true,
}),
multi: flags.boolean({
description: 'This flag helps you to migrate multiple content files in a single instance.',
hidden: true,
}),
};

static aliases: string[] = ['cm:migration'];
static aliases: string[] = [];

static usage: string =
'cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]';
Expand All @@ -118,11 +90,11 @@ export default class MigrationCommand extends Command {
// TODO: filePath validation required.
const { flags: migrationCommandFlags } = (await this.parse(MigrationCommand)) as any;
const branch = (migrationCommandFlags as any).branch;
const filePath = (migrationCommandFlags as any)['file-path'] || (migrationCommandFlags as any).filePath;
const multi = (migrationCommandFlags as any).multiple || (migrationCommandFlags as any).multi;
const filePath = (migrationCommandFlags as any)['file-path'];
const multi = (migrationCommandFlags as any).multiple;
const authtoken = isAuthenticated();
const apiKey = (migrationCommandFlags as any)['api-key'] || (migrationCommandFlags as any)['stack-api-key'];
const alias = (migrationCommandFlags as any)['alias'] || (migrationCommandFlags as any)['management-token-alias'];
const apiKey = (migrationCommandFlags as any)['stack-api-key'];
const alias = (migrationCommandFlags as any)['alias'];
const config = (migrationCommandFlags as any)['config'];

if (!authtoken && !alias) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ describe('Migration Command', () => {
expect(MigrationCommand.usage).to.include('migration');
});

it('should have aliases including cm:migration', () => {
it('should have empty aliases array (cm:migration alias removed)', () => {
expect(MigrationCommand.aliases).to.be.an('array');
expect(MigrationCommand.aliases).to.include('cm:migration');
expect(MigrationCommand.aliases).to.be.empty;
});
});

Expand Down
14 changes: 3 additions & 11 deletions packages/contentstack-seed/src/commands/cm/stacks/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class SeedCommand extends Command {
];

static usage =
'cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [-y] [--alias <value>] [--locale <value>]';
'cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [-y] [--alias <value>]';

static flags: FlagInput = {
repo: flags.string({
Expand Down Expand Up @@ -42,12 +42,6 @@ export default class SeedCommand extends Command {
required: false,
exclusive: ['stack-api-key'],
}),
'fetch-limit': flags.string({
description: 'Limit for number of organizations or stacks to be fetched.',
multiple: false,
required: false,
hidden: true,
}),
yes: flags.boolean({
char: 'y',
required: false,
Expand All @@ -58,9 +52,8 @@ export default class SeedCommand extends Command {
description: 'Alias of the management token',
}),
locale: flags.string({
description: 'Master Locale of the stack',
default: 'en-us',
hidden: true,
description: 'Master locale for stack creation',
}),
};

Expand All @@ -83,11 +76,10 @@ export default class SeedCommand extends Command {
orgUid: seedFlags.org,
stackUid: seedFlags['stack-api-key'],
stackName: seedFlags['stack-name'],
fetchLimit: seedFlags['fetch-limit'],
skipStackConfirmation: seedFlags.yes,
isAuthenticated: isAuthenticated(),
alias: managementTokenAlias,
master_locale: seedFlags['locale'],
master_locale: seedFlags.locale,
};

const listOfTokens = configHandler.get('tokens');
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-seed/src/seed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface ContentModelSeederOptions {
orgUid: string | undefined;
stackUid: string | undefined;
stackName: string | undefined;
fetchLimit: string | undefined;
fetchLimit?: string | undefined;
skipStackConfirmation: boolean | undefined;
isAuthenticated: boolean | false;
managementToken?: string | undefined;
Expand Down
5 changes: 0 additions & 5 deletions packages/contentstack-seed/src/seed/seed-stacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,4 @@ export const OFFICIAL_SEED_STACKS: OfficialSeedStack[] = [
owner: OFFICIAL_SEED_OWNER,
repo: 'compass-starter-stack',
},
{
displayName: 'Starter app',
owner: OFFICIAL_SEED_OWNER,
repo: 'stack-starter-app',
},
];
Loading
Loading