Skip to content

Commit

Permalink
Added Easy Install Method (PolymerLabs#3387)
Browse files Browse the repository at this point in the history
* automated setup process
- converted fresh install instructions into bash script
- tested on Linux

* renamed to setup.sh

* updated setup
- changed shebang
- moved to tools

* updated setup
- fixed paths for tools dir
- tested on linux machine; works fine

* Updated readme with new install mechanism

* echo-ing to indicate progress

* added tracing for failures

* got tracing + early exiting working

* added whitespace for better tracing

* try all sourcing strategies...

* better cmd to get latest npm version

* no hardcoded node version

* cleaned up setup
- rm last step (will print options for user later)
- fixed issue: didn't install nvmrc before using it's value
- formatting

* added coloring + next steps

* better whitespace

* preferring npm ci instead of install
- should be faster than npm install

* better verbage

* stated target OS
  • Loading branch information
alxmrs authored Jul 25, 2019
1 parent 9538603 commit 717cf22
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v10.16.0
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ but if for example you see test errors on a version that's a full release later
patches that will allow more recent versions to operate, ideally without
requiring an upgrade to our current version.

### Installing the easy way

1) Run the setup script (MacOS, Linux)

```
$ ./tools/setup
```

2) That's it! (You can skip the next two sections.)


### Installing from scratch

1) Install nvm.
Expand Down
50 changes: 50 additions & 0 deletions tools/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh

ROOT=$(dirname $0)/..

NVM_VERSION="v0.34.0"

YLW="\033[33m"
RED="\033[91m"
GRN="\033[92m"
MAG="\033[95m"
BLD="\033[1m"
END="\033[0m"

CMD="$BLD$YLW"


fail() {
echo "$RED$BLD$1$END"
exit 1
}

status() {
echo "$MAG$1$END"
}

status "1. Install nvm"
curl -o- "https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/install.sh" | sh || \
fail "Failed to download nvm version $NVM_VERSION."

status "1.1 ensure nvm is in your current process"
. ~/.nvm/nvm.sh || source ~/.nvm/nvm.sh

status "2. Install node"
(cd $ROOT && nvm install && nvm use) || fail 'Failed to install target node version.'

status "3. Update npm to latest version"
nvm install-latest-npm || fail 'Failed to update npm to latest version.'

status "4. Install dependencies"
(cd $ROOT && npm ci) || fail 'Failed to install dependencies.'


echo "$GRN$BLD\n\nSETUP COMPLETE\n$END"
echo "Next, try the following:\n"
echo "- Setup git hooks: $CMD\`git config core.hooksPath tools/hooks\`$END"
echo "- Serve the project: $CMD\`npm start\`$END"
echo "- Run tests:"
echo " - $CMD\`./tools/sigh test\`$END"
echo " - $CMD\`./tools/test\`$END"

0 comments on commit 717cf22

Please sign in to comment.