Skip to content

Commit 56b5a2e

Browse files
Merge pull request #251 from contentstack/fix/merge-conflicts
Fix/merge conflicts
2 parents a59b8fd + ac90bb2 commit 56b5a2e

File tree

5 files changed

+21
-38
lines changed

5 files changed

+21
-38
lines changed

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fileignoreconfig:
77
- filename: src/commands/tsgen.ts
88
checksum: 5817a6320d368fb82354709962cdb9d357c6dcba870ba53bf21eade9708505ba
99
- filename: package-lock.json
10-
checksum: dd92a547e2cd5cfa522f5a27b0946c0686d144fb50f058f9e05c0f7125f70574
10+
checksum: 1fb8fa608b49d45308537a8e296caaa0b87e94ef5cdd3f5435fffed67bdc3353
1111
- filename: src/lib/helper.ts
1212
checksum: f71633c99463fdf8da3708f4fe8736bcb9ad32595e4977af5ebab5af4b496395
1313
version: "1.0"

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"author": "Michael Davis",
66
"bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues",
77
"dependencies": {
8-
"@contentstack/cli-command": "^1.5.0",
9-
"@contentstack/cli-utilities": "^1.11.0",
8+
"@contentstack/cli-command": "^1.6.1",
9+
"@contentstack/cli-utilities": "^1.14.4",
1010
"@contentstack/types-generator": "^3.8.0",
1111
"dotenv": "^16.6.1"
1212
},

src/commands/tsgen.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Command } from "@contentstack/cli-command";
2-
import { flags, FlagInput } from "@contentstack/cli-utilities";
2+
import { flags, FlagInput, log } from "@contentstack/cli-utilities";
33
import * as path from "path";
44
import * as fs from "fs";
55
import { cliux } from "@contentstack/cli-utilities";
@@ -170,6 +170,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
170170
token: config.token,
171171
environment: config.environment,
172172
namespace: namespace,
173+
logger: log,
173174
};
174175

175176
// Add region or host based on whether it's a custom region
@@ -207,6 +208,7 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
207208
systemFields: includeSystemFields,
208209
isEditableTags: includeEditableTags,
209210
includeReferencedEntry,
211+
logger: log,
210212
});
211213

212214
fs.writeFileSync(outputPath, result || "");
@@ -219,24 +221,16 @@ export default class TypeScriptCodeGeneratorCommand extends Command {
219221
"Generation completed successfully with partial schema",
220222
)
221223
) {
222-
cliux.print("", {});
223-
cliux.print(
224-
"Type generation completed successfully with partial schema!",
225-
{ color: "green", bold: true },
224+
cliux.print("");
225+
log.success("Type generation completed successfully with partial schema!");
226+
log.warn(
227+
"Some content types were skipped due to validation issues, but types were generated for valid content types."
226228
);
227-
cliux.print(
228-
"Some content types were skipped due to validation issues, but types were generated for valid content types.",
229-
{ color: "yellow" },
230-
);
231-
cliux.print(
232-
"Check the output above for details on what was skipped and suggestions for fixing issues.",
233-
{ color: "cyan" },
229+
log.info(
230+
"Check the output above for details on what was skipped and suggestions for fixing issues."
234231
);
235232
} else {
236-
cliux.print(
237-
`Successfully added the Content Types to '${outputPath}'.`,
238-
{ color: "green" },
239-
);
233+
log.success(`Successfully added the Content Types to '${outputPath}'.`);
240234
}
241235

242236
// this.log(`Wrote ${outputPath} Content Types to '${result.outputPath}'.`)

src/lib/helper.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cliux } from "@contentstack/cli-utilities";
1+
import { log } from "@contentstack/cli-utilities";
22

33
export const sanitizePath = (str: string) => {
44
return str
@@ -32,10 +32,7 @@ export const printFormattedError = (error: FormattedError, context: string) => {
3232
error.error_message.includes("numeric identifiers")
3333
) {
3434
// Just print our detailed message as-is, no extra formatting
35-
cliux.print(error.error_message, {
36-
color: "red",
37-
bold: true,
38-
});
35+
log.error(error.error_message);
3936
return;
4037
}
4138

@@ -83,20 +80,12 @@ export const printFormattedError = (error: FormattedError, context: string) => {
8380
}
8481

8582
// Print formatted error output
86-
cliux.print(`Type generation failed: ${errorMessage}`, {
87-
color: "red",
88-
bold: true,
89-
});
83+
log.error(`Type generation failed: ${errorMessage}`);
9084

9185
if (hint) {
92-
cliux.print(`Tip: ${hint}`, { color: "yellow" });
86+
log.warn(`Tip: ${hint}`);
9387
}
9488

95-
cliux.print(`Error context: ${context}`, {
96-
color: "cyan",
97-
});
98-
99-
cliux.print(`Timestamp: ${error?.timestamp || new Date().toISOString()}`, {
100-
color: "gray",
101-
});
89+
log.info(`Error context: ${context}`);
90+
log.info(`Timestamp: ${error?.timestamp || new Date().toISOString()}`);
10291
};

0 commit comments

Comments
 (0)