discourse/script
Godfrey Chan e1373c3e84
DEV: introduce Embroider behind a flag, and start testing in CI (#23005)
Discourse core now builds and runs with Embroider! This commit adds
the Embroider-based build pipeline (`USE_EMBROIDER=1`) and start
testing it on CI.

The new pipeline uses Embroider's compat mode + webpack bundler to
build discourse code, and leave everything else (admin, wizard,
markdown-it, plugins, etc) exactly the same using the existing
Broccoli-based build as external bundles (<script> tags), passed
to the build as `extraPublicTress` (which just means they get
placed in the `/public` folder).

At runtime, these "external" bundles are glued back together with
`loader.js`. Specifically, the external bundles are compiled as
AMD modules (just as they were before) and registered with the
global `loader.js` instance. They expect their `import`s (outside
of whatever is included in the bundle) to be already available in
the `loader.js` runtime registry.

In the classic build, _every_ module gets compiled into AMD and
gets added to the `loader.js` runtime registry. In Embroider,
the goal is to do this as little as possible, to give the bundler
more flexibility to optimize modules, or omit them entirely if it
is confident that the module is unused (i.e. tree-shaking).

Even in the most compatible mode, there are cases where Embroider
is confident enough to omit modules in the runtime `loader.js`
registry (notably, "auto-imported" non-addon NPM packages). So we
have to be mindful of that an manage those dependencies ourselves,
as seen in #22703.

In the longer term, we will look into using modern features (such
as `import()`) to express these inter-dependencies.

This will only be behind a flag for a short period of time while we
perform some final testing. Within the next few weeks, we intend
to enable by default and remove the flag.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2023-09-07 13:15:43 +01:00
..
benchmarks DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
bulk_import DEV: Add experimental generic bulk import script 2023-08-09 20:56:14 +02:00
demon_test FIX: Revert Demon::DemonBase back to Demon::Base (#8132) 2019-10-02 14:54:08 +10:00
import_scripts DEV: Correct `Style/RedundantReturn` rubocop issues (#23052) 2023-08-10 02:03:38 +02:00
.gitignore improvements to the mbox import script 2017-11-18 17:16:44 +01:00
alice.txt more progress towards live unread and new counts, unread message implemented, still to implement delete messages 2013-05-30 16:49:57 +10:00
analyse_message_bus.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
analyze_sidekiq_queues.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
bench.rb DEV: Remove `RUBY_GLOBAL_METHOD_CACHE_SIZE` (#21249) 2023-04-26 10:39:39 +02:00
biggest_objects.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
boot_mem.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
cache_critical_dns FIX(cache_critical_dns): use DB port sourced from environment 2023-03-10 10:09:07 +10:00
check_forking.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
check_reproducible_assets.rb DEV: introduce Embroider behind a flag, and start testing in CI (#23005) 2023-09-07 13:15:43 +01:00
copyright-deposit Add script for compiling copyright deposits (#9646) 2020-05-06 12:51:45 -04:00
db_timestamps_mover.rb FIX: require date db_timestamps_mover script (#21248) 2023-04-26 17:59:20 +10:00
diff_heaps.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
discourse DEV: Be more lenient in CLI confirmation (#16290) 2022-03-25 20:14:41 +00:00
docker_test.rb DEV: Fix typo in `docker_test.rb` script (#23456) 2023-09-07 15:36:27 +08:00
i18n_lint.rb REFACTOR: Fix pluralized strings in chat plugin (#20357) 2023-02-20 10:31:02 +01:00
install_minio_binaries.rb DEV: Add S3 upload system specs using minio (#22975) 2023-08-23 11:18:33 +10:00
local_minio_s3.rb DEV: Add S3 upload system specs using minio (#22975) 2023-08-23 11:18:33 +10:00
measure.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
memory-analysis DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
memstats.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
micro_bench.rb DEV: Replace #pluck_first freedom patch with AR #pick in core (#19893) 2023-02-13 12:39:45 +08:00
mwrap_sidekiq PERF: avoid shelling to get hostname aggressively 2020-02-18 15:13:19 +11:00
profile_db_generator.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
promote_migrations DEV: Promote historic post_deploy migrations (#19492) 2022-12-16 13:36:30 +02:00
rails DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
redis_memory.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
require_profiler.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
spawn_backup_restore.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
start_test_db.rb DEV: Add `docker:test:setup` Rake task (#23430) 2023-09-07 13:46:23 +08:00
switch_container_ruby DEV: add script to switch ruby version from inside container 2019-03-25 17:41:24 +11:00
test_email_settings.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
test_mem.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
test_memory_leak.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
test_pretty_text.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
thread_detective.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00
user_simulator.rb DEV: Apply syntax_tree formatting to `script/*` 2023-01-09 11:13:22 +00:00