[yocto] [npm] duplicate code

Josef Holzmayr holzmayr at rsi-elektrotechnik.de
Mon Oct 7 22:12:31 PDT 2019


On Mon, Oct 07, 2019 at 09:33:46PM +0200, Stefan Herbrechtsmeier wrote:
> 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.

I think it would be dangerous to assume this holds true for other
packages too. In the semantic versioning world as npm packages expectexd
to behave - and nodejs itself certainly does! - a change in the major
version means a breaking change of some kind.

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

-- 
———————————————
Josef Holzmayr
Software Developer Embedded Systems

Tel: +49 8444 9204-48
Fax: +49 8444 9204-50

R-S-I Elektrotechnik GmbH & Co. KG
Woelkestrasse 11
D-85301 Schweitenkirchen
www.rsi-elektrotechnik.de
———————————————
Amtsgericht Ingolstadt – GmbH: HRB 191328 – KG: HRA 170393
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
Ust-IdNr: DE 128592548 

_____________________________________________________________
Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
USt-IdNr.: DE 128592548



More information about the yocto mailing list