Skip to content

Commit e360fae

Browse files
authored
Merge pull request #4819 from easyops-cn/steve/v3-fix-jsx
fix(): use jsx.ts instead of jsx.d.ts for source file
2 parents b82dcf1 + 60fe5b7 commit e360fae

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/yo/src/plopfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,15 @@ export default function (
318318
const jsxDtsFile = path.join(
319319
bricksDir,
320320
answers.pkgName,
321-
"src/jsx.d.ts"
321+
"src/jsx.ts"
322322
);
323323
/** @type {string} */
324324
let jsxDtsContent;
325325
if (!existsSync(jsxDtsFile)) {
326326
// jsxDtsContent = `import type { DetailedHTMLProps, HTMLAttributes } from "react"`;
327327
const jsxDtsTemplateFile = path.join(
328328
__dirname,
329-
"templates/bricks/src/jsx.d.ts.hbs"
329+
"templates/bricks/src/jsx.ts.hbs"
330330
);
331331
jsxDtsContent = await readFile(jsxDtsTemplateFile, "utf-8");
332332
} else {
@@ -361,14 +361,14 @@ export default function (
361361
const newJsxDts = jsxDtsContent.replace(pattern, replacement);
362362
if (newJsxDts === jsxDtsContent) {
363363
throw new Error(
364-
`Failed to add definition in jsx.d.ts for ${tagName}.`
364+
`Failed to add definition in jsx.ts for ${tagName}.`
365365
);
366366
}
367367
jsxDtsContent = newJsxDts;
368368
}
369369

370370
await writeFile(jsxDtsFile, jsxDtsContent);
371-
return `Updated jsx.d.ts to include ${tagName} definition.`;
371+
return `Updated jsx.ts to include ${tagName} definition.`;
372372
},
373373
async function modifyCommonBricksJson(answers) {
374374
if (answers.brickType === "common") {

packages/yo/src/templates/bricks/package.json.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"start": "cross-env NODE_ENV=development build-next-bricks --watch",
2626
"build": "npm run build:main && npm run build:types",
2727
"build:main": "cross-env NODE_ENV=production build-next-bricks",
28-
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist-types --project tsconfig.json && copy-jsx-d-ts",
28+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist-types --project tsconfig.json",
2929
"build:manifest": "cross-env NODE_ENV=production build-next-bricks --manifest-only",
3030
"test": "cross-env NODE_ENV='test' test-next",
3131
"test:ci": "cross-env NODE_ENV='test' CI=true test-next",

packages/yo/src/templates/bricks/src/jsx.d.ts.hbs renamed to packages/yo/src/templates/bricks/src/jsx.ts.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { DetailedHTMLProps, HTMLAttributes } from "react";
22

33
declare global {
4+
// eslint-disable-next-line @typescript-eslint/no-namespace
45
namespace JSX {
56
interface IntrinsicElements {
67
// Extend with brick definitions here

0 commit comments

Comments
 (0)