Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Created frontend provisioning script
Browse files Browse the repository at this point in the history
This script handles pulling in all of the frontend's dependencies. It also creates a symlink from the node_modules directory inside the shared /vagrant folder to the Vagrant VM's home folder. This fixes issues in windows where npm install tries to create symlinks in a NTFS backed file system. It also speeds up the npm install process as Virtual Box's shared folder engine is significantly slower than a native file system, especially with npm's large number of small files.


Former-commit-id: 1059903
  • Loading branch information
DiscoStarslayer committed Sep 21, 2016
1 parent 1651b46 commit eec7424
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $ cd /vagrant && cargo run -- scrape
To install dependencies for the front-end development server and run it:

```
$ cd /vagrant/front && npm install && bower install
$ cd /vagrant/front
$ ember server --proxy=http://localhost:8080
```

Expand Down
5 changes: 5 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Vagrant.configure("2") do |config|
path: "vagrant/native_deps.sh",
keep_color: true)

config.vm.provision("frontend",
type: "shell",
path: "vagrant/frontend.sh",
keep_color: true)

config.vm.provision("postgres",
type: "shell",
path: "vagrant/postgres.sh",
Expand Down
21 changes: 21 additions & 0 deletions vagrant/frontend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -e

# global deps
npm install -g ember-cli
npm install -g bower

# keep node modules in VM file system to speedup npm install and fix it on Windows/Linux machines
mkdir -p /home/vagrant/local_front/node_modules
rm -f /vagrant/front/node_modules || true
ln -s /home/vagrant/local_front/node_modules /vagrant/front/
chown -R vagrant:vagrant /home/vagrant/local_front
chown -R vagrant:vagrant /vagrant/front/node_modules

# install local deps
su vagrant <<'EOF'
cd /vagrant/front
npm install
bower install
EOF
4 changes: 0 additions & 4 deletions vagrant/native_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ locale-gen en_US.UTF-8
apt-get update
apt-get install -y postgresql libpq-dev npm nodejs curl git
ln -s /usr/bin/nodejs /usr/bin/node

# frontend deps
npm install -g ember-cli
npm install -g bower

0 comments on commit eec7424

Please sign in to comment.