From b1dac4495b66a16eecb8f799640f769b74e238df Mon Sep 17 00:00:00 2001 From: Wolfgang Wohanka Date: Wed, 27 Mar 2019 12:36:18 +0100 Subject: [PATCH] Added new config option rails_webpacker to better support v4 Webpacker 4 changed default config files babelrc and postcssrc: https://github.com/rails/webpacker/commit/8d496a0b871085648d6ee21c0e1e469d11cfe593 --- rails/create-release/README.md | 7 +++++-- rails/create-release/defaults/main.yml | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/rails/create-release/README.md b/rails/create-release/README.md index 8e3435e..2942fe9 100644 --- a/rails/create-release/README.md +++ b/rails/create-release/README.md @@ -34,13 +34,16 @@ Those file will be placed relativ to the shared folders and symlinked into the r Just set this variable in your provisioning/deployment: -``` +```yaml rails_webpacker: yes + +# if you are using Webpacker 4+, change that to: +rails_webpacker: 4 ``` This will: -1. (this role) Export these files from git in addition to the defaults: yarn.lock package.json .babelrc .postcssrc.yml +1. (this role) Export these files from git in addition to the defaults: yarn.lock package.json .babelrc .postcssrc.yml (babel.config.js and postcss.config.js if using Webpacker 4) 2. (this role) Keep/Symlink public/packs and node_modules between deployments 3. (asset precompilation) ``rake yarn:install`` is run by ``rails assets:precompile`` (from +5.1), if a bin/yarn binstub is provided. **NOTE** without that binstub no node_modules are installed! Make sure to add it with ``rails app:update:bin`` and commit to your app repo. diff --git a/rails/create-release/defaults/main.yml b/rails/create-release/defaults/main.yml index 28b011a..be54339 100644 --- a/rails/create-release/defaults/main.yml +++ b/rails/create-release/defaults/main.yml @@ -46,11 +46,15 @@ rails_deploy_custom_create_folders: [] # custom folders that are created for eac # Webpacker / yarn default settings rails_webpacker: no + rails_deploy_webpacker_archive: - yarn.lock - package.json -- .babelrc -- .postcssrc.yml +- "{% if rails_webpacker_use_webpacker == 4 %}babel.config.js{% else %}.babelrc{% endif %}" +- "{% if rails_webpacker_use_webpacker == 4 %}postcss.config.js{% else %}.postcssrc.yml{% endif %}" + + + rails_deploy_webpacker_pack_dir: public/packs rails_deploy_custom_shared_webpacker_folders: ['{{rails_deploy_webpacker_pack_dir}}', 'node_modules']