The Wayback Machine - https://web.archive.org/web/20200916181240/https://github.com/metacpan/metacpan-web/pull/2329
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

Proposal for how to update deps, build the OpenLayers-using JS with webpack #2329

Open
wants to merge 3 commits into
base: master
from

Conversation

@mohawk2
Copy link
Contributor

mohawk2 commented Jun 26, 2020

This will hopefully resolve the last CodeQL-identified issue in our JS.

@mohawk2
Copy link
Contributor Author

mohawk2 commented Jun 26, 2020

This revealed a minor gremlin in the latest OpenLayers. I have opened a PR to fix that: openlayers/openlayers#11224

@mohawk2 mohawk2 force-pushed the mohawk2:update-deps branch from 0bee870 to 6f811af Jun 27, 2020
Copy link
Member

oalders left a comment

On the whole, I'm in favour of updating our deps. Is there a compelling reason not to use yarn to do this? If we do this and keep the deps in package.json then we can take advantage of dependabot for helping with updates.

@mohawk2
Copy link
Contributor Author

mohawk2 commented Jun 28, 2020

That is an excellent idea! Much more JS-idiomatic. The existing package.json is a bit sparse, so I'd need a bit of a pointer on how to get started?

@haarg
Copy link
Member

haarg commented Jun 28, 2020

Using package.json/yarn would be reasonable, but our deployment doesn't handle that at this time, so it would need some puppet work.

@oalders
Copy link
Member

oalders commented Jun 28, 2020

I think, for the time being, we could update package.json and then manually run yarn install --modules-folder foo/bar. That would leave us with vendored deps in the repository and an easy way to manually update them. Also dependabot could check for newer versions etc. That would allow us to bypass puppet for now.

https://classic.yarnpkg.com/en/docs/cli/install/#toc-yarn-install-modules-folder

@mohawk2 it should just be a matter of running yarn add to update package.json and add the appropriate entries to yarn.lock. See https://classic.yarnpkg.com/en/docs/usage

@mohawk2 mohawk2 force-pushed the mohawk2:update-deps branch from 6f811af to 0f83646 Jun 30, 2020
@mohawk2
Copy link
Contributor Author

mohawk2 commented Jun 30, 2020

Now there is a yarn script, utilised by bin/update-deps, that rebuilds the ol-using JS. The generated JS file, despite the doomy warnings of webpack because it's ~250k, is still about a third of the previous version, because it only incorporates what it actually uses. It's still checked into git for the present time.

This PR should also show the way towards auto-building / updating all our other JS code too (move them into js-src, add to webpack.config.js for building back into static/js). From here, I believe the way forward would be to generate all the relevant assets, which would then be incorporated in the -web Docker image.

@haarg
Copy link
Member

haarg commented Jun 30, 2020

This requires committing build artifacts to the repository, which I am not a fan of. It also doesn't set up the built files to be properly cacheable.

What errors were you seeing with the tooltip and dropdown menu code? I don't see any errors, but either way just wrapping them in a try is the wrong approach.

@haarg haarg mentioned this pull request Jun 30, 2020
@mohawk2 mohawk2 force-pushed the mohawk2:update-deps branch from 0f83646 to 5abd872 Jul 1, 2020
@mohawk2
Copy link
Contributor Author

mohawk2 commented Jul 1, 2020

It seems the tooltip/dropdown errors were just caused by the map having failed to load due to other problems. They don't appear now, and the JS changes to suppress them have been dropped.

This PR is now in somewhat of an intermediate state - it updates the vendored and versioned ol.css, albeit from the unminified version in node_modules. Obviously the end-state is for that CSS plus the generated tree-shaken mirror.js to not be committed anymore, and to have hashed names suitable for eternal caching (I assume webpack makes that easy). I gather for that to work, then currently yarn would need to be on the production machines? Else yarn would just need to be on the machine that creates the Docker image, possibly that would be in the GitHub workflow.

@mohawk2 mohawk2 changed the title Update deps script, update OpenLayers from 2.12 to 6.3.1 Proposal for how to update deps, build the OpenLayers-using JS with webpack Aug 4, 2020
@mohawk2 mohawk2 force-pushed the mohawk2:update-deps branch from 5abd872 to d1060d2 Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.