mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 17:33:39 +08:00
11369018b6
We were writing theme-transpiler JS files to the filesystem on a per-process basis, and then immediately reading them back in. Plus, there was no cleanup mechanism, so the tmp directory would grow indefinitely. This commit refactors things so that the `build.js` script outputs the theme-transpiler source to stdout. That way, we can read it directly into the process, and then into mini-racer, without needing to go via the filesystem. No cleanup required! In production, the theme-transpiler is still cached in a file during `assets:precompile`
18 lines
438 B
Ruby
18 lines
438 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "assets:precompile" do
|
|
before do
|
|
Rake::Task.clear
|
|
Discourse::Application.load_tasks
|
|
end
|
|
|
|
describe "assets:precompile:theme_transpiler" do
|
|
it "compiles the js processor" do
|
|
path = Rake::Task["assets:precompile:theme_transpiler"].actions.first.call
|
|
|
|
expect(path).to end_with("tmp/theme-transpiler.js")
|
|
expect(File.exist?(path)).to eq(true)
|
|
end
|
|
end
|
|
end
|