Right now, the tota11y.libraries.yml
for this module is setup to load the tota11y JS library from /libraries/tota11y/tota11y.min.js
. However, if you are using composer.json to manage your dependencies and download the entire tota11y library from Github, it is hard to configure the library to be downloaded and placed in that folder structure.
Sample composer.json
{
"repositories": [
{
"type": "package",
"package": {
"name": "local/tota11y",
"version": "dev-master",
"type": "drupal-library",
"dist": {
"type": "zip",
"url": "https://github.com/Khan/tota11y/archive/master.zip"
}
}
}
]
}
When the tota11y JS library is downloaded based on this composer.json, the minified copy of the tota11y library will be in: /libraries/tota11y/build/tota11y.min.js
. So I propose that we change the path to the library in the libraries.yml to match this path.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2857103-tota11y-use-dist-library-path-10.patch | 305 bytes | codebymikey |
#2 | change-library-path-2857103-2.patch | 305 bytes | mrkdboyd |
Comments
Comment #2
mrkdboyd CreditAttribution: mrkdboyd commentedHere is a patch to change the library path
Comment #3
mikebell_ CreditAttribution: mikebell_ at Convivio commentedI've set aside some time tomorrow (Friday) to review this. Thanks!
Comment #4
mikebell_ CreditAttribution: mikebell_ at Convivio commentedI like this approach, I think we can take it a step further as well by including the repository and require in the existing composer.json so you only need to run composer require drupal/tota11y.
We need to consider backwards compatibility for existing users (yes all 3 of them ;)).
Comment #5
mrkdboyd CreditAttribution: mrkdboyd commentedYeah, I agree about adding the library to the composer.json for the module.
I'm not sure how we could maintain backwards compatibility though. If we include these changes as part of an 8.x-2.0 release, rather than a point release for 1.x, I think breaking changes are considered acceptable? And of course, we could document the changes well for anyone updating. Let me know what you think.
And I can create a new patch that includes adding the library to the module's composer.json.
Comment #6
mrkdboyd CreditAttribution: mrkdboyd commentedUpon further review, it may not be possible to use the module's composer.json to require the library. See #2836244: Update documentation for installing via composer and also #2706433: Composer dist problem - with chosen composer.json (false github auth problem), particularly comment #29.
The best approach may just be to document how to add the dependency for the tota11y library to your project's root composer.json, as in this patch: https://www.drupal.org/files/issues/chosen-fix_composer_installation-283...
Comment #8
mikebell_ CreditAttribution: mikebell_ at Convivio commentedReally sorry for being so slow on this.
I've pushed a new branch with these changes in 8.x-2.x
I'll try and test it out fully before making a new release.
Comment #9
B-Prod CreditAttribution: B-Prod commentedThis works file and fix error message when installed using Composer.
Comment #10
codebymikey CreditAttribution: codebymikey at Zodiac Media commentedThe url path should now be
/libraries/tota11y/dist/tota11y.min.js
for the latest version on npm https://registry.npmjs.org/@khanacademy/tota11y/-/tota11y-0.2.0.tgzComment #11
ikit-claw CreditAttribution: ikit-claw as a volunteer commentedMerged into 2.0.x-dev If you would like to test it that would be great. https://www.drupal.org/project/tota11y/releases/2.0.x-dev