Wercker CI 配置 rails 5.1 + reactjs 与 webpacker gem
Wercker CI config for rails 5.1 + reactjs with webpacker gem
我很难在 rails / Webpacker 项目上设置 Wercker。
我首先必须添加安装节点的步骤,然后是另一个预编译反应包的步骤,然后是安装纱线。首先它很好但是后来我向项目添加了依赖项并且知道我被困在 3 个依赖项上并具有相同的错误消息:
ERROR in ./app/javascript/app/index.js
Module not found: Error: Can't resolve 'redux-thunk' in '/pipeline/source/app/javascript/app'
@ ./app/javascript/app/index.js 5:0-32
@ ./app/javascript/packs/app.js
只有 redux-thunk
、react-redux-i18n
和 react-spinkit
才会出现这种情况
我尝试添加一个步骤yarn install
,该步骤通过了流程但没有解决问题。
这是我的 wercker.yml
:
# wercker.yml
box: ruby:2.4.1
services:
- redis
- postgres
build:
steps:
- louischavane/install-phantomjs@0.0.5
- rails-database-yml
- script:
name: nokogiri tricks
code: bundle config build.nokogiri --use-system-libraries
- bundle-install
- bigtruedata/install-node@2.1.1
- akupila/yarn@0.2.0
- script:
name: yarn-install
code: yarn install
- script:
name: pre-compile react packs
code: NODE_ENV=test bundle exec rails webpacker:compile
- script:
name: run migration
code: rake db:migrate RAILS_ENV=test
- script:
name: load fixture
code: rake db:fixtures:load RAILS_ENV=test
- script:
name: run rubocop
code: bundle exec rubocop
- script:
name: test
code: bundle exec rake test RAILS_ENV=test
找到了一种在预编译之前添加步骤以删除节点模块的方法:
- script:
name: delete node modules
code: rm -rf node_modules
更新
我现在有一个干净的 Wercker 设置处理测试,使用 chrome headless、rubocop、eslint 和 stylelint 的系统测试。您可以在这里找到它:https://gist.github.com/adesurirey/7c013bfa1a9bed9d56ffea54db5d6288
我很难在 rails / Webpacker 项目上设置 Wercker。
我首先必须添加安装节点的步骤,然后是另一个预编译反应包的步骤,然后是安装纱线。首先它很好但是后来我向项目添加了依赖项并且知道我被困在 3 个依赖项上并具有相同的错误消息:
ERROR in ./app/javascript/app/index.js
Module not found: Error: Can't resolve 'redux-thunk' in '/pipeline/source/app/javascript/app'
@ ./app/javascript/app/index.js 5:0-32
@ ./app/javascript/packs/app.js
只有 redux-thunk
、react-redux-i18n
和 react-spinkit
我尝试添加一个步骤yarn install
,该步骤通过了流程但没有解决问题。
这是我的 wercker.yml
:
# wercker.yml
box: ruby:2.4.1
services:
- redis
- postgres
build:
steps:
- louischavane/install-phantomjs@0.0.5
- rails-database-yml
- script:
name: nokogiri tricks
code: bundle config build.nokogiri --use-system-libraries
- bundle-install
- bigtruedata/install-node@2.1.1
- akupila/yarn@0.2.0
- script:
name: yarn-install
code: yarn install
- script:
name: pre-compile react packs
code: NODE_ENV=test bundle exec rails webpacker:compile
- script:
name: run migration
code: rake db:migrate RAILS_ENV=test
- script:
name: load fixture
code: rake db:fixtures:load RAILS_ENV=test
- script:
name: run rubocop
code: bundle exec rubocop
- script:
name: test
code: bundle exec rake test RAILS_ENV=test
找到了一种在预编译之前添加步骤以删除节点模块的方法:
- script:
name: delete node modules
code: rm -rf node_modules
更新
我现在有一个干净的 Wercker 设置处理测试,使用 chrome headless、rubocop、eslint 和 stylelint 的系统测试。您可以在这里找到它:https://gist.github.com/adesurirey/7c013bfa1a9bed9d56ffea54db5d6288