You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. #
  3. # SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. # SPDX-FileCopyrightText: 2014-2015 ownCloud, Inc.
  5. # SPDX-License-Identifier: AGPL-3.0-only
  6. #
  7. # Run JS tests
  8. #
  9. NPM="$(which npm 2>/dev/null)"
  10. OUTPUT_DIR="jsdocs"
  11. JS_FILES="../core/js/*.js ../core/js/**/*.js ../apps/*/js/*.js"
  12. if test -z "$NPM"
  13. then
  14. echo 'Node JS >= 0.8 is required to build the documentation' >&2
  15. exit 1
  16. fi
  17. # update/install test packages
  18. $NPM install --prefix . --link jsdoc || exit 3
  19. JSDOC_BIN="$(which jsdoc 2>/dev/null)"
  20. # If not installed globally, try local version
  21. if test -z "$JSDOC_BIN"
  22. then
  23. JSDOC_BIN="./node_modules/jsdoc/jsdoc.js"
  24. fi
  25. if test -z "$JSDOC_BIN"
  26. then
  27. echo 'jsdoc executable not found' >&2
  28. exit 2
  29. fi
  30. mkdir -p "$OUTPUT_DIR"
  31. NODE_PATH="./node_modules" $JSDOC_BIN -d "$OUTPUT_DIR" $JS_FILES