Skip to content
Merged
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
8 changes: 4 additions & 4 deletions packages/yo/src/plopfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,15 @@ export default function (
const jsxDtsFile = path.join(
bricksDir,
answers.pkgName,
"src/jsx.d.ts"
"src/jsx.ts"
);
/** @type {string} */
let jsxDtsContent;
if (!existsSync(jsxDtsFile)) {
// jsxDtsContent = `import type { DetailedHTMLProps, HTMLAttributes } from "react"`;
const jsxDtsTemplateFile = path.join(
__dirname,
"templates/bricks/src/jsx.d.ts.hbs"
"templates/bricks/src/jsx.ts.hbs"
);
jsxDtsContent = await readFile(jsxDtsTemplateFile, "utf-8");
} else {
Expand Down Expand Up @@ -361,14 +361,14 @@ export default function (
const newJsxDts = jsxDtsContent.replace(pattern, replacement);
if (newJsxDts === jsxDtsContent) {
throw new Error(
`Failed to add definition in jsx.d.ts for ${tagName}.`
`Failed to add definition in jsx.ts for ${tagName}.`
);
}
jsxDtsContent = newJsxDts;
}

await writeFile(jsxDtsFile, jsxDtsContent);
return `Updated jsx.d.ts to include ${tagName} definition.`;
return `Updated jsx.ts to include ${tagName} definition.`;
},
async function modifyCommonBricksJson(answers) {
if (answers.brickType === "common") {
Expand Down
2 changes: 1 addition & 1 deletion packages/yo/src/templates/bricks/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"start": "cross-env NODE_ENV=development build-next-bricks --watch",
"build": "npm run build:main && npm run build:types",
"build:main": "cross-env NODE_ENV=production build-next-bricks",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist-types --project tsconfig.json && copy-jsx-d-ts",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist-types --project tsconfig.json",
"build:manifest": "cross-env NODE_ENV=production build-next-bricks --manifest-only",
"test": "cross-env NODE_ENV='test' test-next",
"test:ci": "cross-env NODE_ENV='test' CI=true test-next",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { DetailedHTMLProps, HTMLAttributes } from "react";

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace JSX {
interface IntrinsicElements {
// Extend with brick definitions here
Expand Down
Loading