From f971cdf9ca3ddcb5841bfac10c750dc603841d91 Mon Sep 17 00:00:00 2001 From: Jakob Schrettenbrunner Date: Mon, 11 Jun 2018 00:32:54 +0200 Subject: [PATCH] add v:serve shortcut for vagrant automatically install nodejs and yarn add some info on change detection in vagrant to BUILDING.md --- .dev/vagrant/provision.sh | 6 ++++++ BUILDING.md | 8 ++++++++ package.json | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.dev/vagrant/provision.sh b/.dev/vagrant/provision.sh index 38dc27ad8..35a2219f0 100644 --- a/.dev/vagrant/provision.sh +++ b/.dev/vagrant/provision.sh @@ -21,6 +21,12 @@ debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again # actually install apt-get install -y php7.2 php7.2-cli php7.2-gd php7.2-mysql php7.2-pdo php7.2-mbstring php7.2-tokenizer php7.2-bcmath php7.2-xml php7.2-fpm php7.2-memcached php7.2-curl php7.2-zip php-xdebug mariadb-server nginx curl tar unzip git memcached > /dev/null +echo "Install nodejs and yarn" +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - +apt-get -y install nodejs yarn > /dev/null + echo "Install composer" curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer diff --git a/BUILDING.md b/BUILDING.md index 73e74f1d4..286cc3c65 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -37,6 +37,14 @@ is the `--host` flag, which is required and should point to the machine where th The second is the `PUBLIC_PATH` environment variable which is the URL pointing to the HMR server and is appended to all of the asset URLs used in Pterodactyl. +#### Vagrant +If you want to use HMR with our Vagrant image, you can use `yarn run v:serve` as a shortcut for the correct parameters. +In order to have proper file change detection you can use the [`vagrant-notify-forwarder`](https://github.com/mhallin/vagrant-notify-forwarder) to notify file events from the host to the VM. +```sh +vagrant plugin install vagrant-notify-forwarder +vagrant reload +``` + ### Building for Production Once you have your files squared away and ready for the live server, you'll be needing to generate compiled, minified, and hashed assets to push live. To do so, run the command below: diff --git a/package.json b/package.json index 7e4d10982..45f995c34 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "watch": "NODE_ENV=development ./node_modules/.bin/webpack --watch --progress", "build": "NODE_ENV=development ./node_modules/.bin/webpack --progress", "build:production": "NODE_ENV=production ./node_modules/.bin/webpack", - "serve": "NODE_ENV=development webpack-serve --hot --config ./webpack.config.js" + "serve": "webpack-serve --hot --config ./webpack.config.js", + "v:serve": "PUBLIC_PATH=http://192.168.50.2:8080 NODE_ENV=development webpack-serve --hot --config ./webpack.config.js --host 192.168.50.2 --no-clipboard" } }