Skip to content

Commit

Permalink
Install JS stuff with NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
ximion committed Feb 25, 2024
1 parent 3049d4a commit 661f2c8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 44 deletions.
6 changes: 3 additions & 3 deletions contrib/setup/build_js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ if [ -n "$MESON_SOURCE_ROOT" ]; then
cd "$MESON_SOURCE_ROOT/contrib/setup/"
fi

YARNPKG="yarn"
NPM="npm"
if [ ! -z "$1" ]
then
YARNPKG=$1
NPM=$1
fi

$YARNPKG install $ASGEN_YARN_EXTRA_ARGS --prod --non-interactive
$NPM install --no-save

JS_TARGET=../../data/templates/default/static/js
[ ! -d "$JS_TARGET" ] && mkdir $JS_TARGET
Expand Down
18 changes: 0 additions & 18 deletions contrib/setup/yarn.lock

This file was deleted.

20 changes: 10 additions & 10 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ fs = import('fs')
#
src_dir = include_directories('src/')

glib_dep = dependency('glib-2.0', version: '>= 2.62')
glibd_dep = dependency('glibd-2.0')
appstream_dep = dependency('appstream', version : '>= 1.0.0')
ascompose_dep = dependency('appstream-compose', version : '>= 1.0.0')
lmdb_dep = dependency('lmdb', version : '>= 0.9.22')
archive_dep = dependency('libarchive', version : '>= 3.2')
curl_dep = dependency('libcurl')
glib_dep = dependency('glib-2.0', version: '>= 2.62')
glibd_dep = dependency('glibd-2.0')
appstream_dep = dependency('appstream', version : '>= 1.0.0')
ascompose_dep = dependency('appstream-compose', version : '>= 1.0.0')
lmdb_dep = dependency('lmdb', version : '>= 0.9.22')
archive_dep = dependency('libarchive', version : '>= 3.2')
curl_dep = dependency('libcurl')

dxml_dep = dependency('', required: false)
if get_option('rpmmd')
Expand Down Expand Up @@ -67,12 +67,12 @@ girbind_lib = static_library('girbindings',
# Download JS stuff and additional sources if we couldn't find them
#
if get_option('download-js')
yarn_exe = find_program('/usr/share/yarn/bin/yarn', 'yarnpkg') # check for the yarn executable
npm_exe = find_program('npm')
if not fs.is_dir(source_root / 'data' / 'templates' / 'default' / 'static' / 'js')
message('Downloading JavaScript libraries...')
getjs_cmd = run_command([source_root + '/contrib/setup/build_js.sh', yarn_exe], check: false)
getjs_cmd = run_command([source_root + '/contrib/setup/build_js.sh', npm_exe], check: false)
if getjs_cmd.returncode() != 0
error('Unable to download JavaScript files with Yarn:\n' + getjs_cmd.stdout() + getjs_cmd.stderr())
error('Unable to download JavaScript files with NPM:\n' + getjs_cmd.stdout() + getjs_cmd.stderr())
endif
endif
endif
Expand Down
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ option('rpmmd',
option('download-js',
type: 'boolean',
value: true,
description: 'Download JavaScript with Yarn automatically.'
description: 'Download JavaScript with NPM automatically.'
)
option('gir-dir',
type: 'string',
Expand Down
5 changes: 1 addition & 4 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ parts:
build-environment:
- LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/
override-build: |
# install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update && apt-get install --no-install-recommends -y yarn nodejs
# actually build asgen - we need to run everything manually here,
# because snapcraft will kill the build if run with maximum amount of ninja jobs,
# and I found no way to limit the amount of permitted ninja jobs other than overriding everything
Expand Down Expand Up @@ -136,6 +132,7 @@ parts:
- docbook-xsl
- docbook-xml
- ffmpeg
- npm
- libarchive-dev
- libcairo2-dev
- libcurl4-gnutls-dev
Expand Down
8 changes: 1 addition & 7 deletions tests/ci/install-deps-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ else
gdk_pixbuf_dep="libgdk-pixbuf-2.0-dev"
fi;

yarnpkg_dep="yarnpkg"
if dpkg -s yarn >/dev/null 2>&1; then
# if the conflicting "yarn" package was already installed,
# don't try to install yarnpkg
yarnpkg_dep=""
fi
eatmydata apt-get install -yq --no-install-recommends \
$gdk_pixbuf_dep \
librsvg2-dev \
Expand All @@ -73,4 +67,4 @@ eatmydata apt-get install -yq --no-install-recommends \
curl \
gnupg \
ffmpeg \
$yarnpkg_dep
npm
2 changes: 1 addition & 1 deletion tests/ci/install-deps-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ dnf --assumeyes --quiet --setopt=install_weak_deps=False install \
/usr/bin/ffmpeg \
/usr/bin/node \
/usr/bin/xsltproc \
/usr/bin/yarnpkg
/usr/bin/npm

0 comments on commit 661f2c8

Please sign in to comment.