openmrs 5.1.1-pre.999 → 5.2.0

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.
@@ -1 +1 @@
1
- openmrs:build: cache hit, replaying output b95c9aa46df817f8
1
+ openmrs:build: cache hit, replaying output 295134e241a6b9b7
package/dist/cli.js CHANGED
@@ -109,7 +109,10 @@ yargs_1.default.command("develop", "Starts a new frontend module development ses
109
109
  .describe("importmap", "The import map to use. Can be a path to a valid import map to be taken literally, an URL, or a fixed JSON object.")
110
110
  .string("routes")
111
111
  .default("routes", "routes.registry.json")
112
- .describe("routes", "The routes.registry.json file to use."), (args) => __awaiter(void 0, void 0, void 0, function* () {
112
+ .describe("routes", "The routes.registry.json file to use.")
113
+ .boolean("support-offline")
114
+ .default("support-offline", false)
115
+ .describe("support-offline", "Determines if a service worker should be installed for offline support."), (args) => __awaiter(void 0, void 0, void 0, function* () {
113
116
  return runCommand("runDevelop", Object.assign(Object.assign({ configUrls: args["config-url"] }, args), (0, utils_1.proxyImportmapAndRoutes)(yield (0, utils_1.mergeImportmapAndRoutes)(yield (0, utils_1.getImportmapAndRoutes)(args.importmap, args.routes, args.port), args.sources[0] !== false &&
114
117
  (yield (0, utils_1.runProject)(args.port, args.sources)), args.backend, args.spaPath), args.backend, args.host, args.port)));
115
118
  }));
@@ -85,8 +85,8 @@ function runBuild(args) {
85
85
  const compiler = webpack(Object.assign(Object.assign({}, config), { output: Object.assign(Object.assign({}, config.output), { path: args.target }) }));
86
86
  return yield new Promise((resolve, reject) => {
87
87
  compiler.run((err, stats) => {
88
- if (err) {
89
- reject(err);
88
+ if (err || (stats === null || stats === void 0 ? void 0 : stats.hasErrors())) {
89
+ reject(err !== null && err !== void 0 ? err : stats === null || stats === void 0 ? void 0 : stats.compilation.errors);
90
90
  }
91
91
  else {
92
92
  stats &&
@@ -10,7 +10,7 @@ const path_1 = require("path");
10
10
  const fs_1 = require("fs");
11
11
  const utils_1 = require("../utils");
12
12
  function runDevelop(args) {
13
- const { backend, host, port, open, importmap, configUrls, addCookie } = args;
13
+ const { backend, host, port, open, importmap, configUrls, addCookie, supportOffline, } = args;
14
14
  const apiUrl = (0, utils_1.removeTrailingSlash)(args.apiUrl);
15
15
  const spaPath = (0, utils_1.removeTrailingSlash)(args.spaPath);
16
16
  const app = (0, express_1.default)();
@@ -23,7 +23,7 @@ function runDevelop(args) {
23
23
  apiUrl: ${JSON.stringify(apiUrl)},
24
24
  spaPath: ${JSON.stringify(spaPath)},
25
25
  env: "development",
26
- offline: true,
26
+ offline: ${supportOffline},
27
27
  configUrls: ${JSON.stringify(configUrls)},
28
28
  });
29
29
  </script>
@@ -59,9 +59,11 @@ function runDevelop(args) {
59
59
  });
60
60
  }
61
61
  // Route for custom `service-worker.js` before most things
62
- app.get(`${spaPath}/service-worker.js`, (_, res) => {
63
- res.contentType("js").send(swContent);
64
- });
62
+ if (supportOffline) {
63
+ app.get(`${spaPath}/service-worker.js`, (_, res) => {
64
+ res.contentType("js").send(swContent);
65
+ });
66
+ }
65
67
  // Route for custom `index.html` goes above static assets
66
68
  app.get(indexHtmlPathMatcher, (_, res) => res.contentType("text/html").send(indexContent));
67
69
  // Return static assets for any request for which we have one, except importmap.json and index.html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmrs",
3
- "version": "5.1.1-pre.999",
3
+ "version": "5.2.0",
4
4
  "license": "MPL-2.0",
5
5
  "main": "dist/index.js",
6
6
  "bin": "./dist/cli.js",
@@ -30,8 +30,8 @@
30
30
  ],
31
31
  "homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
32
32
  "dependencies": {
33
- "@openmrs/esm-app-shell": "5.1.1-pre.999",
34
- "@openmrs/webpack-config": "5.1.1-pre.999",
33
+ "@openmrs/esm-app-shell": "5.2.0",
34
+ "@openmrs/webpack-config": "5.2.0",
35
35
  "@pnpm/npm-conf": "^2.1.0",
36
36
  "@swc/core": "^1.3.58",
37
37
  "autoprefixer": "^10.4.2",
@@ -69,5 +69,5 @@
69
69
  "@types/rimraf": "^2.0.2",
70
70
  "@types/tar": "^4.0.3"
71
71
  },
72
- "gitHead": "a216f155e09508cf5bdc3d244fb7a154d1e74325"
72
+ "gitHead": "f46cd16443cae13069a55067ca317ac995eef570"
73
73
  }
package/src/cli.ts CHANGED
@@ -176,7 +176,13 @@ yargs.command(
176
176
  )
177
177
  .string("routes")
178
178
  .default("routes", "routes.registry.json")
179
- .describe("routes", "The routes.registry.json file to use."),
179
+ .describe("routes", "The routes.registry.json file to use.")
180
+ .boolean("support-offline")
181
+ .default("support-offline", false)
182
+ .describe(
183
+ "support-offline",
184
+ "Determines if a service worker should be installed for offline support."
185
+ ),
180
186
  async (args) =>
181
187
  runCommand("runDevelop", {
182
188
  configUrls: args["config-url"],
@@ -155,8 +155,8 @@ export async function runBuild(args: BuildArgs) {
155
155
 
156
156
  return await new Promise<void>((resolve, reject) => {
157
157
  compiler.run((err, stats) => {
158
- if (err) {
159
- reject(err);
158
+ if (err || stats?.hasErrors()) {
159
+ reject(err ?? stats?.compilation.errors);
160
160
  } else {
161
161
  stats &&
162
162
  console.log(
@@ -22,10 +22,20 @@ export interface DevelopArgs {
22
22
  apiUrl: string;
23
23
  configUrls: Array<string>;
24
24
  addCookie: string;
25
+ supportOffline: boolean;
25
26
  }
26
27
 
27
28
  export function runDevelop(args: DevelopArgs) {
28
- const { backend, host, port, open, importmap, configUrls, addCookie } = args;
29
+ const {
30
+ backend,
31
+ host,
32
+ port,
33
+ open,
34
+ importmap,
35
+ configUrls,
36
+ addCookie,
37
+ supportOffline,
38
+ } = args;
29
39
  const apiUrl = removeTrailingSlash(args.apiUrl);
30
40
  const spaPath = removeTrailingSlash(args.spaPath);
31
41
  const app = express();
@@ -44,7 +54,7 @@ export function runDevelop(args: DevelopArgs) {
44
54
  apiUrl: ${JSON.stringify(apiUrl)},
45
55
  spaPath: ${JSON.stringify(spaPath)},
46
56
  env: "development",
47
- offline: true,
57
+ offline: ${supportOffline},
48
58
  configUrls: ${JSON.stringify(configUrls)},
49
59
  });
50
60
  </script>
@@ -96,9 +106,11 @@ export function runDevelop(args: DevelopArgs) {
96
106
  }
97
107
 
98
108
  // Route for custom `service-worker.js` before most things
99
- app.get(`${spaPath}/service-worker.js`, (_, res) => {
100
- res.contentType("js").send(swContent);
101
- });
109
+ if (supportOffline) {
110
+ app.get(`${spaPath}/service-worker.js`, (_, res) => {
111
+ res.contentType("js").send(swContent);
112
+ });
113
+ }
102
114
 
103
115
  // Route for custom `index.html` goes above static assets
104
116
  app.get(indexHtmlPathMatcher, (_, res) =>