Skip to content

Commit

Permalink
bash script for installing customizations in heroku deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
afischer committed Aug 6, 2018
1 parent 42c59f0 commit dcfc292
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: npm run build && npm start
web: ./bin/install_customizations && npm run build && npm start
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ To set the proper Heroku config variables, make sure to [set up a Google service
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
```

If you wish to deploy Library with customizations, create a git repo with the files
you would like to include. Set the `CUSTOMIZATION_GIT_REPO` environment variable
to the cloning URL. Files in the repo and packages specified in the `package.json`
will be included in your library installation.

### Using Docker
Library can be used as a base image for deployment using Docker. This allows you
to automate building and deploying a custom version of Library during Docker's
Expand Down
5 changes: 4 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@
"required": true,
"generator": "secret"
},
"CUSTOMIZATION_GIT_REPO": {
"required": false,
"description": "A git with the contents of your 'custom' directory for automatic deployment."
},
"NPM_TOKEN": {
"description": "Enter an NPM token if you are using private modules",
"required": false
}
}
}

21 changes: 21 additions & 0 deletions bin/install_customizations
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

echo "Checking for CUSTOMIZATION_GIT_REPO environment variable..."

if ! [[ -z ${CUSTOMIZATION_GIT_REPO} ]];
then
echo "Cloning custom repo...";
rm -rf ./custom;
git clone $CUSTOMIZATION_GIT_REPO custom;
echo "Installing custom packages...";
cd ./custom;
npm i;
yes | cp -rf ./node_modules/* ../node_modules;
cd ..;
echo "Rebuilding assets..."
npm run build;
else
echo "Not found. Continuing with standard Library deploy";
fi;

echo "Done!"

0 comments on commit dcfc292

Please sign in to comment.