Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class Install extends AppCLIBaseCommand {
description: commonMsg.APP_UID,
}),
"stack-api-key": flags.string({
char: "k",
description: commonMsg.STACK_API_KEY,
}),
...AppCLIBaseCommand.baseFlags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class Reinstall extends AppCLIBaseCommand {
description: commonMsg.APP_UID,
}),
"stack-api-key": flags.string({
char: "k",
description: commonMsg.STACK_API_KEY,
}),
...AppCLIBaseCommand.baseFlags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,24 @@ export default class ValidateRegex extends Command {
static examples = [
'$ csdx cm:stacks:validate-regex',
'$ csdx cm:stacks:validate-regex -a <management_token_alias>',
'$ csdx cm:stacks:validate-regex -c',
'$ csdx cm:stacks:validate-regex -g',
'$ csdx cm:stacks:validate-regex -f <path/to/the/directory>',
'$ csdx cm:stacks:validate-regex -a <management_token_alias> -c -g',
'$ csdx cm:stacks:validate-regex -a <management_token_alias> -c -g -f <path/to/the/directory>',
'$ csdx cm:stacks:validate-regex --contentType',
'$ csdx cm:stacks:validate-regex --globalField',
'$ csdx cm:stacks:validate-regex --filePath <path/to/the/directory>',
'$ csdx cm:stacks:validate-regex -a <management_token_alias> --contentType --globalField',
'$ csdx cm:stacks:validate-regex -a <management_token_alias> --contentType --globalField --filePath <path/to/the/directory>',
]
static flags: any = {
alias: flags.string({
char: 'a',
description: regexMessages.command.alias,
}),
contentType: flags.boolean({
char: 'c',
description: regexMessages.command.contentTypes,
}),
filePath: flags.string({
char: 'f',
description: regexMessages.command.filePath,
}),
globalField: flags.boolean({
char: 'g',
description: regexMessages.command.globalFields,
}),
}
Expand Down
15 changes: 6 additions & 9 deletions packages/contentstack-cli-tsgen/src/commands/tsgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
static description = "Generate TypeScript typings from a Stack";

static examples = [
'$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts"',
'$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" -p "I"',
'$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" --no-doc',
'$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" --include-referenced-entry',
'$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" --api-type graphql',
'$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" --api-type graphql --namespace "GraphQL" ',
'$ csdx tsgen -a "delivery token alias" --output "contentstack/generated.d.ts"',
'$ csdx tsgen -a "delivery token alias" --output "contentstack/generated.d.ts" --prefix "I"',
'$ csdx tsgen -a "delivery token alias" --output "contentstack/generated.d.ts" --no-doc',
'$ csdx tsgen -a "delivery token alias" --output "contentstack/generated.d.ts" --include-referenced-entry',
'$ csdx tsgen -a "delivery token alias" --output "contentstack/generated.d.ts" --api-type graphql',
'$ csdx tsgen -a "delivery token alias" --output "contentstack/generated.d.ts" --api-type graphql --namespace "GraphQL" ',
];

// Check if a region is a default Contentstack region
Expand All @@ -55,15 +55,13 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
}),
Comment thread
cs-raj marked this conversation as resolved.

output: flags.string({
char: "o",
description: "full path to output",
hidden: false,
multiple: false,
required: true,
}),

prefix: flags.string({
char: "p",
description: 'interface prefix, e.g. "I"',
hidden: false,
multiple: false,
Expand All @@ -72,7 +70,6 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
}),

doc: flags.boolean({
char: "d",
description: "include documentation comments",
default: true,
allowNo: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Integration Test for tsgen command", () => {
// Test case 1: Generate TypeScript types with default flags
it("should generate TypeScript types with the default flags", () => {
const cmd = "csdx";
const args = ["tsgen", "-a", tokenAlias!, "-o", outputFilePath];
const args = ["tsgen", "-a", tokenAlias!, "--output", outputFilePath];
Comment thread
cs-raj marked this conversation as resolved.

const result = spawnSync(cmd, args, { encoding: "utf-8" });

Expand All @@ -44,9 +44,9 @@ describe("Integration Test for tsgen command", () => {
"tsgen",
"-a",
tokenAlias!,
"-o",
"--output",
outputFilePath,
"-p",
"--prefix",
prefix,
];

Expand All @@ -72,7 +72,7 @@ describe("Integration Test for tsgen command", () => {
// Test case 3: Generate TypeScript types without documentation comments
it("should generate TypeScript types without documentation", () => {
const cmd = "csdx";
const args = ["tsgen", "-a", tokenAlias!, "-o", outputFilePath, "--no-doc"];
const args = ["tsgen", "-a", tokenAlias!, "--output", outputFilePath, "--no-doc"];

const result = spawnSync(cmd, args, { encoding: "utf-8" });

Expand All @@ -90,7 +90,7 @@ describe("Integration Test for tsgen command", () => {
"tsgen",
"-a",
tokenAlias!,
"-o",
"--output",
outputFilePath,
"--include-system-fields",
];
Expand All @@ -108,7 +108,7 @@ describe("Integration Test for tsgen command", () => {
// Test case 5: Handling of invalid token alias
it("should fail with an invalid token alias", () => {
const cmd = "csdx";
const args = ["tsgen", "-a", "invalid_alias", "-o", outputFilePath];
const args = ["tsgen", "-a", "invalid_alias", "--output", outputFilePath];

const result = spawnSync(cmd, args, { encoding: "utf-8" });

Expand All @@ -124,7 +124,7 @@ describe("Integration Test for tsgen command", () => {
"tsgen",
"-a",
tokenAlias!,
"-o",
"--output",
outputFilePath,
"--api-type",
"graphql",
Expand All @@ -147,7 +147,7 @@ describe("Integration Test for tsgen command", () => {
"tsgen",
"-a",
tokenAlias!,
"-o",
"--output",
outputFilePath,
"--api-type",
"graphql",
Expand All @@ -171,7 +171,7 @@ describe("Integration Test for tsgen command", () => {
"tsgen",
"-a",
"invalid_alias",
"-o",
"--output",
outputFilePath,
"--api-type",
"graphql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export default class MigrationCommand extends Command {

// To be deprecated
'api-key': flags.string({
char: 'k',
description: 'With this flag add the API key of your stack.',
// dependsOn: ['authtoken'],
exclusive: ['alias'],
Expand Down
Loading