闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
740 B

  1. #!/usr/bin/env ruby
  2. $stdout.sync = true
  3. require "shellwords"
  4. require "yaml"
  5. ENV["RAILS_ENV"] ||= "development"
  6. RAILS_ENV = ENV["RAILS_ENV"]
  7. ENV["NODE_ENV"] ||= RAILS_ENV
  8. NODE_ENV = ENV["NODE_ENV"]
  9. APP_PATH = File.expand_path("../", __dir__)
  10. NODE_MODULES_PATH = File.join(APP_PATH, "node_modules")
  11. WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js")
  12. unless File.exist?(WEBPACK_CONFIG)
  13. puts "Webpack configuration not found."
  14. puts "Please run bundle exec rails webpacker:install to install webpacker"
  15. exit!
  16. end
  17. newenv = { "NODE_PATH" => NODE_MODULES_PATH.shellescape }
  18. cmdline = ["yarn", "run", "webpack", "--", "--config", WEBPACK_CONFIG] + ARGV
  19. Dir.chdir(APP_PATH) do
  20. exec newenv, *cmdline
  21. end