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

Vjp/use spago #122

Merged
merged 15 commits into from
Jun 3, 2020
Merged

Vjp/use spago #122

merged 15 commits into from
Jun 3, 2020

Conversation

vanceism7
Copy link
Contributor

@vanceism7 vanceism7 commented Jun 1, 2020

What does this pull request do?

Migrate ocelot away from bower to spago

@davezuch Im really not sure if I actually setup all the build scripts correctly or not. Let me know if theres something I need to change. The build portion is taking a pretty long time - 4:35 seconds when the build has already been cached. Im not sure why its taking so long. Spago outputs "build succeeded" and then proceeds to sit there silently for a long time. I guess the bundling is taking a really long time?

Alright after doing a bit of research, apparently spago doesn't pass rts_args to purs bundle correctly. So I bypassed it manually - the build time has sped up significantly but its still a bit slow all in all. 2 minutes is better than 6 though.
purescript/spago#580
purescript/spago#216

Let me know if this all looks good or if anything needs to be changed!

vanceism7 added 6 commits June 1, 2020 14:31
Manually adds packages missing from the main package set in packages.dhall
Also added a "setup" script. Because i've been bitten many times by forgetting
that "css" is a separate npm project which needs dependencies installed
@vanceism7 vanceism7 requested a review from davezuch June 1, 2020 23:23
@vanceism7
Copy link
Contributor Author

Ah wait, I think I omitted RTS flags. Let me try that and see if it speeds up

vanceism7 added 4 commits June 1, 2020 16:49
Spago always does a dependency installation check prior to attempting a build
spago doesn't forward RTS args to purs compile when using `spago bundle-app`, so
we bypass spagos bundle and use purs directly
Copy link
Member

@davezuch davezuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! Changes look good! I have a few comments, but they shouldn't be blocking.

package.json Outdated
Comment on lines 7 to 8
"postinstall": "",
"setup": "npm i && cd css && npm i",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a special npm command similar to postinstall is it? If this is simply intended as an alternative to running npm install, then maybe we can use postinstall instead? Something like:

Suggested change
"postinstall": "",
"setup": "npm i && cd css && npm i",
"postinstall": "cd css && npm install",

That way we don't have to remember this different command to run, as that wouldn't be much different as having to remember to install CSS dependencies.

As an aside, I'll try to find some time to move us to a better build system such as make so we wouldn't have to concern ourselves with whether dependencies are installed or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No theres nothing special about setup, its just a standard script. The problem with putting it in postInstall is it will cause the `install node/spago dependencies" to run longer even though there's the dependencies will already have been added.

Maybe a better alternative is to add everything in the setup script to the clean script. That way clean won't actually clobber out all the npm packages. What do you think? @davezuch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with putting it in postInstall is it will cause the `install node/spago dependencies" to run longer even though there's the dependencies will already have been added.

I'm not sure I follow. Are you worried that running npm install will take longer because now that will also include installing css dependencies when they've already been added? If they've already been added, then there won't be anything to install, so it shouldn't add much time.

Or are you worried about builds such as in Circle CI where the css dependencies aren't needed to begin with? In that case, I don't think it's a huge sacrifice, but if we can move to a better build setup as I talked about above, it also wouldn't be a concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha the latter - didn't want to increase the build-time on circle ci any further than it already has. If that doesn't seem like an issue, I can just throw it in postinstall. A better build system will help in the future anyhow

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, let's throw it in for now and see if the increased build time is worth the savings in not having to remember to install the css separately. At least from the perspective that we'll improve the build system soon.

@vanceism7 vanceism7 requested a review from davezuch June 3, 2020 18:41
package.json Outdated
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build-all": "yarn run build-ui && yarn run build-css",
"postinstall": "npm i && cd css && npm i",
"postinstall": "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The infinite loop was caused by the first npm i && . postinstall only runs after npm i is called so running it from a postinstall will result in an infinite loop.

With a postinstall of "cd css && npm i", you basically end up with:

alias npm i="npm i && cd css && npm i"

With a postinstall of just "npm i", you'd end up with something like:

alias npm i="npm i && npm i && npm i && npm i && npm && ..."

I'm not sure if my example is clear, but

package.json Outdated
Comment on lines 7 to 8
"postinstall": "",
"setup": "npm i && cd css && npm i",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, let's throw it in for now and see if the increased build time is worth the savings in not having to remember to install the css separately. At least from the perspective that we'll improve the build system soon.

Copy link
Member

@davezuch davezuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good! Thanks for making them! I have one inline comment about the postinstall hook. Feel free to merge this in either before or after addressing.

@vanceism7 vanceism7 merged commit c8c7107 into master Jun 3, 2020
@vanceism7 vanceism7 deleted the vjp/use-spago branch June 3, 2020 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants