Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) O3-2753: Support multiple configurations when running assemble #895

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

ibacher
Copy link
Member

@ibacher ibacher commented Jan 19, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. Ensure your PR title includes a conventional commit label (such as feat, fix, or chore, among others). See existing PR titles for inspiration.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

This PR adds a couple of features to the assemble command of the CLI, both aimed at assisting with downstream distributions built on top of the reference application:

  • The assemble command now supports multiple configurations, which are merged in the order they are provided, e.g.,
     npx openmrs@next assemble --mode config --config base-config.json --config override-config.json
    The goal here is to allow implementations to take the RefApp's assemble configuration as a base and apply overrides.
  • Relatedly, the assemble command supports a new configuration key frontendModuleExcludes, which is an array of strings of frontend modules to remove from the current configuration. frontendModuleExcludes are applied in the order that the configuration files are specified, allowing a module to be excluded by one configuration and added by a later one. (I don't imagine there's a lot of use for more than two configuration files, but it seemed like the behaviour should be defined).
  • I have renamed the versions manifest spa-assemble-config.json. This is technically a breaking change, but there is very little chance that it affects anyone, as this is a sparsely documented feature. The renaming reflects a change in goal for this file. (See below).
  • Somewhat incidentally, the various tgz files are now handled entirely in memory and not written to disk. This was mostly done to be able to do away with the baseDir property, since this was determined relative to the path of the assemble configuration file, which doesn't make a lot of sense if there are multiple files potentially from multiple directories.

Screenshots

Related Issue

https://openmrs.atlassian.net/browse/O3-2753

Other

(Reading this is entirely optional)

I originally added spa-module-versions.json in #577, with the goal of having some mechanism for tracking the versions of apps available in a distribution. With the update to esm-core V5, all app version numbers are now part of the JSON registry and in #671 I switched things so these versions are leveraged in the implementer tools.

As part of O3-2753, I'm also trying to solve a long-standing problem of recording the concrete versions that make up an distribution of the O3 RefApp (and, optionally, any downstream applications). Consequently, I'm repurposing this file (which is, in essence, just the final assemble configuration) as an artifact that will be published as part of the distribution. So basically, this becomes a manifest file showing the configuration used for to generate a particular version of the Reference Application, hence the new name spa-assemble-config.json, which is a little clearer about its purpose.

Eventually, I'm hoping to restore writing the tgz files to disk, but this time into some sort of proper caching directory with actual caching logic, so we don't always have to re-download everything.

@ibacher
Copy link
Member Author

ibacher commented Jan 19, 2024

cc: @rbuisson This is step one of the distribution changes we discussed

Copy link
Contributor

Size Change: +363 B (0%)

Total Size: 2.85 MB

ℹ️ View Unchanged
Filename Size Change
packages/apps/esm-devtools-app/dist/630.js 2.69 kB 0 B
packages/apps/esm-devtools-app/dist/729.js 6.79 kB 0 B
packages/apps/esm-devtools-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-devtools-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-devtools-app/dist/875.js 9.76 kB 0 B
packages/apps/esm-devtools-app/dist/889.js 122 kB 0 B
packages/apps/esm-devtools-app/dist/961.js 25.3 kB 0 B
packages/apps/esm-devtools-app/dist/988.js 328 B 0 B
packages/apps/esm-devtools-app/dist/main.js 3.14 kB 0 B
packages/apps/esm-devtools-app/dist/openmrs-esm-devtools-app.js 3.18 kB 0 B
packages/apps/esm-implementer-tools-app/dist/271.js 517 B 0 B
packages/apps/esm-implementer-tools-app/dist/319.js 633 B 0 B
packages/apps/esm-implementer-tools-app/dist/426.js 1.67 kB 0 B
packages/apps/esm-implementer-tools-app/dist/460.js 735 B 0 B
packages/apps/esm-implementer-tools-app/dist/56.js 3.07 kB 0 B
packages/apps/esm-implementer-tools-app/dist/560.js 9.61 kB 0 B
packages/apps/esm-implementer-tools-app/dist/574.js 560 B 0 B
packages/apps/esm-implementer-tools-app/dist/587.js 2.92 kB 0 B
packages/apps/esm-implementer-tools-app/dist/620.js 126 kB 0 B
packages/apps/esm-implementer-tools-app/dist/625.js 562 B 0 B
packages/apps/esm-implementer-tools-app/dist/651.js 6.86 kB 0 B
packages/apps/esm-implementer-tools-app/dist/727.js 33 kB 0 B
packages/apps/esm-implementer-tools-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-implementer-tools-app/dist/738.js 6.79 kB 0 B
packages/apps/esm-implementer-tools-app/dist/757.js 560 B 0 B
packages/apps/esm-implementer-tools-app/dist/767.js 10.4 kB 0 B
packages/apps/esm-implementer-tools-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-implementer-tools-app/dist/807.js 559 B 0 B
packages/apps/esm-implementer-tools-app/dist/833.js 681 B 0 B
packages/apps/esm-implementer-tools-app/dist/889.js 122 kB 0 B
packages/apps/esm-implementer-tools-app/dist/913.js 61.2 kB 0 B
packages/apps/esm-implementer-tools-app/dist/main.js 73.3 kB 0 B
packages/apps/esm-implementer-tools-app/dist/openmrs-esm-implementer-tools-app.js 3.3 kB 0 B
packages/apps/esm-login-app/dist/111.js 1.22 kB 0 B
packages/apps/esm-login-app/dist/126.js 2.5 kB 0 B
packages/apps/esm-login-app/dist/173.js 1.22 kB 0 B
packages/apps/esm-login-app/dist/224.js 256 B 0 B
packages/apps/esm-login-app/dist/236.js 272 B 0 B
packages/apps/esm-login-app/dist/240.js 364 B 0 B
packages/apps/esm-login-app/dist/271.js 593 B 0 B
packages/apps/esm-login-app/dist/272.js 264 B 0 B
packages/apps/esm-login-app/dist/319.js 690 B 0 B
packages/apps/esm-login-app/dist/336.js 234 B 0 B
packages/apps/esm-login-app/dist/363.js 30.1 kB 0 B
packages/apps/esm-login-app/dist/460.js 778 B 0 B
packages/apps/esm-login-app/dist/539.js 298 B 0 B
packages/apps/esm-login-app/dist/56.js 3.06 kB 0 B
packages/apps/esm-login-app/dist/574.js 604 B 0 B
packages/apps/esm-login-app/dist/625.js 596 B 0 B
packages/apps/esm-login-app/dist/627.js 257 B 0 B
packages/apps/esm-login-app/dist/63.js 16.5 kB 0 B
packages/apps/esm-login-app/dist/644.js 305 B 0 B
packages/apps/esm-login-app/dist/673.js 284 B 0 B
packages/apps/esm-login-app/dist/729.js 6.78 kB 0 B
packages/apps/esm-login-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-login-app/dist/757.js 695 B 0 B
packages/apps/esm-login-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-login-app/dist/807.js 961 B 0 B
packages/apps/esm-login-app/dist/833.js 723 B 0 B
packages/apps/esm-login-app/dist/836.js 22.5 kB 0 B
packages/apps/esm-login-app/dist/889.js 122 kB 0 B
packages/apps/esm-login-app/dist/main.js 56.6 kB 0 B
packages/apps/esm-login-app/dist/openmrs-esm-login-app.js 3.37 kB 0 B
packages/apps/esm-offline-tools-app/dist/271.js 1.14 kB 0 B
packages/apps/esm-offline-tools-app/dist/319.js 1.24 kB 0 B
packages/apps/esm-offline-tools-app/dist/430.js 55.4 kB 0 B
packages/apps/esm-offline-tools-app/dist/460.js 1.42 kB 0 B
packages/apps/esm-offline-tools-app/dist/56.js 3.07 kB 0 B
packages/apps/esm-offline-tools-app/dist/574.js 1.13 kB 0 B
packages/apps/esm-offline-tools-app/dist/625.js 1.12 kB 0 B
packages/apps/esm-offline-tools-app/dist/63.js 16.5 kB 0 B
packages/apps/esm-offline-tools-app/dist/729.js 6.79 kB 0 B
packages/apps/esm-offline-tools-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-offline-tools-app/dist/757.js 1.3 kB 0 B
packages/apps/esm-offline-tools-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-offline-tools-app/dist/807.js 1.19 kB 0 B
packages/apps/esm-offline-tools-app/dist/833.js 1.31 kB 0 B
packages/apps/esm-offline-tools-app/dist/889.js 122 kB 0 B
packages/apps/esm-offline-tools-app/dist/922.js 81.2 kB 0 B
packages/apps/esm-offline-tools-app/dist/main.js 136 kB 0 B
packages/apps/esm-offline-tools-app/dist/openmrs-esm-offline-tools-app.js 3.29 kB 0 B
packages/apps/esm-primary-navigation-app/dist/271.js 202 B 0 B
packages/apps/esm-primary-navigation-app/dist/319.js 233 B 0 B
packages/apps/esm-primary-navigation-app/dist/34.js 21.1 kB 0 B
packages/apps/esm-primary-navigation-app/dist/460.js 258 B 0 B
packages/apps/esm-primary-navigation-app/dist/574.js 226 B 0 B
packages/apps/esm-primary-navigation-app/dist/625.js 227 B 0 B
packages/apps/esm-primary-navigation-app/dist/63.js 16.5 kB 0 B
packages/apps/esm-primary-navigation-app/dist/729.js 6.79 kB 0 B
packages/apps/esm-primary-navigation-app/dist/735.js 2.64 kB 0 B
packages/apps/esm-primary-navigation-app/dist/757.js 234 B 0 B
packages/apps/esm-primary-navigation-app/dist/762.js 7.29 kB 0 B
packages/apps/esm-primary-navigation-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-primary-navigation-app/dist/807.js 291 B 0 B
packages/apps/esm-primary-navigation-app/dist/833.js 254 B 0 B
packages/apps/esm-primary-navigation-app/dist/889.js 122 kB 0 B
packages/apps/esm-primary-navigation-app/dist/958.js 22.1 kB 0 B
packages/apps/esm-primary-navigation-app/dist/main.js 44.8 kB 0 B
packages/apps/esm-primary-navigation-app/dist/openmrs-esm-primary-navigation-app.js 3.23 kB 0 B
packages/framework/esm-api/dist/openmrs-esm-api.js 16.2 kB 0 B
packages/framework/esm-config/dist/openmrs-esm-module-config.js 7.71 kB 0 B
packages/framework/esm-dynamic-loading/dist/openmrs-esm-dynamic-loading.js 2.12 kB 0 B
packages/framework/esm-error-handling/dist/openmrs-esm-error-handling.js 894 B 0 B
packages/framework/esm-extensions/dist/openmrs-esm-extensions.js 8.05 kB 0 B
packages/framework/esm-feature-flags/dist/openmrs-esm-feature-flags.js 1.67 kB 0 B
packages/framework/esm-framework/dist/455.openmrs-esm-framework.js 4.57 kB 0 B
packages/framework/esm-framework/dist/530.openmrs-esm-framework.js 2.92 kB 0 B
packages/framework/esm-framework/dist/619.openmrs-esm-framework.js 6.49 kB 0 B
packages/framework/esm-framework/dist/645.openmrs-esm-framework.js 9.31 kB 0 B
packages/framework/esm-framework/dist/655.openmrs-esm-framework.js 6.83 kB 0 B
packages/framework/esm-framework/dist/735.openmrs-esm-framework.js 2.66 kB 0 B
packages/framework/esm-framework/dist/788.openmrs-esm-framework.js 42.9 kB 0 B
packages/framework/esm-framework/dist/openmrs-esm-framework.js 391 kB 0 B
packages/framework/esm-globals/dist/openmrs-esm-globals.js 756 B 0 B
packages/framework/esm-navigation/dist/openmrs-esm-navigation.js 9.27 kB 0 B
packages/framework/esm-offline/dist/openmrs-esm-offline.js 34.4 kB 0 B
packages/framework/esm-react-utils/dist/openmrs-esm-react-utils.js 15.7 kB 0 B
packages/framework/esm-routes/dist/openmrs-esm-utils.js 1.46 kB 0 B
packages/framework/esm-state/dist/openmrs-esm-state.js 888 B 0 B
packages/framework/esm-styleguide/dist/openmrs-esm-styleguide.js 19.1 kB 0 B
packages/framework/esm-utils/dist/openmrs-esm-utils.js 11.2 kB 0 B
packages/shell/esm-app-shell/dist/1348b3a910102b7f.js 1.58 kB 0 B
packages/shell/esm-app-shell/dist/520c9285f129a478.js 6.46 kB 0 B
packages/shell/esm-app-shell/dist/b66a463116735f62.js 3.81 kB 0 B
packages/shell/esm-app-shell/dist/openmrs.e988768cd01e62fa.js 334 kB 0 B
packages/shell/esm-app-shell/dist/service-worker.js 60.5 kB 0 B
packages/tooling/openmrs/dist/cli.js 2.86 kB +9 B (0%)
packages/tooling/openmrs/dist/commands/assemble.js 2.75 kB +354 B (+15%) ⚠️
packages/tooling/openmrs/dist/commands/build.js 1.34 kB 0 B
packages/tooling/openmrs/dist/commands/debug.js 545 B 0 B
packages/tooling/openmrs/dist/commands/develop.js 2.59 kB 0 B
packages/tooling/openmrs/dist/commands/index.js 438 B 0 B
packages/tooling/openmrs/dist/commands/start.js 851 B 0 B
packages/tooling/openmrs/dist/index.js 517 B 0 B
packages/tooling/openmrs/dist/runner.js 637 B 0 B
packages/tooling/openmrs/dist/utils/config.js 728 B 0 B
packages/tooling/openmrs/dist/utils/debugger.js 576 B 0 B
packages/tooling/openmrs/dist/utils/dependencies.js 648 B 0 B
packages/tooling/openmrs/dist/utils/helpers.js 395 B 0 B
packages/tooling/openmrs/dist/utils/importmap.js 3.07 kB 0 B
packages/tooling/openmrs/dist/utils/index.js 444 B 0 B
packages/tooling/openmrs/dist/utils/logger.js 368 B 0 B
packages/tooling/openmrs/dist/utils/npmConfig.js 830 B 0 B
packages/tooling/openmrs/dist/utils/untar.js 722 B 0 B
packages/tooling/openmrs/dist/utils/variables.js 192 B 0 B
packages/tooling/openmrs/dist/utils/webpack.js 278 B 0 B
packages/tooling/webpack-config/dist/index.js 3.58 kB 0 B

compressed-size-action

Copy link
Contributor

@rbuisson rbuisson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @ibacher . Thanks.

@ibacher ibacher merged commit 491336c into main Jan 22, 2024
10 checks passed
@ibacher ibacher deleted the feat/support-multiple-assemble-configs branch January 22, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants