-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat(react-property): create package for HTML and SVG DOM property configs #9
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
Conversation
Save to `package.json` devDependencies
These are React properties
These are React properties
The build script is similar to HTML DOM config except SVG does not have boolean or overloaded boolean attributes/properties.
And add "main" field in `package.json` so the file is included during npm publish.
talbet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice. You must have a lot of familiarity with the React internals, I've looked at them a bit, but wouldn't have come up with this. A few comments, but nothing I can see that would block this from going in.
| try { | ||
| fs.mkdirSync(LIB_DIR); | ||
| } catch (error) { | ||
| // throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the error be re-thrown here if it is not a "directory already exists" error?
if (error.code !== 'EEXIST') throw error;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
|
|
||
| /** | ||
| * HTML DOM property config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add extra context to this comment? I wasn't sure what it was for at first. Something along the lines of: "an object containing HTML attributes and how they should be mapped to React props"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the wording slightly. Let me know if it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think this makes it clearer.
| try { | ||
| fs.mkdirSync(LIB_DIR); | ||
| } catch (error) { | ||
| // throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above, we could handle this error if it is not expected
if (error.code !== 'EEXIST') throw error;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var overloadedBooleanProperties = require('../../lib/html/overloaded-boolean-properties'); | ||
|
|
||
| var attributeMap = {}; | ||
| var attributeName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 I haven't used var for such a long time I probably would have forgotten the scoping complications of var and loops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'm considering rewriting this to TypeScript but that can be an enhancement done later.
|
Released and published # npm
npm i -S react-property@0.1.0
# yarn
yarn add react-property@0.1.0 |
Relates to remarkablemark/html-react-parser#107
Would love to get your review @talbet