Skip to content

Instantly share code, notes, and snippets.

@adamjmcgrath
Last active May 5, 2020 16:52
Show Gist options
  • Save adamjmcgrath/ff26be1795aeb1689e657c7fbc885021 to your computer and use it in GitHub Desktop.
Save adamjmcgrath/ff26be1795aeb1689e657c7fbc885021 to your computer and use it in GitHub Desktop.
auth0-spa-js build test
#!/usr/bin/env bash
BRANCH=${1:-master}
IMPORT_STATEMENT="
// eslint-disable-next-line no-unused-vars\n
import { Auth0Client } from '@auth0/auth0-spa-js';
"
export CI=true
prepend () {
echo -e $1|cat - $2 > /tmp/out && mv /tmp/out $2;
}
echo "deleting dist directory"
rm -rf dist
mkdir dist
echo "cloning auth0/auth0-spa-js#$BRANCH"
(cd dist && git clone --single-branch --branch $BRANCH [email protected]:auth0/auth0-spa-js.git)
echo "install and build auth0-spa-js"
(cd dist/auth0-spa-js && npm ci && npm run build)
echo "test gatsby"
(cd dist && npx gatsby new my-gatsby-app)
(cd dist/my-gatsby-app && yarn add "../auth0-spa-js" && prepend "$IMPORT_STATEMENT" src/pages/index.js && yarn build)
echo "test create-react-app"
(cd dist && npx create-react-app my-react-app)
(cd dist/my-react-app && yarn add "../auth0-spa-js" && prepend "$IMPORT_STATEMENT" src/index.js && yarn build)
echo "test vue"
(cd dist && npx @vue/cli create my-vue-app -d -m yarn)
(cd dist/my-vue-app && yarn add "../auth0-spa-js" && prepend "$IMPORT_STATEMENT" src/main.js && yarn build)
echo "test angular"
(cd dist && npx @angular/cli new my-angular-app --defaults=true --packageManager=yarn)
(cd dist/my-angular-app && yarn add "../auth0-spa-js" && prepend "$IMPORT_STATEMENT" src/main.ts && yarn build)
@adamjmcgrath
Copy link
Author

Usage:

$ ./run.sh branch-name # default master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment