forked from un-ts/eslint-plugin-import-x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdep-time-travel.sh
executable file
·52 lines (42 loc) · 1.93 KB
/
dep-time-travel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# expected: ESLINT_VERSION numeric env var
echo "installing ${ESLINT_VERSION} in node ${TRAVIS_NODE_VERSION} with TS parser ${TS_PARSER:-default}..."
export NPM_CONFIG_LEGACY_PEER_DEPS=true
if [[ "$ESLINT_VERSION" -lt "7" ]]; then
echo "Removing @angular-eslint/template-parser..."
npm uninstall --no-save @angular-eslint/template-parser
fi
npm install --no-save "eslint@${ESLINT_VERSION}" --ignore-scripts
if [[ -n "$TS_PARSER" ]]; then # if TS parser is manually set, always use it
echo "Downgrading @typescript-eslint/parser..."
npm i --no-save "@typescript-eslint/parser@${TS_PARSER}"
elif [[ "$ESLINT_VERSION" -lt "5" ]]; then # completely remove the new TypeScript parser for ESLint < v5
echo "Removing @typescript-eslint/parser..."
npm uninstall --no-save @typescript-eslint/parser
elif [[ "$TRAVIS_NODE_VERSION" -lt "10" ]]; then # TS parser 3 requires node 10+
npm i --no-save "@typescript-eslint/parser@3"
elif [[ "$TRAVIS_NODE_VERSION" -lt "12" ]]; then # TS parser 4 requires node 12+
npm i --no-save "@typescript-eslint/parser@4"
fi
# use these alternate TypeScript dependencies for ESLint < v4
if [[ "$ESLINT_VERSION" -lt "4" ]]; then
echo "Downgrading babel-eslint..."
npm i --no-save [email protected]
echo "Downgrading TypeScript dependencies..."
npm i --no-save typescript-eslint-parser@15 [email protected]
elif [[ "$ESLINT_VERSION" -lt "7" ]]; then
echo "Downgrading TypeScript dependencies..."
npm i --no-save typescript-eslint-parser@20
fi
# typescript-eslint-parser 1.1.1+ is not compatible with node 6
if [[ "$TRAVIS_NODE_VERSION" -lt "8" ]]; then
echo "Downgrading eslint-import-resolver-typescript..."
npm i --no-save [email protected]
fi
if [ "${ESLINT_VERSION}" = '8' ]; then
# This is a workaround for the crash in the initial processing of the ESLint class.
echo "Installing self"
npm i --no-save eslint-plugin-import@'.' -f
echo "Build self"
npm run build
fi