tools: Symlink node_modules in project root

NPM assumes quite strongly that it manages the project as a
whole and its package/lock files are located in the project
root.

While we somehow managed to keep the npm tooling in a subfolder,
this comes at the cost of breaking imports of additional modules.

This will become relevant when we update eslint to a supported
version, as we want to keep using the `junit` formatter in CI,
which has now been split out into a separate module.

So bite the bullet and make the node_modules folder available in
the project root.

On the plus side, having the node_modules folder in the project
root allows language servers in IDEs/editors to pick it up.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/431>
This commit is contained in:
Florian Müllner
2025-10-25 12:28:28 +02:00
parent a8b5705274
commit 9ae6d55e0d
+5 -1
View File
@@ -3,6 +3,10 @@
# SPDX-FileCopyrightText: 2020 Philip Chimento <philip.chimento@gmail.com>
# SPDX-FileCopyrightText: 2025 Florian Müllner <fmuellner@gnome.org>
cd $(dirname -- "$0")
srcdir=$(dirname -- "$0")
cd $srcdir
[ ! -d node_modules ] && npm clean-install
# Link in project root to make imports work properly
[ ! -e ../node_modules ] && ln -s $srcdir/node_modules ../node_modules
npm run lint -- "$@"