DEV: Remove support for legacy plugin JS compilation pipeline (#18293)
This became the default in b1755137
This commit is contained in:
parent
ae3a5f6bf0
commit
e06b9d4a52
|
@ -17,7 +17,7 @@ permissions:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.target }} ${{ matrix.build_type }} ${{ ((matrix.ember_cli_plugin_assets == '1') && '(ember-cli-compiled plugin js)') || ''}}
|
||||
name: ${{ matrix.target }} ${{ matrix.build_type }}
|
||||
runs-on: ubuntu-latest
|
||||
container: discourse/discourse_test:slim${{ startsWith(matrix.build_type, 'frontend') && '-browsers' || '' }}
|
||||
timeout-minutes: 60
|
||||
|
@ -29,7 +29,6 @@ jobs:
|
|||
PGUSER: discourse
|
||||
PGPASSWORD: discourse
|
||||
USES_PARALLEL_DATABASES: ${{ matrix.build_type == 'backend' }}
|
||||
EMBER_CLI_PLUGIN_ASSETS: ${{ matrix.ember_cli_plugin_assets }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -37,17 +36,11 @@ jobs:
|
|||
matrix:
|
||||
build_type: [backend, frontend, annotations]
|
||||
target: [core, plugins]
|
||||
ember_cli_plugin_assets: ['1', '0']
|
||||
exclude:
|
||||
- build_type: annotations
|
||||
target: plugins
|
||||
- build_type: frontend
|
||||
target: core # Handled by core_frontend_tests job (below)
|
||||
- target: core
|
||||
ember_cli_plugin_assets: '1'
|
||||
- target: plugins
|
||||
build_type: backend
|
||||
ember_cli_plugin_assets: '1'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<%
|
||||
DiscoursePluginRegistry.admin_javascripts.each { |js| require_asset(js) }
|
||||
|
||||
DiscoursePluginRegistry.each_globbed_asset(admin: true) do |f|
|
||||
if File.directory?(f)
|
||||
depend_on(f)
|
||||
else
|
||||
require_asset(f)
|
||||
end
|
||||
end
|
||||
%>
|
|
@ -145,15 +145,9 @@ module.exports = function (defaults) {
|
|||
"/app/assets/javascripts/discourse/public/assets/scripts/module-shims.js"
|
||||
);
|
||||
|
||||
let discoursePluginsTree;
|
||||
if (process.env.EMBER_CLI_PLUGIN_ASSETS !== "0") {
|
||||
discoursePluginsTree = app.project
|
||||
const discoursePluginsTree = app.project
|
||||
.findAddonByName("discourse-plugins")
|
||||
.generatePluginsTree();
|
||||
} else {
|
||||
// Empty tree - no-op
|
||||
discoursePluginsTree = mergeTrees([]);
|
||||
}
|
||||
|
||||
const terserPlugin = app.project.findAddonByName("ember-cli-terser");
|
||||
const applyTerser = (tree) => terserPlugin.postprocessTree("all", tree);
|
||||
|
|
|
@ -381,7 +381,6 @@ module.exports = {
|
|||
if (shouldLoadPluginTestJs() && type === "test-plugin-js") {
|
||||
const scripts = [];
|
||||
|
||||
if (process.env.EMBER_CLI_PLUGIN_ASSETS !== "0") {
|
||||
const pluginInfos = this.app.project
|
||||
.findAddonByName("discourse-plugins")
|
||||
.pluginInfos();
|
||||
|
@ -413,13 +412,6 @@ module.exports = {
|
|||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scripts.push({
|
||||
src: "discourse/tests/active-plugins.js",
|
||||
name: "_all",
|
||||
});
|
||||
scripts.push({ src: "admin-plugins.js", name: "_admin" });
|
||||
}
|
||||
|
||||
return scripts
|
||||
.map(
|
||||
|
@ -428,7 +420,6 @@ module.exports = {
|
|||
)
|
||||
.join("\n");
|
||||
} else if (shouldLoadPluginTestJs() && type === "test-plugin-tests-js") {
|
||||
if (process.env.EMBER_CLI_PLUGIN_ASSETS !== "0") {
|
||||
return this.app.project
|
||||
.findAddonByName("discourse-plugins")
|
||||
.pluginInfos()
|
||||
|
@ -438,9 +429,6 @@ module.exports = {
|
|||
`<script src="${config.rootURL}assets/plugins/test/${directoryName}_tests.js" data-discourse-plugin="${pluginName}"></script>`
|
||||
)
|
||||
.join("\n");
|
||||
} else {
|
||||
return `<script id="plugin-test-script" src="${config.rootURL}assets/discourse/tests/plugin-tests.js" data-discourse-plugin="_all"></script>`;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -98,15 +98,6 @@ if (process.argv.includes("-t")) {
|
|||
"/assets/plugins/*_extra.js": {
|
||||
target,
|
||||
},
|
||||
"/assets/discourse/tests/active-plugins.js": {
|
||||
target,
|
||||
},
|
||||
"/assets/admin-plugins.js": {
|
||||
target,
|
||||
},
|
||||
"/assets/discourse/tests/plugin-tests.js": {
|
||||
target,
|
||||
},
|
||||
"/plugins/": {
|
||||
target,
|
||||
},
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<%
|
||||
DiscoursePluginRegistry.javascripts.each { |js| require_asset(js) }
|
||||
DiscoursePluginRegistry.handlebars.each { |hb| require_asset(hb) }
|
||||
DiscoursePluginRegistry.each_globbed_asset do |f|
|
||||
if File.directory?(f)
|
||||
depend_on(f)
|
||||
else
|
||||
require_asset(f)
|
||||
end
|
||||
end
|
||||
%>
|
|
@ -1,3 +0,0 @@
|
|||
//= require_tree ./acceptance
|
||||
//= require_tree ./integration
|
||||
//= require_tree ./unit
|
|
@ -1,10 +0,0 @@
|
|||
<%
|
||||
Discourse.plugins.each do |p|
|
||||
root_path = "#{File.dirname(p.path)}/test/javascripts"
|
||||
|
||||
to_glob = [root_path + '/**/**.es6']
|
||||
to_glob << (root_path + '/**/**.js')
|
||||
|
||||
Dir.glob(to_glob) { |f| require_asset(f) }
|
||||
end
|
||||
%>
|
|
@ -11,7 +11,6 @@
|
|||
<%- Discourse.find_plugin_js_assets(include_disabled: true).each do |file| %>
|
||||
<%= preload_script file %>
|
||||
<%- end %>
|
||||
<%= preload_script "admin-plugins" %>
|
||||
<%= preload_script "test-support" %>
|
||||
<%= preload_script "test-helpers" %>
|
||||
<%= theme_translations_lookup %>
|
||||
|
|
|
@ -46,8 +46,6 @@ Rails.application.config.assets.precompile += %w{
|
|||
confirm-new-email/bootstrap.js
|
||||
onpopstate-handler.js
|
||||
embed-application.js
|
||||
discourse/tests/active-plugins.js
|
||||
admin-plugins.js
|
||||
scripts/discourse-test-listen-boot
|
||||
scripts/discourse-boot
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module EmberCli
|
||||
def self.plugin_assets?
|
||||
ENV["EMBER_CLI_PLUGIN_ASSETS"] != "0"
|
||||
end
|
||||
|
||||
def self.assets
|
||||
@assets ||= begin
|
||||
assets = %w(
|
||||
|
@ -18,12 +14,10 @@ module EmberCli
|
|||
)
|
||||
assets += Dir.glob("app/assets/javascripts/discourse/scripts/*.js").map { |f| File.basename(f) }
|
||||
|
||||
if plugin_assets?
|
||||
Discourse.find_plugin_js_assets(include_disabled: true).each do |file|
|
||||
next if file.ends_with?("_extra") # these are still handled by sprockets
|
||||
assets << "#{file}.js"
|
||||
end
|
||||
end
|
||||
|
||||
assets
|
||||
end
|
||||
|
|
|
@ -715,12 +715,6 @@ class Plugin::Instance
|
|||
handlebars_includes.each { |hb| contents << "require_asset('#{hb}')" }
|
||||
javascript_includes.each { |js| contents << "require_asset('#{js}')" }
|
||||
|
||||
if !EmberCli.plugin_assets?
|
||||
each_globbed_asset do |f, is_dir|
|
||||
contents << (is_dir ? "depend_on('#{f}')" : "require_asset('#{f}')")
|
||||
end
|
||||
end
|
||||
|
||||
if !contents.present?
|
||||
[js_file_path, extra_js_file_path].each do |f|
|
||||
File.delete(f)
|
||||
|
@ -732,13 +726,10 @@ class Plugin::Instance
|
|||
contents.insert(0, "<%")
|
||||
contents << "%>"
|
||||
|
||||
write_path = EmberCli.plugin_assets? ? extra_js_file_path : js_file_path
|
||||
delete_path = EmberCli.plugin_assets? ? js_file_path : extra_js_file_path
|
||||
|
||||
Discourse::Utils.atomic_write_file(write_path, contents.join("\n"))
|
||||
Discourse::Utils.atomic_write_file(extra_js_file_path, contents.join("\n"))
|
||||
|
||||
begin
|
||||
File.delete(delete_path)
|
||||
File.delete(js_file_path)
|
||||
rescue Errno::ENOENT
|
||||
end
|
||||
end
|
||||
|
@ -850,25 +841,17 @@ class Plugin::Instance
|
|||
end
|
||||
|
||||
def js_asset_exists?
|
||||
if EmberCli.plugin_assets?
|
||||
# If assets/javascripts exists, ember-cli will output a .js file
|
||||
File.exist?("#{File.dirname(@path)}/assets/javascripts")
|
||||
else
|
||||
File.exist?(js_file_path)
|
||||
end
|
||||
end
|
||||
|
||||
def extra_js_asset_exists?
|
||||
EmberCli.plugin_assets? && File.exist?(extra_js_file_path)
|
||||
File.exist?(extra_js_file_path)
|
||||
end
|
||||
|
||||
def admin_js_asset_exists?
|
||||
if EmberCli.plugin_assets?
|
||||
# If this directory exists, ember-cli will output a .js file
|
||||
File.exist?("#{File.dirname(@path)}/admin/assets/javascripts")
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Receives an array with two elements:
|
||||
|
|
|
@ -85,7 +85,7 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
|
||||
# wait for server to accept connections
|
||||
require 'net/http'
|
||||
warmup_path = "/assets/discourse/tests/active-plugins.js"
|
||||
warmup_path = "/srv/status"
|
||||
uri = URI("http://localhost:#{unicorn_port}/#{warmup_path}")
|
||||
puts "Warming up Rails server"
|
||||
|
||||
|
|
Loading…
Reference in New Issue