Skip to content

Commit def0f9f

Browse files
authored
Merge pull request #533 from JohT/feature/remove-package-json-workaround
Remove workaround for npm packages
2 parents a4785c5 + 874792e commit def0f9f

3 files changed

Lines changed: 22 additions & 73 deletions

File tree

scripts/copyPackageJsonFiles.sh

Lines changed: 0 additions & 64 deletions
This file was deleted.

scripts/findPathsToScan.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ appendNonEmpty() {
2828
fi
2929
}
3030

31+
findPackageJsonFiles() {
32+
find -L "${1}" \
33+
-type d -name "node_modules" -prune -o \
34+
-type d -name "dist" -prune -o \
35+
-type d -name ".yalc" -prune -o \
36+
-type d -name "target" -prune -o \
37+
-type d -name "temp" -prune -o \
38+
-type d -name "lib" -prune -o \
39+
-type d -name "libs" -prune -o \
40+
-type d -name ".git" -prune -o \
41+
-name 'package.json' \
42+
-print0 | \
43+
xargs -0 -r -I {} echo {}
44+
}
45+
3146
# Collect all files and directories to scan
3247
directoriesAndFilesToScan=""
3348

@@ -45,6 +60,7 @@ if [ -d "./${SOURCE_DIRECTORY}" ] ; then
4560
-type d -name "dist" -prune -o \
4661
-type d -name "target" -prune -o \
4762
-type d -name ".yalc" -prune -o \
63+
-type d -name ".git" -prune -o \
4864
-type d -name "temp" -prune -o \
4965
-type f -path "*/.reports/jqa/ts-output.json" \
5066
-exec echo typescript:project::{} \; | tr '\n' ',' | sed 's/,$/\n/')"
@@ -54,12 +70,12 @@ if [ -d "./${SOURCE_DIRECTORY}" ] ; then
5470
fi
5571

5672
# Scan package.json files for npm (nodes package manager) in the source directory
57-
# # TODO The following lines can be reactivated when the following issue is resolved:
73+
# Since the following issue had been resolved, the scan be done here again:
5874
# https://github.com/jqassistant-plugin/jqassistant-npm-plugin/issues/5
59-
#npmPackageJsonFiles="$(find -L "${SOURCE_DIRECTORY}" -type d -name node_modules -prune -o -name 'package.json' -print0 | xargs -0 -r -I {} | tr '\n' ',' | sed 's/,$/\n/')"
60-
#if [ -n "${npmPackageJsonFiles}" ]; then
61-
# directoriesAndFilesToScan="$(appendNonEmpty "${directoriesAndFilesToScan}")${npmPackageJsonFiles}"
62-
#fi
75+
npmPackageJsonFiles="$(findPackageJsonFiles "./${SOURCE_DIRECTORY}")"
76+
if [ -n "${npmPackageJsonFiles}" ]; then
77+
directoriesAndFilesToScan="$(appendNonEmpty "${directoriesAndFilesToScan}")${npmPackageJsonFiles}"
78+
fi
6379

6480
# Scan git repositories in the artifacts directory
6581
if [ "${IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT}" = "" ] || [ "${IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT}" = "plugin" ] ; then

scripts/resetAndScanChanged.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Note: "resetAndScan" expects jQAssistant to be installed in the "tools" directory.
66

7-
# Requires resetAndScan.sh, copyPackageJsonFiles.sh, scanTypescript.sh, detectChangedFiles.sh, findPathsToScan.sh
7+
# Requires resetAndScan.sh, scanTypescript.sh, detectChangedFiles.sh, findPathsToScan.sh
88

99
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
1010
set -o errexit -o pipefail
@@ -17,9 +17,6 @@ SCRIPTS_DIR=${SCRIPTS_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
1717
echo "resetAndScanChanged SCRIPTS_DIR=${SCRIPTS_DIR}"
1818

1919
# Prepare scan
20-
# TODO "copyPackageJsonFiles.sh" can be deleted here when the following issue is resolved:
21-
# https://github.com/jqassistant-plugin/jqassistant-npm-plugin/issues/5
22-
source "${SCRIPTS_DIR}/copyPackageJsonFiles.sh"
2320
source "${SCRIPTS_DIR}/scanTypescript.sh"
2421

2522
filesAndDirectoriesToScan=$( source "${SCRIPTS_DIR}/findPathsToScan.sh" )

0 commit comments

Comments
 (0)