Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecate bin/token script #6183

Merged
merged 3 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 0 additions & 196 deletions .reaction/getAuthToken.js

This file was deleted.

30 changes: 11 additions & 19 deletions bin/token
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,14 @@ set -o posix # more strict failures in subshells
IFS="$(printf "\n\t")"
# ---- End unofficial bash strict mode boilerplate

if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 [userId]" 1>&2
exit 1
fi

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
node_script=${__dir}/../.reaction/getAuthToken.js
simple_oauth2_pkg_json=${__dir}/../node_modules/simple-oauth2/package.json
simple_oauth2_version="3.1.0"

# NPM install the simple-oauth2 package used by the script only if necessary
if [[ ! -f ${simple_oauth2_pkg_json} ]]; then
npm install --no-save simple-oauth2@${simple_oauth2_version}
elif [[ $(grep -c '"version": "'${simple_oauth2_version}'"' ${simple_oauth2_pkg_json}) != "1" ]]; then
npm install --no-save simple-oauth2@${simple_oauth2_version}
fi

# Run the script using Node
node --experimental-modules --no-warnings ${node_script} "$@"
echo "
Please globally install the @reactioncommerce/hydra-token package:

https://www.npmjs.com/package/@reactioncommerce/hydra-token

Then run 'hydra-token get' command instead of 'bin/token' in the future.

Getting token...
"

npx @reactioncommerce/hydra-token get $1