File tree Expand file tree Collapse file tree 4 files changed +44
-12
lines changed Expand file tree Collapse file tree 4 files changed +44
-12
lines changed Original file line number Diff line number Diff line change 72
72
echo "pnpm version $PNPM_LATEST_VERSION not found"
73
73
exit 1
74
74
fi
75
+ ensure-default-pkg-manager-env :
76
+ executor : core/node
77
+ steps :
78
+ - core/ensure_pkg_manager
79
+ - run :
80
+ name : Validate version
81
+ command : |
82
+ PNPM_NEXT_10_VERSION=$(npm view pnpm dist-tags.next-10)
83
+ if ! pnpm --version | grep -q "$PNPM_NEXT_10_VERSION"; then
84
+ echo "pnpm version $PNPM_NEXT_10_VERSION not found"
85
+ exit 1
86
+ fi
87
+
75
88
install-dependencies-npm-node-18 :
76
89
executor :
77
90
name : core/node_secrets
@@ -161,6 +174,8 @@ workflows:
161
174
filters : *filters
162
175
- ensure-pnpm-machine-install :
163
176
filters : *filters
177
+ - ensure-default-pkg-manager-env :
178
+ filters : *filters
164
179
- install-dependencies-npm-node-18 :
165
180
filters : *filters
166
181
- install-dependencies-pnpm-node-18 :
@@ -185,6 +200,7 @@ workflows:
185
200
- ensure-pnpm-version
186
201
- ensure-pnpm-fresh-install
187
202
- ensure-pnpm-machine-install
203
+ - ensure-default-pkg-manager-env
188
204
- install-dependencies-npm-node-18
189
205
- install-dependencies-pnpm-node-18
190
206
- install-dependencies-custom-command
Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ steps:
17
17
name : Check Node.js version
18
18
command : <<include(scripts/check-node-version.sh)>>
19
19
- run :
20
- name : Ensure package manager
20
+ name : Export package manager
21
21
environment :
22
22
PARAM_STR_REF : <<parameters.ref>>
23
+ command : <<include(scripts/export-pkg-manager.sh)>>
24
+ - run :
25
+ name : Ensure package manager
23
26
command : <<include(scripts/ensure-pkg-manager.sh)>>
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- PARAM_STR_REF=$( circleci env subst " ${PARAM_STR_REF} " )
4
- PKG_MANAGER_WITH_VERSION_REGEX=" (npm|pnpm)@(([0-9]+.?){0,2}[0-9]+|[a-z]+-?([0-9]+)?)"
5
- NAME=" ${PARAM_STR_REF} "
6
- VERSION=" "
3
+ NAME=" ${CURRENT_PKG_MANAGER} "
4
+ VERSION=" ${CURRENT_PKG_MANAGER_VERSION} "
7
5
SUDO=" "
8
6
NPM_SUDO=" "
9
7
@@ -64,13 +62,7 @@ change_pnpm_store_dir_and_exit() {
64
62
exit 0
65
63
}
66
64
67
- if [[ " ${PARAM_STR_REF} " =~ ${PKG_MANAGER_WITH_VERSION_REGEX} ]]; then
68
- NAME=" ${BASH_REMATCH[1]} "
69
- VERSION=" ${BASH_REMATCH[2]} "
70
- fi
71
-
72
- echo " export CURRENT_PKG_MANAGER='${NAME} '" >> " ${BASH_ENV} "
73
- echo " Starting to ensure ${NAME} is set for usage"
65
+ echo " Starting to ensure '${NAME} ' is set for usage"
74
66
75
67
cd ~ || echo " Cannot navigate to home, possible version mismatch"
76
68
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ PARAM_STR_REF=$( circleci env subst " ${PARAM_STR_REF} " )
4
+ PKG_MANAGER_REGEX=" ^(npm|pnpm)(@(([0-9]+.?){0,2}[0-9]+|[a-z]+-?([0-9]+)?))?$"
5
+ NAME=" "
6
+ VERSION=" "
7
+
8
+ if [[ " ${PARAM_STR_REF} " =~ ${PKG_MANAGER_REGEX} ]]; then
9
+ NAME=" ${BASH_REMATCH[1]} "
10
+ VERSION=" ${BASH_REMATCH[3]} "
11
+ fi
12
+
13
+ if [[ -z " ${NAME} " ]]; then
14
+ echo " Package manager '${NAME} ' is not supported"
15
+ echo " Please specify supported package manager through parameter or environment"
16
+
17
+ exit 1
18
+ fi
19
+
20
+ echo " export CURRENT_PKG_MANAGER='${NAME} '" >> " ${BASH_ENV} "
21
+ echo " export CURRENT_PKG_MANAGER_VERSION='${VERSION} '" >> " ${BASH_ENV} "
You can’t perform that action at this time.
0 commit comments