2015-09-27 14:03:31 +03:00
|
|
|
#!/usr/bin/env bash
|
2014-06-24 01:57:44 +04:00
|
|
|
#
|
2024-05-27 11:08:53 +03:00
|
|
|
# SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
# SPDX-FileCopyrightText: 2014-2015 ownCloud, Inc.
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
2014-06-24 01:57:44 +04:00
|
|
|
#
|
|
|
|
# Run JS tests
|
|
|
|
#
|
|
|
|
NPM="$(which npm 2>/dev/null)"
|
2018-10-15 15:29:52 +03:00
|
|
|
OUTPUT_DIR="jsdocs"
|
2014-06-24 01:57:44 +04:00
|
|
|
|
2018-10-15 15:29:52 +03:00
|
|
|
JS_FILES="../core/js/*.js ../core/js/**/*.js ../apps/*/js/*.js"
|
2014-06-24 01:57:44 +04:00
|
|
|
|
|
|
|
if test -z "$NPM"
|
|
|
|
then
|
|
|
|
echo 'Node JS >= 0.8 is required to build the documentation' >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# update/install test packages
|
2018-10-15 15:29:52 +03:00
|
|
|
$NPM install --prefix . --link jsdoc || exit 3
|
2014-06-24 01:57:44 +04:00
|
|
|
|
|
|
|
JSDOC_BIN="$(which jsdoc 2>/dev/null)"
|
|
|
|
|
|
|
|
# If not installed globally, try local version
|
|
|
|
if test -z "$JSDOC_BIN"
|
|
|
|
then
|
2018-10-15 15:29:52 +03:00
|
|
|
JSDOC_BIN="./node_modules/jsdoc/jsdoc.js"
|
2014-06-24 01:57:44 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$JSDOC_BIN"
|
|
|
|
then
|
|
|
|
echo 'jsdoc executable not found' >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
|
2018-10-15 15:29:52 +03:00
|
|
|
NODE_PATH="./node_modules" $JSDOC_BIN -d "$OUTPUT_DIR" $JS_FILES
|
2014-06-24 01:57:44 +04:00
|
|
|
|