openmrs 7.0.0 → 7.0.1-pre.3258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -248,10 +248,17 @@ yargs_1.default.command('build', 'Builds a new app shell.', (argv) => argv
248
248
  default: 'production',
249
249
  describe: 'The environment to build for. e.g., development, production.',
250
250
  type: 'string',
251
+ })
252
+ .option('asset', {
253
+ default: [],
254
+ describe: "The path to CSS or JS assets to copy into 'assets/' in the build directory, and include as <link> and <script> tags in the generated HTML. Can be used multiple times.",
255
+ type: 'array',
256
+ coerce: (arg) => arg.map((p) => (0, node_path_1.resolve)(process.cwd(), p)),
251
257
  }), async (args) => runCommand('runBuild', {
252
258
  ...args,
253
259
  configUrls: args['config-url'],
254
260
  configPaths: args['config-path'],
261
+ assets: args['asset'],
255
262
  }));
256
263
  yargs_1.default.command('assemble', 'Assembles an import map incl. all required resources.', (argv) => argv
257
264
  .option('target', {
@@ -70,6 +70,7 @@ async function runBuild(args) {
70
70
  supportOffline: buildConfig.supportOffline ?? args.supportOffline,
71
71
  spaPath: buildConfig.spaPath || args.spaPath,
72
72
  fresh: args.fresh ?? false,
73
+ assets: args.assets || buildConfig.assets || [],
73
74
  });
74
75
  (0, utils_1.logInfo)(`Running build process ...`);
75
76
  const compiler = webpack({
@@ -58,6 +58,9 @@ function loadWebpackConfig(options = {}) {
58
58
  if (typeof options.fresh === 'boolean') {
59
59
  variables.OMRS_CLEAN_BEFORE_BUILD = options.fresh;
60
60
  }
61
+ if (Array.isArray(options.assets)) {
62
+ variables.OMRS_JS_CSS_ASSETS = options.assets.join(';');
63
+ }
61
64
  (0, variables_1.setEnvVariables)(variables);
62
65
  const config = require('@openmrs/esm-app-shell/webpack.config.js');
63
66
  if (typeof config === 'function') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmrs",
3
- "version": "7.0.0",
3
+ "version": "7.0.1-pre.3258",
4
4
  "license": "MPL-2.0",
5
5
  "main": "dist/index.js",
6
6
  "bin": "./dist/cli.js",
@@ -29,9 +29,9 @@
29
29
  ],
30
30
  "homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
31
31
  "dependencies": {
32
- "@openmrs/esm-app-shell": "7.0.0",
33
- "@openmrs/rspack-config": "7.0.0",
34
- "@openmrs/webpack-config": "7.0.0",
32
+ "@openmrs/esm-app-shell": "7.0.1-pre.3258",
33
+ "@openmrs/rspack-config": "7.0.1-pre.3258",
34
+ "@openmrs/webpack-config": "7.0.1-pre.3258",
35
35
  "@pnpm/npm-conf": "^2.1.0",
36
36
  "@rspack/cli": "^1.3.11",
37
37
  "@rspack/core": "^1.3.11",
@@ -47,6 +47,7 @@
47
47
  "ejs": "^3.1.8",
48
48
  "glob": "^7.1.3",
49
49
  "html-webpack-plugin": "^5.5.0",
50
+ "html-webpack-tags-plugin": "^3.0.2",
50
51
  "inquirer": "^7.3.3",
51
52
  "lodash": "^4.17.21",
52
53
  "lodash-es": "^4.17.21",
@@ -83,5 +84,6 @@
83
84
  "@types/react": "^18",
84
85
  "@types/semver": "^7",
85
86
  "@types/tar": "^4.0.3"
86
- }
87
+ },
88
+ "stableVersion": "7.0.0"
87
89
  }
package/src/cli.ts CHANGED
@@ -300,12 +300,20 @@ yargs.command(
300
300
  default: 'production',
301
301
  describe: 'The environment to build for. e.g., development, production.',
302
302
  type: 'string',
303
+ })
304
+ .option('asset', {
305
+ default: [],
306
+ describe:
307
+ "The path to CSS or JS assets to copy into 'assets/' in the build directory, and include as <link> and <script> tags in the generated HTML. Can be used multiple times.",
308
+ type: 'array',
309
+ coerce: (arg: Array<string>) => arg.map((p) => resolve(process.cwd(), p)),
303
310
  }),
304
311
  async (args) =>
305
312
  runCommand('runBuild', {
306
313
  ...args,
307
314
  configUrls: args['config-url'],
308
315
  configPaths: args['config-path'],
316
+ assets: args['asset'],
309
317
  }),
310
318
  );
311
319
 
@@ -22,6 +22,7 @@ export interface BuildArgs {
22
22
  configPaths: Array<string>;
23
23
  buildConfig?: string;
24
24
  env: string;
25
+ assets: Array<string>;
25
26
  }
26
27
 
27
28
  export type BuildConfig = Partial<{
@@ -35,6 +36,7 @@ export type BuildConfig = Partial<{
35
36
  routes: string;
36
37
  spaPath: string;
37
38
  env: string;
39
+ assets: Array<string>;
38
40
  }>;
39
41
 
40
42
  function loadBuildConfig(buildConfigPath?: string): BuildConfig {
@@ -119,6 +121,7 @@ export async function runBuild(args: BuildArgs) {
119
121
  supportOffline: buildConfig.supportOffline ?? args.supportOffline,
120
122
  spaPath: buildConfig.spaPath || args.spaPath,
121
123
  fresh: args.fresh ?? false,
124
+ assets: args.assets || buildConfig.assets || [],
122
125
  });
123
126
 
124
127
  logInfo(`Running build process ...`);
@@ -16,6 +16,7 @@ export interface WebpackOptions {
16
16
  coreAppsDir?: string;
17
17
  addCookie?: string;
18
18
  fresh?: boolean;
19
+ assets?: Array<string>;
19
20
  }
20
21
 
21
22
  export function loadWebpackConfig(options: WebpackOptions = {}) {
@@ -88,6 +89,10 @@ export function loadWebpackConfig(options: WebpackOptions = {}) {
88
89
  variables.OMRS_CLEAN_BEFORE_BUILD = options.fresh;
89
90
  }
90
91
 
92
+ if (Array.isArray(options.assets)) {
93
+ variables.OMRS_JS_CSS_ASSETS = options.assets.join(';');
94
+ }
95
+
91
96
  setEnvVariables(variables);
92
97
 
93
98
  const config: