Skip to content

Commit

Permalink
use 7.0 for gen2
Browse files Browse the repository at this point in the history
.

.

.

.
  • Loading branch information
denysoblohin-okta committed Oct 30, 2023
1 parent 5d0ada4 commit 5cf248f
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ fi

npm config set @okta:registry ${INTERNAL_REGISTRY}

if ! yarn_sync; then
echo "yarn.lock file is not in sync. Please make sure this file is up-to-date by running 'yarn install' at the repo root and checking in yarn.lock changes"
exit ${FAILED_SETUP}

if [ -z "$AUTHJS_VERSION" ]; then
if ! yarn_sync; then
echo "yarn.lock file is not in sync. Please make sure this file is up-to-date by running 'yarn install' at the repo root and checking in yarn.lock changes"
exit ${FAILED_SETUP}
fi
fi

# Install upstream artifacts
Expand All @@ -51,20 +54,32 @@ if [ ! -z "$AUTHJS_VERSION" ]; then

yarn global add @okta/siw-platform-scripts@0.7.0

rm -rf ./node_modules/@okta/okta-auth-js
mv -f ./node_modules/@okta/okta-auth-js ./okta-auth-js-orig
rm -rf ./src/v3/node_modules/@okta/okta-auth-js

authjs_semver_g2=$(cat ./package.json | jq '.dependencies["@okta/okta-auth-js"]')
json=$(cat ./package.json | jq 'del(.dependencies["@okta/okta-auth-js"])')
printf '%s\n' "${json}" > ./package.json
json=$(cat ./src/v3/package.json | jq 'del(.dependencies["@okta/okta-auth-js"])')
printf '%s\n' "${json}" > ./src/v3/package.json

if ! siw-platform install-artifact -n @okta/okta-auth-js -v ${AUTHJS_VERSION} ; then
echo "AUTHJS_VERSION could not be installed: ${AUTHJS_VERSION}"
exit ${FAILED_SETUP}
fi

json_v3=$(cat ./src/v3/package.json | jq --arg ver $AUTHJS_VERSION '.dependencies["@okta/okta-auth-js"] = $ver')
printf '%s\n' "${json_v3}" > ./src/v3/package.json
cp -r ./node_modules/@okta/okta-auth-js ./src/v3/node_modules/@okta
json=$(cat ./src/v3/package.json | jq --arg ver $AUTHJS_VERSION '.dependencies["@okta/okta-auth-js"] = $ver')
printf '%s\n' "${json}" > ./src/v3/package.json
json=$(cat ./package.json | jq --arg ver $authjs_semver_g2 '.dependencies["@okta/okta-auth-js"] = $ver')
printf '%s\n' "${json}" > ./package.json

mv -f ./node_modules/@okta/okta-auth-js ./src/v3/node_modules/@okta/okta-auth-js
mv -f ./okta-auth-js-orig ./node_modules/@okta/okta-auth-js

authjs_ver_g2=$(cat ./node_modules/@okta/okta-auth-js/package.json | jq '.version')
authjs_ver_g3=$(cat ./src/v3/node_modules/@okta/okta-auth-js/package.json | jq '.version')
echo "okta-auth-js versions used: ${authjs_ver_g2} for gen 2, ${authjs_ver_g3} for gen 3"


# Remove any changes to package.json
git checkout .
Expand Down

0 comments on commit 5cf248f

Please sign in to comment.