- Issue created by @Rajab Natshah
- π―π΄Jordan Rajab Natshah Jordan
OPTION #2 is my preferred method
The jquery.fancytree library is in https://www.npmjs.com
Which allows us to get npm-asset/jquery.fancytree using the composer - π―π΄Jordan Rajab Natshah Jordan
OPTION #2:
Define npm-asset repository in the
composer.json
file, to allow downloading the CKEditor Anchor Link JavaScript library to the correct folder:1. Configure with composer commands by following steps.
composer config repositories.assets composer https://asset-packagist.org composer config --unset repositories.0 composer config repositories.drupal composer https://packages.drupal.org/8 composer config --json extra.installer-types '["npm-asset", "bower-asset"]' composer config --json extra.installer-paths.web\/libraries\/fancytree '["npm-asset/jquery.fancytree"]' composer config --unset extra.installer-paths.web\/libraries\/\{\$name\} composer config --json extra.installer-paths.web\/libraries\/\{\$name\} '["type:drupal-library", "type:bower-asset", "type:npm-asset"]'
2. Require the composer installer extender
composer require oomphinc/composer-installers-extender
3. Require the JQuery Fancytree library
composer require npm-asset/jquery.fancytree:~2
Check that you have the library in the libraries folder.
4. Require Taxonomy Manager module
composer require drupal/taxonomy_manager:~2
5. Enable the Taxonomy Manager module with Drush
drush en taxonomy_manager
- Status changed to Needs review
4 months ago 7:18am 14 August 2024 - π¨π¦Canada joelpittet Vancouver
Thank you so much for all the work youβve put into helping out with this project @rajab natshah β itβs greatly appreciated! I understand this might be a preference issue, but I would love to keep my
node
packages managed byNPM
and myPHP
packages bycomposer
.Would it be possible to avoid making this a composer dependency or to make it optional? So a #3 option to the proposal?
For context, I manage my
NPM
packages in my project root and then copy the necessary files fromnode_modules
toWEB_ROOT/libraries
. - π―π΄Jordan Rajab Natshah Jordan
I see this nice option JoΓ«l . I agree to move our methods to your logic.
Option #3
The Node packaging methodIt could be called the NPM/Yarn method (the name of the method could be changed). The module could only have suggestions (hints) in composer, and hook requirements in code to ask for adding the library before enabling.
I see this Option #3 added to modules like CKEditor Anchor Link β or Ace Code Editor β
- π―π΄Jordan Rajab Natshah Jordan
The method is doable.
I use the following in a theme
"scripts": { "theme:init": "webpack --progress --config webpack.config.init.js",
Which webpack.config.init.js copy only what we need to the target location
Something like Copy Drupal Libraries may work as a default in projects.
"scripts": { "copy-drupal-libraries": "webpack --progress --config webpack.config.copy-drupal-libraries.js",
const { merge } = require('webpack-merge'); const path = require("path"); const webpackConfig = require('./webpack.config'); const CopyPlugin = require("copy-webpack-plugin"); module.exports = merge(webpackConfig, { mode: 'development', devtool: false, plugins: [ new CopyPlugin({ patterns: [ { from: path.resolve(__dirname, "node_modules/jquery.fancytree/*"), to: path.resolve(__dirname, "web/libraries/fancytree"), context: "node_modules/jquery.fancytree", } ], }), ], });
- Status changed to Needs work
3 months ago 11:55am 17 September 2024 - π¦πΊAustralia VladimirAus Brisbane, Australia
Thanks @rajab natshah, I'm updating module to use both library and CDN as there were a lot of confusion.
Another method would be including the library with the module.
I also added successor library issue: β¨ Adding library with module, possible successor library Active - π¦πΊAustralia VladimirAus Brisbane, Australia
Seems like some updates broke the widget functionality.
Not working on both 10.3 and 11.0 π
Investigating - π¨π¦Canada bsuttis
@vladimiraus I found the patch at https://www.drupal.org/project/taxonomy_manager/issues/3474919 π Form element taxonomy_manager_tree broken RTBC fixed the broken functionality.
The MR patch here (#3467549) combined with the MR patch there (#3474919) has it working via CDN in my tests.
To use the fancytree library locally, I find I still have to edit my project's main composer.json like so:
... "merge-plugin": { "include": [ "docroot/modules/custom/*/composer.json", "docroot/modules/contrib/taxonomy_manager/composer.libraries.json" ], }, ...
(note: I have wikimedia/composer-merge-plugin installed)
and then run
composer require fancytree/fancytree -W
to install it locally to /docroot/libraries. Is this the correct process? Hello,
I was able to overcome all errors by using:
Method #2 define in post #6 β¨ Change require custom libraries to suggestions as a better method with more options Needs work
combined with this patch https://www.drupal.org/files/issues/2024-09-17/taxonomy_manager-3474919-... β
from: https://www.drupal.org/project/taxonomy_manager/issues/3474919 π Form element taxonomy_manager_tree broken RTBCThanks!
- First commit to issue fork.
- π¦πΊAustralia jannakha Brisbane!
- added extra library to JS from CDN
- requires https://www.drupal.org/project/taxonomy_manager/issues/3046752 π AJAX error when editing term content Postponed: needs info patch #31 (MR49) to work correctly (which includes https://www.drupal.org/project/taxonomy_manager/issues/3474919 π Form element taxonomy_manager_tree broken RTBC ) -
vladimiraus β
committed d60105fd on 2.0.x
Issue #3467549 by vladimiraus, jannakha, rajab natshah, bsuttis, la558:...
-
vladimiraus β
committed d60105fd on 2.0.x
- π¦πΊAustralia VladimirAus Brisbane, Australia
Committed! π§
Thank you everyone. Automatically closed - issue fixed for 2 weeks with no activity.