mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
DEV: Ember CLI postinstall hook and shortcut (#12987)
This commit is contained in:
@ -15,14 +15,28 @@ PROXY =
|
|||||||
"http://localhost:#{PORT}"
|
"http://localhost:#{PORT}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.include?("-h") || ARGV.include?("--help")
|
command =
|
||||||
puts "ember-cli OPTIONS"
|
if ARGV.include?("--test")
|
||||||
puts "--try To proxy try.discourse.org", ""
|
"test"
|
||||||
puts "The rest of the arguments are passed to ember server per:", ""
|
else
|
||||||
exec "yarn --cwd #{yarn_dir} run ember server --help"
|
"server"
|
||||||
|
end
|
||||||
|
|
||||||
|
class String
|
||||||
|
def cyan
|
||||||
|
"\e[36m#{self}\e[0m"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
args = ["--cwd", yarn_dir, "run", "ember", "server"] + ARGV.reject { |a| a == "--try" }
|
if ARGV.include?("-h") || ARGV.include?("--help")
|
||||||
|
puts "ember-cli OPTIONS"
|
||||||
|
puts "#{"--try".cyan} To proxy try.discourse.org", ""
|
||||||
|
puts "#{"--test".cyan} To run the test suite", ""
|
||||||
|
puts "The rest of the arguments are passed to ember server per:", ""
|
||||||
|
exec "yarn --cwd #{yarn_dir} run ember #{command} --help"
|
||||||
|
end
|
||||||
|
|
||||||
|
args = ["--cwd", yarn_dir, "run", "ember", command] + ARGV.reject { |a| a == "--try" || "--test" }
|
||||||
|
|
||||||
if !args.include?("--proxy")
|
if !args.include?("--proxy")
|
||||||
args << "--proxy"
|
args << "--proxy"
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"sinon": "^9.0.2"
|
"sinon": "^9.0.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('NPM is not supported, please use Yarn instead. ')\""
|
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('NPM is not supported, please use Yarn instead. ')\"",
|
||||||
|
"postinstall": "yarn --cwd app/assets/javascripts/discourse"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user