-
Notifications
You must be signed in to change notification settings - Fork 18
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
Install us-form-system peerDependencies as devDependencies #4
Conversation
… version of us-forms-system
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 tested with the react and formation reps moved to dependencies, and without the uswds dependency, and it seemed to build/run fine. here.
package.json
Outdated
@@ -15,20 +15,23 @@ | |||
"license": "ISC", | |||
"homepage": "", | |||
"devDependencies": { | |||
"@department-of-veterans-affairs/formation": "^0.8.0", |
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 think this should be a dependency? It's referenced in
import ProgressButton from '@department-of-veterans-affairs/formation/ProgressButton'; |
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.
@dmethvin-gov I think react
can remain a devDependency? In vets-website we install it as a devDependency, as does create-react-app. I believe this is because we're using webpack to create a static bundle as part of the build step, but I'm not 100% positive. Still trying to understand this better.
package.json
Outdated
"babel-cli": "^6.26.0", | ||
"babel-loader": "^7.1.4", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"css-loader": "^0.28.11", | ||
"react": "^15.6.2", |
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.
Same with these two, I think they're dependencies.
"style-loader": "^0.21.0", | ||
"svg-url-loader": "^2.3.2", | ||
"url-loader": "^1.0.1", | ||
"uswds": "^1.6.6", |
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 don't see uswds
referenced at all in the starter app so I don't think it needs to be here. It gets pulled in indirectly via us-form-system.
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.
Hm I'm not able to run the app without having uswds installed locally; styles.css
from us-forms-system references images that come from the node module for uswds. If I run npm start
locally on this app I get errors. I already have a separate ticket to look into the best way to import uswds images (usds/us-forms-system#66), but for now I think we still need to install uswds as a devDependency. If you have suggestions for the images problem please feel free to comment in that other ticket!
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'm not seeing any image errors when I pull the current HEAD, remove node_modules, move the two react dependencies, npm install, and npm start. I do see that it's unable to find the fonts.
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 think you need to pull this branch in order to see the issue, not HEAD.
OK, gotcha. Let me look at that, the app definitely shouldn't be the middleman here but I'm not sure how to avoid it at the moment. I'll comment over on that ticket. |
@dmethvin-gov do you mind taking another look at this? I reinstalled uswds because for me I was getting build errors without it when I tried to run |
When I pull this in and rebuild I don't get any errors, which is good. The USWDS dependency still seems strange to me. The way I've always understood dependencies is that if a project needs something, directly, at runtime (for example React) then it should be in So if USWDS is a peer dependency in us-forms-system it would seem like we should use uswds directly in the app itself. Perhaps the starter is a degenerative case since we're using the forms library in a skeletal form. Or maybe it's a sign we need to refactor some of these parts; in a real app it's likely that the developer would want to modify the default USWDS styles which means they'd either need to have a modified USWDS package or they would need to override the USWDS styles and fonts in some additional CSS. In any case let's land this for now and I'll continue to get to know how this works. |
@dmethvin-gov I think you're totally right. Ideally, we wouldn't need USWDS installed if we're not calling it directly from within this app. I think it has to do with how I've imported the css and images, which I know we have separate tickets for to refactor. So I will merge this now and hopefully we will improve this through the other tickets. |
This PR does 2 things: