-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Add xo linter, ava test framework, webpack build tool, README #147
Conversation
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.
This is an excellent first step!
Just added some precommit hooks to automatically lint, fix any lint issues, and then run tests. : ) Unleash the robots! |
OK, this sounds really good :)
|
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.
Think the instructions should be in a wiki page. Other than that would just like answers to the questions I've just posted ;)
Webpack will allow us to keep the HUD CSP. The way webpack will work is that we're going to rewrite all of our html,js,css files into .vue files that define all three of those aspects for a single "component". Then we'll use webpack to transpile those .vue files into pure js which is what the HUD will actually use. And because we've transpiled into nonsense javascript before we load them in the browser we don't need to interpret Vue in the browser, which won't trigger the CSP. (Better explanation and links here)
There won't be any js source files for the UI, just vue components. (I believe) Which means we can build everytime we make a change to see the results. But I'm pretty sure there are also development tools (which I believe is what you're referring to as the 'dev' option) that simplify this process so you don't have to build everytime. |
Is there a way we can keep the current way we work as a 'dev' option?
I really want to make 'hacking the HUD accessible' and being able to make changes to it without having to install any other software (like webpack) is my goal. For 'serious' HUD development I'm absolutely fine with us requiring extra tools to be installed. Does that make sense? |
What are the final steps I need to take to get this through? I was thinking I'd remove the husky dependency, and then it should be good to go ya? Or @psiinon were there other changes i need to make on this PR |
For a start I need to make sure I can actually build the HUD with these changes applies, and work out if they have any other unexpected consequences. |
Ah definitely. Yeah I can glue ant and npm together so that you can invoke the npm commands from ant. To be clear, in this PR we are not using the webpack build pipeline yet. I was going to implement that along with refactoring to components. For now it just includes the library and implements the linting & testing that we want. So I'll expose the linter & testing to ant. And then expose webpack later. :) I'll also add further instructions on the wiki. Did you mean to link that FAQ for the API key? |
@psiinon let me know what else I need to add here or if I missed something. : ) I know @Pamplemousse has some changes depending on this one. |
Which version of I was expecting an additional Ant target to execute |
If I read correctly, there is a way to specify a node and npm versions for our package: docs.npmjs.com/files/package.json#engines. I think the Ant target does not have to be on this PR ; But it has to follow soon. |
Sorry, no, I meant to link to https://github.com/psiinon/zap-hud/wiki/Developing-with-the-HUD
lint-all-hud works, but not surprisingly reports loads of errors. Thats fine, we should def address these. lint-staged-hud fails with:
|
OK, my bad, I hadnt run "npm install" as details in the instructions :D |
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 good with this, although you should fix the comment as per thc202's suggestion.
Would also be good to document how we can fix the lint errors as efficiently as possible, but that can be in the wiki so doesnt have to be part of this PR.
Thank you everybody for your reviews! @thc202 I'll fix those two notes you added. As for adding @psiinon if we run |
Oh and for npm versions, I'm not sure what version we should require. We can follow @Pamplemousse suggestion to add it to the package.json file. |
Thank you! |
This adds
xo
as our linting tool,ava
as our testing framework,webpack
to transpile our Vue, and creates a simple README.I ran the linter and I loved the results from it. This change doesn't include that run or the automatic changes. I'm not sure the best way, but it may be just to run it, make the 10,0000 changes and do it all at once. Either way that's not a part of this PR.
I also only included a sample test file, but
ava
tests are very simple to write.Finally, although this PR adds webpack, I still need transform our html, js, and css files into Vue components that would then be transpiled by webpack back into usable js.