First draft of script and spec files
by Troy Dawson
This is my first draft of a script, and corresponding spec file changes.
Feedback is welcome.
Bundling Script:
#!/bin/bash
PACKAGE="node-static"
VERSION="$(npm view ${PACKAGE} version)"
TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX)
mkdir ${TMP_DIR}
pushd ${TMP_DIR}
npm pack ${PACKAGE}
tar xfz *.tgz
cd package
npm install --no-optional --only=prod
# FIND SOMEWHERE TO PUT LICENSES
# FOR NOW JUST PRINT THEM OUT
find . -name "package.json" -exec jq .license {} \; | sort -u
mv node_modules/ node_modules_prod
npm install --no-optional --only=dev
mv node_modules/ node_modules_dev
tar cfz ../${PACKAGE}-${VERSION}-nm-prod.tgz node_modules_prod
tar cfz ../${PACKAGE}-${VERSION}-nm-dev.tgz node_modules_dev
cd ..
cp ${PACKAGE}-${VERSION}* $HOME/rpmbuild/SOURCES
popd
rm -rf ${TMP_DIR}
Spec File Changes:
...
License: <license1> and <license2> and <license3>
...
Source1: %{npm_name}-%{version}-nm-prod.tgz
Source2: %{npm_name}-%{version}-nm-dev.tgz
...
%install
...
# Setup bundled node modules
tar xfz %{SOURCE1}
mkdir -p node_modules
pushd node_modules
ln -s ../node_modules_prod/* .
ln -s ../node_modules_prod/.bin .
popd
cp -pr node_modules node_modules_prod %{buildroot}%{nodejs_sitelib}/%{npm_name}
...
%check
%nodejs_symlink_deps --check
%if 0%{?enable_tests}
tar xfz %{SOURCE2}
pushd node_modules
ln -s ../node_modules_dev/* .
popd
pushd node_modules/.bin
ln -s ../../node_modules_dev/.bin/* .
popd
# Example test run using the binary in ./node_modules/.bin/
./node_modules/.bin/vows --spec --isolate
%endif
...
Known Issues:
- Hard coded package name, make that a variable.
- License - Tells you what they are, doesn't put them in nice format.
- Only for no-arch packages. Doesn't deal with packages that need to
be compiled.
- Spec file stuff is a bit ugly. Possibly write some macros once
things are finalized.
Notes:
- I used npm-install instead of yarn because npm because npm is in
RHEL, and when people think of nodejs modules, npm is usually what
they first thing ok.
- Although this has only been tested on one package, I believe it
should work on most no-arch nodejs packages.
Any changes and/or improvements that people think should be made?
Troy
3 years
Are people ok if I update uglify-js to 3.x ?
by Troy Dawson
There are several nodejs packages that do not build in rawhide with
the current build of uglify-js. It is very likely it's because the
nodejs version is so new that something broke.
I would like to update the version of uglify-js to version 3.10.4 (the
latest version).
It does have some changes for how it does mapping, more options and
different syntax. But, it works, unlike what we currently have.
I was going to ask the owners, but it looks like the nodejs-sig has
been taking care of it for a while, so I'm asking here.
Troy
3 years
Proposal: Reboot nodejs library/modules in Fedora
by Troy Dawson
I am sending this to the Fedora nodejs community / SIG before sending
it to fedora-devel and/or the packaging committee. I'm doing that so
we (the people who actually maintain, or try to maintain, the nodejs
packages) have a chance to talk and discuss things without too much
thread jumping.
Problem1:
The current way of packaging every nodejs module/library as it's own
package has created library stagnation. It is extremely hard to
update any of these modules due to other modules depending on already
released versions. It is also very hard to add any Fedora package
that requires new nodejs libraries due to the volume of package
reviews that have to happen.
Problem2:
Due to problem1, and other reasons, some of our major nodejs packagers
are orphaning their nodejs packages. This is leading to many packages
being unable to install. This is starting a downward spiral of
uninstallable nodejs packages.
Proposed Solution:
Keep nodejs and npm in Fedora. Possibly yarn too.
Get rid of all non-essential nodejs libraries. Those that are
essential, bundle all their build, test, and runtime nodejs libraries.
Create scripts that make it easy to bundle, and maintain, these
essential nodejs libraries.
If needed, create scripts that make it easy for non-nodejs packages to
bundle their nodejs libraries properly.
LIST OF PROBLEMS TO WORK OUT:
Problem1: Currently, all the libraries/modules are links under
<package>/node_modules/ and dnf doesn't like changing links into
directories.
Solution1: Bundled runtime libraries/modules will be in
<package>/bundled_node_modules/ and all the links in
<package>/node_modules/ will point there.
Problem2: Many of the bundled libraries are archful, meaning they need
to be compiled. What if an essential nodejs library was originally a
noarch?
Solution2: All bundled nodejs library packages will be treached as
archful, meaning they will need to be built on each supported arch.
Problem3: TBD
Solution3: TBD
Problem4: TBD
Problem4: TBD
What do you, the Fedora nodejs packagers and community think of this proposal?
Does it sound ok?
If so, let's start working through all the problems, finding solutions.
If not, then let's find a different solution to our current crisis.
Thanks for your time.
Troy Dawson
3 years