npm-post-build.sh 741 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. set -e
  5. # Build CSS files from SCSS
  6. npm run sass
  7. # Build icons
  8. npm run sass:icons
  9. # Add licenses for source maps
  10. if [ -d "dist" ]; then
  11. for f in dist/*.js; do
  12. # If license file and source map exists copy license for the source map
  13. if [ -f "$f.license" ] && [ -f "$f.map" ]; then
  14. # Remove existing link
  15. [ -e "$f.map.license" ] || [ -L "$f.map.license" ] && rm "$f.map.license"
  16. # Create a new link
  17. ln -s "$(basename "$f.license")" "$f.map.license"
  18. fi
  19. done
  20. echo "Copying licenses for sourcemaps done"
  21. else
  22. echo "This script needs to be executed from the root of the repository"
  23. exit 1
  24. fi