isaacscript 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/check-orphaned-words.sh
CHANGED
|
@@ -2,33 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
set -e # Exit on any errors
|
|
4
4
|
|
|
5
|
-
# Get the directory of this script
|
|
5
|
+
# Get the directory of this script:
|
|
6
6
|
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
|
|
7
7
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
8
8
|
|
|
9
9
|
REPO_ROOT="$DIR"
|
|
10
10
|
cd "$REPO_ROOT"
|
|
11
11
|
|
|
12
|
-
# Do nothing if the configuration file does not exist
|
|
12
|
+
# Do nothing if the configuration file does not exist.
|
|
13
13
|
CSPELL_CONFIGURATION_PATH="$REPO_ROOT/.cspell.json"
|
|
14
14
|
if ! test -f "$CSPELL_CONFIGURATION_PATH"; then
|
|
15
15
|
exit 0
|
|
16
16
|
fi
|
|
17
17
|
|
|
18
|
-
# Do nothing if the configuration file does not have any words in it
|
|
18
|
+
# Do nothing if the configuration file does not have any words in it.
|
|
19
19
|
if ! grep -q '"words": ' "$CSPELL_CONFIGURATION_PATH"; then
|
|
20
20
|
exit 0
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
-
# Make a list of every misspelled word without any custom dictionaries
|
|
23
|
+
# Make a list of every misspelled word without any custom dictionaries.
|
|
24
|
+
# We need to move the configuration path temporarily or else the cspell command won't work properly.
|
|
24
25
|
CSPELL_CONFIGURATION_PATH_TEMP="$REPO_ROOT/.cspell-temp.json"
|
|
25
|
-
mv "$CSPELL_CONFIGURATION_PATH" "$CSPELL_CONFIGURATION_PATH_TEMP"
|
|
26
|
+
mv "$CSPELL_CONFIGURATION_PATH" "$CSPELL_CONFIGURATION_PATH_TEMP"
|
|
26
27
|
MISSPELLED_WORDS_PATH="/tmp/misspelled-words.txt"
|
|
27
28
|
CSPELL_CONFIGURATION_TEST_PATH="$REPO_ROOT/.cspell-check-unused.json"
|
|
28
29
|
npx cspell lint --config "$CSPELL_CONFIGURATION_TEST_PATH" --dot --no-progress --no-summary --unique --words-only | sort --ignore-case --unique > "$MISSPELLED_WORDS_PATH"
|
|
29
30
|
mv "$CSPELL_CONFIGURATION_PATH_TEMP" "$CSPELL_CONFIGURATION_PATH"
|
|
30
31
|
|
|
31
|
-
# Check that each ".cspell.json" word is actually being used
|
|
32
|
+
# Check that each ".cspell.json" word is actually being used.
|
|
32
33
|
echo "Checking for orphaned CSpell configuration words in: $CSPELL_CONFIGURATION_PATH"
|
|
33
34
|
CSPELL_CONFIGURATION_WORDS=$(cat "$CSPELL_CONFIGURATION_PATH" | python -c "import sys, json; print('\n'.join(json.load(sys.stdin)['words']))")
|
|
34
35
|
ONE_OR_MORE_FAILURES=0
|
package/dist/package.json
CHANGED
|
@@ -2,33 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
set -e # Exit on any errors
|
|
4
4
|
|
|
5
|
-
# Get the directory of this script
|
|
5
|
+
# Get the directory of this script:
|
|
6
6
|
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
|
|
7
7
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
8
8
|
|
|
9
9
|
REPO_ROOT="$DIR"
|
|
10
10
|
cd "$REPO_ROOT"
|
|
11
11
|
|
|
12
|
-
# Do nothing if the configuration file does not exist
|
|
12
|
+
# Do nothing if the configuration file does not exist.
|
|
13
13
|
CSPELL_CONFIGURATION_PATH="$REPO_ROOT/.cspell.json"
|
|
14
14
|
if ! test -f "$CSPELL_CONFIGURATION_PATH"; then
|
|
15
15
|
exit 0
|
|
16
16
|
fi
|
|
17
17
|
|
|
18
|
-
# Do nothing if the configuration file does not have any words in it
|
|
18
|
+
# Do nothing if the configuration file does not have any words in it.
|
|
19
19
|
if ! grep -q '"words": ' "$CSPELL_CONFIGURATION_PATH"; then
|
|
20
20
|
exit 0
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
-
# Make a list of every misspelled word without any custom dictionaries
|
|
23
|
+
# Make a list of every misspelled word without any custom dictionaries.
|
|
24
|
+
# We need to move the configuration path temporarily or else the cspell command won't work properly.
|
|
24
25
|
CSPELL_CONFIGURATION_PATH_TEMP="$REPO_ROOT/.cspell-temp.json"
|
|
25
|
-
mv "$CSPELL_CONFIGURATION_PATH" "$CSPELL_CONFIGURATION_PATH_TEMP"
|
|
26
|
+
mv "$CSPELL_CONFIGURATION_PATH" "$CSPELL_CONFIGURATION_PATH_TEMP"
|
|
26
27
|
MISSPELLED_WORDS_PATH="/tmp/misspelled-words.txt"
|
|
27
28
|
CSPELL_CONFIGURATION_TEST_PATH="$REPO_ROOT/.cspell-check-unused.json"
|
|
28
29
|
npx cspell lint --config "$CSPELL_CONFIGURATION_TEST_PATH" --dot --no-progress --no-summary --unique --words-only | sort --ignore-case --unique > "$MISSPELLED_WORDS_PATH"
|
|
29
30
|
mv "$CSPELL_CONFIGURATION_PATH_TEMP" "$CSPELL_CONFIGURATION_PATH"
|
|
30
31
|
|
|
31
|
-
# Check that each ".cspell.json" word is actually being used
|
|
32
|
+
# Check that each ".cspell.json" word is actually being used.
|
|
32
33
|
echo "Checking for orphaned CSpell configuration words in: $CSPELL_CONFIGURATION_PATH"
|
|
33
34
|
CSPELL_CONFIGURATION_WORDS=$(cat "$CSPELL_CONFIGURATION_PATH" | python -c "import sys, json; print('\n'.join(json.load(sys.stdin)['words']))")
|
|
34
35
|
ONE_OR_MORE_FAILURES=0
|