Skip to content

Commit

Permalink
FEAT: added configurations for web components
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeriRoijenga committed Jan 10, 2025
1 parent 4ecd51e commit a01c757
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 42 deletions.
3 changes: 2 additions & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"tslib": "2.8.1",
"typescript": "5.7.2",
"vite": "6.0.3",
"vite-plugin-dts": "4.3.0"
"vite-plugin-dts": "4.3.0",
"vite-plugin-static-copy": "2.2.0"
},
"dependencies": {
"react": "19.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,3 @@ export class HeroWebComponent extends BaseWebComponent {
);
}
}

// const Hero: FC<HeroProps> = ({ title, description }) => {
// // Create and return the custom web component
// const webComponent = React.createElement('hero-element', {
// title,
// description,
// });

// return <div>{webComponent}</div>;
// };

// customElements.define('hero-element', HeroElement);

// const HeroComponent: FC<HeroProps> = (props) => {
// return <rhc-hero {...props} />;
// };

// export default HeroComponent;
9 changes: 0 additions & 9 deletions packages/web-components/src/types/global.d.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/web-components/src/types/hero.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/web-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"jsx": "react-jsx",
"skipLibCheck": true
},
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
"include": ["**/*.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["**/node_modules/*", "dist", "loader", "**/*.spec.ts", "**/*.spec.tsx"]
}
File renamed without changes.
10 changes: 10 additions & 0 deletions packages/web-components/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable no-unused-vars */
import React from 'react';

declare global {
namespace JSX {
interface IntrinsicElements {
'rhc-hero': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { viteStaticCopy } from 'vite-plugin-static-copy';

export default defineConfig({
build: {
Expand All @@ -21,5 +22,13 @@ export default defineConfig({
insertTypesEntry: true,
rollupTypes: true,
}),
viteStaticCopy({
targets: [
{
src: 'types/*.d.ts',
dest: 'types',
},
],
}),
],
});
29 changes: 23 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a01c757

Please sign in to comment.