Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
javascript
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Jun 2021 at 12:28 UTC
Updated:
17 Aug 2021 at 10:34 UTC
Jump to comment: Most recent
Comments
Comment #2
nod_don't need webpack
Comment #4
nod_This will definitely not work with yarn2 but it's a problem for when we talk about yarn2 in core.
Comment #5
nod_Comment #6
nod_Comment #7
nod_Added js-cookie, css.escape and some comments to explain how things work.
Modernizr, CKEditor, and jQuery.ui are not in the scope since they require a custom compile step (we could just add them to the package.json file to know when there are updates).
Comment #8
justafishLooks good!
Comment #9
longwaveShould our runtime dependencies be listed as true dependencies rather than dev dependencies? That would also help keep them separated from our build dependencies.
Comment #10
nod_Added the automatic update of the version in core.libraries.yml. Had to use regex because the various yaml js libraries didn't support everything we use in this file and it was messing up the format when saving.
@#9 I think we had the discussion, let me try to find it.
Comment #11
nod_maybe doesn't answer everything but look at #3185289-14: Use package.json and rollup to manage third party JS libraries and below.
Comment #12
nod_As per the previous issue.
Comment #13
nod_Comment #14
longwaveI don't think the linked discussion quite answers my question - if these are dev dependencies, what would be a production dependency in the case of core? package.json is in the core directory so I assumed it was only intended for core developers; if you are using JavaScript elsewhere in a Drupal site you would have a separate package.json in your theme or wherever.
Comment #15
nod_There wouldn't be a production dependency, because Drupal doesn't require you to have nodejs installed to work, so we can't (won't) require people to do yarn/npm install to make Drupal work.
Comment #16
tom kondaWhen I using Node.js 14 LTS, file copying works successfully.
But, when I using Node.js 12 LTS, fails file copying because of undefined 'fs/promises' calling.
According to Node.js documentation, fs/promises is defined after Node.js 14.
I think below code will work on Node.js 12 and 14.
Comment #17
nod_yeah didn't pay attention to versions, feel free to update the MR :)
Comment #18
nod_taken care of it, thanks for the review :)
Comment #19
nod_Comment #20
nod_haha crossed post. Thanks for the fix :)
Comment #21
nod_Comment #22
nod_script updates the licence URL as well as the library version in the core.libraries.yml file.
Comment #23
nod_All good, put the same releases of js-cookie and joyride as in core. This copy/paste script is ready IMHO.
Comment #24
nod_Comment #25
nod_missed one tag from #3185289-16: Use package.json and rollup to manage third party JS libraries.
Comment #26
alexpottThis looks really really neat. So nice to not have to maintain these manually!
Here are some notes I made while reviewing the patch - all positives
Here are two questions I have from reviewing the patch:
Comment #27
nod_Thanks for having a look. to answer the two questions:
sourcesandsourcesContent, one with a list of file, and another one with the contents of each file (then all the map-stuff that makes everything works). We're changing the path of "virtual" files, so no problem either way. Only issue would be is someone was checking file hashes but then again i haven't heard of this for map files.Comment #28
longwaveThe questions were answered, no changes required that I can see. This looks like a neat solution to our JS dependency management, so let's get this RTBC.
Comment #29
catchThis looks really good to me, it's only a change for core developers, so if we run into problems later with it we can try to come up with a new system, but hopefully it'll be a good improvement with no drawbacks.
Comment #30
lauriiiI haven't reviewed this in detail yet but I like the overall approach. Do you think it would make sense to open a follow-up for adding a CI check that ensures that the vendor files are indeed generated by the tool? I think it's fine as is for the time being but it would help reduce some work since it's a step I always do when committing minified files.
Comment #32
larowlanCatch, Alex and I have reviewed this now - removing the tag
I've pushed some minor nit-picks to the branch.
This looks good to me, I think just a follow-up for #30 is all that remains.
Comment #33
nod_Package is language keyword so while it works like this I wanted to avoid any potential confusion down the line (we can't use destructuring directly with package for example)
If that is clearer like this, all good.
Comment #34
larowlanAh, I didn't realise it was a future reserved word, reverted that change and expanded the comment to explain why we use pack
Comment #35
nod_Added https://www.drupal.org/about/core/policies/core-change-policies/frontend...
Comment #36
catchShould have removed the RM review tag with #29.
Comment #37
larowlanComment #39
larowlanCommitted to 9.3.x, thanks all
Published change record
Comment #40
nod_now those issues are easy to do: #3225811: Update to js-cookie 3.0.1
Comment #41
daffie commentednpm install does not work any more after this MR landed. See: #3226441: npm install does not work for farbtastic and joyride with code being hard linked.