Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/cardinal-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@refinedev/cli": patch
---

chore: use maintained `@types/cardinal` and remove ambient declaration (#7589)

Replaced custom ambient declaration in `cardinal.d.ts` with official `@types/cardinal` from DefinitelyTyped as a development dependency, ensuring clean type-checking and build compatibility.
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
},
"devDependencies": {
"@esbuild-plugins/node-resolve": "^0.1.4",
"@types/cardinal": "^2.1.1",
"@types/center-align": "^1.0.0",
"@types/dedent": "^0.7.0",
"@types/envinfo": "^7.8.1",
Expand Down
6 changes: 0 additions & 6 deletions packages/cli/src/definitions/cardinal.d.ts

This file was deleted.

31 changes: 31 additions & 0 deletions packages/cli/src/utils/swizzle/renderCodeMarkdown.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { renderCodeMarkdown } from "./renderCodeMarkdown";

describe("renderCodeMarkdown", () => {
it("should render boxed highlighted code without title", () => {
const code = "const a = 1;";
const result = renderCodeMarkdown(code);

expect(result).toBeDefined();
expect(result).toContain("const");
expect(result).toContain("1");
});

it("should render boxed highlighted code with title extracted from comment", () => {
const codeWithTitle =
"// title: MyComponent.tsx\nconst App = () => <div />;";
const result = renderCodeMarkdown(codeWithTitle);

expect(result).toBeDefined();
expect(result).toContain("MyComponent.tsx");
expect(result).toContain("App");
expect(result).toContain("div");
});

it("should fallback gracefully to raw code if highlighting throws on invalid syntax", () => {
const invalidCode = "function invalid( {";
const result = renderCodeMarkdown(invalidCode);

expect(result).toBeDefined();
expect(result).toContain("function invalid( {");
});
});
Loading