Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add react wrappers #1249

Closed
wants to merge 11 commits into from
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ rhds.min.js
*LEGAL.txt
*.tgz

/elements/react

# e2e
test-results
*.ts-snapshots
Expand Down
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,21 @@
"analyze",
"compile",
"bundle",
"docs"
"docs",
"build:react"
]
},
"build:react": {
"command": "ts-node --esm scripts/generate-react-wrappers.ts",
"dependencies": [
"analyze"
],
"files": [
"custom-elements.json",
"scripts/generate-react-wrappers.ts"
],
"output": [
"react/**/*"
]
},
"compile": {
Expand All @@ -117,6 +131,7 @@
"bundle": {
"command": "node scripts/bundle.js"
},

"analyze": {
"command": "cem analyze && node scripts/cem-tokens.js && node scripts/system-tokens.js",
"files": [
Expand Down
6 changes: 6 additions & 0 deletions scripts/generate-react-wrappers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { generateReactWrappers } from '@patternfly/pfe-tools/react/generate-wrappers.js';
bennypowers marked this conversation as resolved.
Show resolved Hide resolved

const inURL = new URL('../custom-elements.json', import.meta.url);
const outURL = new URL('../elements/react/', import.meta.url);

await generateReactWrappers(inURL, outURL);
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"importHelpers": true,
"incremental": true,
"inlineSources": true,
"module": "es2020",
"module": "es2022",
"moduleResolution": "node",
"noEmitOnError": false,
"preserveValueImports": true,
Expand Down Expand Up @@ -58,6 +58,7 @@
"DOM",
"es2015.iterable",
"es2020",
"es2022",
"es5",
"es6",
"ScriptHost"
Expand Down
Loading