[ovirt-devel] oVirt packages for JavaScript development have been updated
Vojtech Szocs
vszocs at redhat.com
Wed Feb 8 14:29:11 UTC 2017
Hello devs,
following packages, intended as build-time dependencies of oVirt
JavaScript projects, have been updated:
* ovirt-engine-nodejs
* ovirt-engine-nodejs-modules
* ovirt-engine-yarn
If you use those packages, please read on to learn how to adapt your
project. oVirt Dashboard (master) is already adapted and you can use
it as your reference.
==
1, move your project from npm to Yarn:
- using nodejs-modules implies that your project moves from npm to
Yarn, please do this as your first step
- make sure to add yarn.lock file to source control: rm -rf
node_modules && yarn install # generates yarn.lock
- your automation/*.packages should contain something like this:
ovirt-engine-nodejs-6.9.4
ovirt-engine-nodejs-modules-1.0.3
ovirt-engine-yarn-0.19.1
- since oVirt CI uses yum cache, always specify exact version of
nodejs-modules in your automation/*.packages
- in your RPM build script, make sure to set up Node.js env.: source
/usr/share/ovirt-engine-nodejs-modules/setup-env.sh
==
2a, dependency handling - 1st time:
- clone nodejs-modules repo & update the projects.list file - add
URL(s) to your project's files (package.json + yarn.lock)
- bump .z in RPM Version and reset the RPM Release number, submit
patch to Gerrit
- in your project, update automation/*.packages to use the right
nodejs-modules version
2b, dependency handling - whenever your dependencies change:
- clone nodejs-modules repo & bump RPM Release number, submit patch to Gerrit
- in your project, update automation/*.packages to use the right
nodejs-modules version
==
Q: how does the new nodejs-modules work?
A: instead of maintaining one big package.json file to specify all
dependencies of all projects (effectively forcing all projects to use
single dependency tree), it contains the projects.list file with
URL(s) to specific project files.
When building nodejs-modules RPM, it goes through the list of URL(s),
downloading project's files (package.json + yarn.lock), then
downloading required dependencies (using Yarn) and collecting their
.tar.gz sources. The nodejs-modules RPM therefore contains a flat list
of all .tar.gz sources of all dependencies of all projects.
When you source the setup-env.sh script, it does, among other things,
tell Yarn to use
/usr/share/ovirt-engine-nodejs-modules/yarn-offline-cache containing
all .tar.gz sources. Then, it runs Yarn in offline mode to populate
your project's node_modules directory.
==
Hope this helps.
Regards,
Vojtech
More information about the Devel
mailing list