summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-06-12 21:20:30 +0200
committerAndy Scherzinger <info@andy-scherzinger.de>2024-06-14 07:30:16 +0200
commitdaa1646b3d6d0ff86bb5eaf2e957f4c71cc80efc (patch)
tree5752ba6c8cb3aeee9c7fcabe21ab07f78f6bba2f /build
parentbe29eb364174166f780f4445fe778e5c59f66c10 (diff)
downloadnextcloud-server-daa1646b3d6d0ff86bb5eaf2e957f4c71cc80efc.tar.gz
nextcloud-server-daa1646b3d6d0ff86bb5eaf2e957f4c71cc80efc.zip
chore: Adjust post-build script to add license files for sourcemaps on build
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/npm-post-build.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/build/npm-post-build.sh b/build/npm-post-build.sh
new file mode 100755
index 00000000000..51a8bda3b60
--- /dev/null
+++ b/build/npm-post-build.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+set -e
+
+# Build CSS files from SCSS
+npm run sass
+# Build icons
+npm run sass:icons
+
+# Add licenses for source maps
+if [ -d "dist" ]; then
+ for f in dist/*.js; do
+ # If license file and source map exists copy license for the sourcemap
+ if [ -f "$f.license" ] && [ -f "$f.map" ]; then
+ # Remove existing link
+ [ -e "$f.map.license" ] || [ -L "$f.map.license" ] && rm "$f.map.license"
+ # Create a new link
+ ln -s "$(basename "$f.license")" "$f.map.license"
+ fi
+ done
+ echo "Copying licenses for sourcemaps done"
+else
+ echo "This script needs to be executed from the root of the repository"
+ exit 1
+fi
+