Hi Jean-Marie,

Am 07.10.19 um 14:16 schrieb Jean-marie Lemetayer:
> I thought about your idea of using Yocto to manage NPM package dependencies 
and I ran into an issue. NPM projects can have multiple dependencies on a single 
package, and sometimes with multiple versions. NPM will manage this by creating 
sub 'node_modules' tree.

Here is an example with a newly created angular application. The app depends on 
3 different version of 'ansi-regex'. NPM will install the packages this way:
node_modules/ansi-regex @ 2.1.1
node_modules/cliui/node_modules/ansi-regex @ 3.0.0
node_modules/inquirer/node_modules/ansi-regex @ 4.1.0
node_modules/string-width/node_modules/ansi-regex @ 3.0.0
node_modules/@angular/compiler-cli/node_modules/ansi-regex @ 4.1.0

I use symbolic links instead of folders, append the major version to the folder name and move the folders into the main node_modules folder. At the moment I use one version per major version or first version unequal to zero:

node_modules/ansi-regex-2
node_modules/ansi-regex-3
node_modules/ansi-regex-4
node_modules/cliui-X/node_modules/ansi-regex -> ../../ansi-regex-3
node_modules/inquirer-X/node_modules/ansi-regex -> ../../ansi-regex-3
node_modules/string-width-X/node_modules/ansi-regex  -> ../../ansi-regex-3
node_modules/@angular/compiler-cli-X/node_modules/ansi-regex -> ../../../ansi-regex-4
node_modules/abc-X/node_modules/ansi-regex -> ../../ansi-regex-2
node_modules/abc-X/node_modules/cliui -> ../../cliui-X
node_modules/abc-X/node_modules/inquirer -> ../../inquirer-X
node_modules/abc-X/node_modules/string-width -> ../../string-width
node_modules/abc-X/node_modules/@angular/compiler-cli -> ../../../@angular/compiler-cli-X


How can you handle that with Yocto ? I am not sure but I think it is not 
possible.
It is possible and Yocto could do even more. If you take a look at the package ansi-regex you realize that the project increase the major version only because they change the minimum required nodejs version. This means you could replace all ansi-regex version by the last version, add some symbolic links to the ansi-regex package and provide all versions by the same package.

Regards
  Stefan
--
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to