openmrs 10.0.1-pre.5539 → 10.0.1-pre.5545
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/.turbo/turbo-build.log +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -9
- package/dist/commands/build.d.ts +0 -2
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +0 -1
- package/dist/commands/debug.d.ts +0 -1
- package/dist/commands/debug.d.ts.map +1 -1
- package/dist/commands/debug.js +0 -1
- package/dist/commands/develop.d.ts +0 -1
- package/dist/commands/develop.d.ts.map +1 -1
- package/dist/commands/develop.js +1 -9
- package/dist/utils/config.d.ts +0 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +0 -3
- package/package.json +5 -5
- package/src/cli.ts +1 -11
- package/src/commands/build.ts +0 -3
- package/src/commands/debug.ts +0 -2
- package/src/commands/develop.integration.test.ts +0 -1
- package/src/commands/develop.ts +1 -29
- package/src/utils/config.test.ts +0 -10
- package/src/utils/config.ts +0 -5
package/.turbo/turbo-build.log
CHANGED
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAc,EAAE,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAkCzC,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAc,EAAE,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAkCzC,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,YA4X/B"}
|
package/dist/cli.js
CHANGED
|
@@ -75,10 +75,6 @@ export function buildCli(y) {
|
|
|
75
75
|
default: 'routes.registry.json',
|
|
76
76
|
describe: 'The routes.registry.json file to use. Can be a path to a valid routes registry to be taken literally, an URL, or a fixed JSON object.',
|
|
77
77
|
type: 'string'
|
|
78
|
-
}).option('support-offline', {
|
|
79
|
-
default: false,
|
|
80
|
-
describe: 'Determines if a service worker should be installed for offline support.',
|
|
81
|
-
type: 'boolean'
|
|
82
78
|
}).option('use-rspack', {
|
|
83
79
|
default: undefined,
|
|
84
80
|
describe: "Set this flag to force the CLI to attempt to use the Rspack Dev Server. Note that this will fail if the project you are using it in doesn't use Rspack.",
|
|
@@ -142,10 +138,6 @@ export function buildCli(y) {
|
|
|
142
138
|
default: false,
|
|
143
139
|
describe: 'Whether to clear the output directory before running the build.',
|
|
144
140
|
type: 'boolean'
|
|
145
|
-
}).option('support-offline', {
|
|
146
|
-
default: false,
|
|
147
|
-
describe: 'Determines if a service worker should be installed for offline support.',
|
|
148
|
-
type: 'boolean'
|
|
149
141
|
}).option('build-config', {
|
|
150
142
|
describe: 'Path to the SPA build config JSON',
|
|
151
143
|
type: 'string',
|
|
@@ -280,7 +272,7 @@ export function buildCli(y) {
|
|
|
280
272
|
], 'Starts the app shell using the provided configuration. This uses express for serving static files with some proxy middleware.', (argv)=>argv.number('port').default('port', 8080).describe('port', 'The port where the dev server should run.').string('host').default('host', 'localhost').describe('host', 'The host name or IP for the server to use.').string('backend').default('backend', 'https://dev3.openmrs.org/').describe('backend', 'The backend to proxy API requests to.').string('add-cookie').default('add-cookie', '').describe('add-cookie', 'Additional cookies to provide when proxying.').boolean('open').default('open', false).describe('open', 'Immediately opens the SPA page URL in the browser.'), (args)=>runCommand('runStart', {
|
|
281
273
|
...args
|
|
282
274
|
}));
|
|
283
|
-
return y.epilog('The SPA assemble config JSON is a JSON file, typically `spa-assemble-config.json`, which defines parameters for the `build` and `assemble` ' + 'commands. The keys used by `build` are:\n' + ' `apiUrl`, `spaPath`, `configPaths`, `configUrls`, `importmap`, `pageTitle`, `
|
|
275
|
+
return y.epilog('The SPA assemble config JSON is a JSON file, typically `spa-assemble-config.json`, which defines parameters for the `build` and `assemble` ' + 'commands. The keys used by `build` are:\n' + ' `apiUrl`, `spaPath`, `configPaths`, `configUrls`, `importmap`, `pageTitle`, `compress`, ' + '`compressGzip`, and `compressBrotli`;\n' + 'each of which is equivalent to the corresponding command line argument (see `openmrs build --help`). ' + 'Multiple values provided to `configPaths` and `configUrls` should be comma-separated. `compress`, ' + '`compressGzip` and `compressBrotli` take precedence over the corresponding command line flags.\n' + 'The keys used by `assemble` are:\n' + ' frontendModules \tAn object which specifies which frontend modules to include. It should have package names ' + 'for keys and versions for values.\n' + ' publicUrl \tThe URL at which the frontend modules will be made available. Can be relative to the importmap. ' + 'Defaults to `.` (which means they will be colocated with the import map).\n\n' + 'For more information visit https://github.com/openmrs/openmrs-esm-core.').help().demandCommand().strict();
|
|
284
276
|
}
|
|
285
277
|
// In ESM, the yargs default export is a factory function, not a pre-invoked Argv instance.
|
|
286
278
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export interface BuildArgs {
|
|
|
8
8
|
fresh?: boolean;
|
|
9
9
|
apiUrl: string;
|
|
10
10
|
pageTitle: string;
|
|
11
|
-
supportOffline?: boolean;
|
|
12
11
|
configUrls: Array<string>;
|
|
13
12
|
configPaths: Array<string>;
|
|
14
13
|
buildConfig?: string;
|
|
@@ -24,7 +23,6 @@ export type BuildConfig = Partial<{
|
|
|
24
23
|
configPaths: Array<string>;
|
|
25
24
|
defaultLocale: string;
|
|
26
25
|
pageTitle: string;
|
|
27
|
-
supportOffline: boolean;
|
|
28
26
|
importmap: string;
|
|
29
27
|
routes: string;
|
|
30
28
|
spaPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC,CAAC;AAiBH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,SAAS,iBA0G7C"}
|
package/dist/commands/build.js
CHANGED
|
@@ -54,7 +54,6 @@ export async function runBuild(args) {
|
|
|
54
54
|
configUrls: configUrls,
|
|
55
55
|
defaultLocale: args.defaultLocale || buildConfig.defaultLocale,
|
|
56
56
|
pageTitle: buildConfig.pageTitle || args.pageTitle,
|
|
57
|
-
supportOffline: buildConfig.supportOffline ?? args.supportOffline,
|
|
58
57
|
spaPath: buildConfig.spaPath || args.spaPath,
|
|
59
58
|
fresh: args.fresh ?? false,
|
|
60
59
|
assets: args.assets || buildConfig.assets || []
|
package/dist/commands/debug.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGrD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oBAAoB,CAAC;IAChC,
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGrD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,iBAqCvC"}
|
package/dist/commands/debug.js
CHANGED
|
@@ -12,7 +12,6 @@ export interface DevelopArgs {
|
|
|
12
12
|
configUrls: Array<string>;
|
|
13
13
|
configFiles: Array<string>;
|
|
14
14
|
addCookie: string;
|
|
15
|
-
supportOffline: boolean;
|
|
16
15
|
}
|
|
17
16
|
export declare function runDevelop(args: DevelopArgs, signal?: AbortSignal): Promise<void>;
|
|
18
17
|
//# sourceMappingURL=develop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"develop.d.ts","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAyC,MAAM,UAAU,CAAC;AAEpH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,oBAAoB,CAAC;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"develop.d.ts","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAyC,MAAM,UAAU,CAAC;AAEpH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,oBAAoB,CAAC;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,iBAgJvE"}
|
package/dist/commands/develop.js
CHANGED
|
@@ -6,7 +6,7 @@ import { readFileSync } from "node:fs";
|
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { logInfo, logWarn, removeTrailingSlash } from "../utils/index.js";
|
|
8
8
|
export async function runDevelop(args, signal) {
|
|
9
|
-
const { backend, host, port, open, importmap, routes, watchedRoutesPaths, configUrls, configFiles, addCookie
|
|
9
|
+
const { backend, host, port, open, importmap, routes, watchedRoutesPaths, configUrls, configFiles, addCookie } = args;
|
|
10
10
|
const apiUrl = removeTrailingSlash(args.apiUrl);
|
|
11
11
|
const spaPath = removeTrailingSlash(args.spaPath);
|
|
12
12
|
const app = express();
|
|
@@ -20,7 +20,6 @@ export async function runDevelop(args, signal) {
|
|
|
20
20
|
apiUrl: ${JSON.stringify(apiUrl)},
|
|
21
21
|
spaPath: ${JSON.stringify(spaPath)},
|
|
22
22
|
env: "development",
|
|
23
|
-
offline: ${supportOffline},
|
|
24
23
|
configUrls: ${JSON.stringify([
|
|
25
24
|
...configUrls,
|
|
26
25
|
...localConfigUrls
|
|
@@ -28,7 +27,6 @@ export async function runDevelop(args, signal) {
|
|
|
28
27
|
});
|
|
29
28
|
</script>
|
|
30
29
|
`).replace(/href="\/openmrs\/spa/g, `href="${spaPath}`).replace(/src="\/openmrs\/spa/g, `src="${spaPath}`).replace(/https:\/\/dev3\.openmrs\.org\/openmrs\/spa\/importmap\.json/g, `${spaPath}/importmap.json`);
|
|
31
|
-
const swContent = supportOffline ? readFileSync(resolve(source, 'service-worker.js'), 'utf-8').replace(/https:\/\/dev3\.openmrs\.org\/openmrs\/spa\//g, `${spaPath}`) : '';
|
|
32
30
|
const pageUrl = `http://${host}:${port}${spaPath}`;
|
|
33
31
|
// Set up routes. Note that different middlewares have different rules
|
|
34
32
|
// about route precedence.
|
|
@@ -76,12 +74,6 @@ export async function runDevelop(args, signal) {
|
|
|
76
74
|
res.contentType('application/json').send(stringifiedRoutes);
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
|
-
// Route for custom `service-worker.js` before most things
|
|
80
|
-
if (supportOffline) {
|
|
81
|
-
app.get(`${spaPath}/service-worker.js`, (_, res)=>{
|
|
82
|
-
res.contentType('js').send(swContent);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
77
|
configFiles.forEach((file, i)=>{
|
|
86
78
|
const url = localConfigUrls[i];
|
|
87
79
|
app.get(url, (_, res)=>{
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG3E,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG3E,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,YAAiB,QAuEvD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,YAAiB,wCAa3D"}
|
package/dist/utils/config.js
CHANGED
|
@@ -20,9 +20,6 @@ import { setEnvVariables } from "./variables.js";
|
|
|
20
20
|
if (typeof options.addCookie === 'string') {
|
|
21
21
|
variables.OMRS_ADD_COOKIE = options.addCookie;
|
|
22
22
|
}
|
|
23
|
-
if (typeof options.supportOffline === 'boolean') {
|
|
24
|
-
variables.OMRS_OFFLINE = options.supportOffline ? 'enable' : 'disable';
|
|
25
|
-
}
|
|
26
23
|
if (Array.isArray(options.configUrls)) {
|
|
27
24
|
variables.OMRS_CONFIG_URLS = options.configUrls.join(';');
|
|
28
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmrs",
|
|
3
|
-
"version": "10.0.1-pre.
|
|
3
|
+
"version": "10.0.1-pre.5545",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@inquirer/prompts": "8.3.2",
|
|
54
|
-
"@openmrs/carbon-css-guard": "10.0.1-pre.
|
|
55
|
-
"@openmrs/esm-app-shell": "10.0.1-pre.
|
|
56
|
-
"@openmrs/rspack-config": "10.0.1-pre.
|
|
57
|
-
"@openmrs/webpack-config": "10.0.1-pre.
|
|
54
|
+
"@openmrs/carbon-css-guard": "10.0.1-pre.5545",
|
|
55
|
+
"@openmrs/esm-app-shell": "10.0.1-pre.5545",
|
|
56
|
+
"@openmrs/rspack-config": "10.0.1-pre.5545",
|
|
57
|
+
"@openmrs/webpack-config": "10.0.1-pre.5545",
|
|
58
58
|
"@pnpm/npm-conf": "^3.0.2",
|
|
59
59
|
"@rspack/cli": "1.7.9",
|
|
60
60
|
"@rspack/core": "1.7.9",
|
package/src/cli.ts
CHANGED
|
@@ -117,11 +117,6 @@ export function buildCli(y: Argv) {
|
|
|
117
117
|
'The routes.registry.json file to use. Can be a path to a valid routes registry to be taken literally, an URL, or a fixed JSON object.',
|
|
118
118
|
type: 'string',
|
|
119
119
|
})
|
|
120
|
-
.option('support-offline', {
|
|
121
|
-
default: false,
|
|
122
|
-
describe: 'Determines if a service worker should be installed for offline support.',
|
|
123
|
-
type: 'boolean',
|
|
124
|
-
})
|
|
125
120
|
.option('use-rspack', {
|
|
126
121
|
default: undefined,
|
|
127
122
|
describe:
|
|
@@ -206,11 +201,6 @@ export function buildCli(y: Argv) {
|
|
|
206
201
|
describe: 'Whether to clear the output directory before running the build.',
|
|
207
202
|
type: 'boolean',
|
|
208
203
|
})
|
|
209
|
-
.option('support-offline', {
|
|
210
|
-
default: false,
|
|
211
|
-
describe: 'Determines if a service worker should be installed for offline support.',
|
|
212
|
-
type: 'boolean',
|
|
213
|
-
})
|
|
214
204
|
.option('build-config', {
|
|
215
205
|
describe: 'Path to the SPA build config JSON',
|
|
216
206
|
type: 'string',
|
|
@@ -409,7 +399,7 @@ export function buildCli(y: Argv) {
|
|
|
409
399
|
.epilog(
|
|
410
400
|
'The SPA assemble config JSON is a JSON file, typically `spa-assemble-config.json`, which defines parameters for the `build` and `assemble` ' +
|
|
411
401
|
'commands. The keys used by `build` are:\n' +
|
|
412
|
-
' `apiUrl`, `spaPath`, `configPaths`, `configUrls`, `importmap`, `pageTitle`, `
|
|
402
|
+
' `apiUrl`, `spaPath`, `configPaths`, `configUrls`, `importmap`, `pageTitle`, `compress`, ' +
|
|
413
403
|
'`compressGzip`, and `compressBrotli`;\n' +
|
|
414
404
|
'each of which is equivalent to the corresponding command line argument (see `openmrs build --help`). ' +
|
|
415
405
|
'Multiple values provided to `configPaths` and `configUrls` should be comma-separated. `compress`, ' +
|
package/src/commands/build.ts
CHANGED
|
@@ -27,7 +27,6 @@ export interface BuildArgs {
|
|
|
27
27
|
fresh?: boolean;
|
|
28
28
|
apiUrl: string;
|
|
29
29
|
pageTitle: string;
|
|
30
|
-
supportOffline?: boolean;
|
|
31
30
|
configUrls: Array<string>;
|
|
32
31
|
configPaths: Array<string>;
|
|
33
32
|
buildConfig?: string;
|
|
@@ -44,7 +43,6 @@ export type BuildConfig = Partial<{
|
|
|
44
43
|
configPaths: Array<string>;
|
|
45
44
|
defaultLocale: string;
|
|
46
45
|
pageTitle: string;
|
|
47
|
-
supportOffline: boolean;
|
|
48
46
|
importmap: string;
|
|
49
47
|
routes: string;
|
|
50
48
|
spaPath: string;
|
|
@@ -134,7 +132,6 @@ export async function runBuild(args: BuildArgs) {
|
|
|
134
132
|
configUrls: configUrls,
|
|
135
133
|
defaultLocale: args.defaultLocale || buildConfig.defaultLocale,
|
|
136
134
|
pageTitle: buildConfig.pageTitle || args.pageTitle,
|
|
137
|
-
supportOffline: buildConfig.supportOffline ?? args.supportOffline,
|
|
138
135
|
spaPath: buildConfig.spaPath || args.spaPath,
|
|
139
136
|
fresh: args.fresh ?? false,
|
|
140
137
|
assets: args.assets || buildConfig.assets || [],
|
package/src/commands/debug.ts
CHANGED
|
@@ -7,7 +7,6 @@ export interface DebugArgs {
|
|
|
7
7
|
host: string;
|
|
8
8
|
backend: string;
|
|
9
9
|
importmap: ImportmapDeclaration;
|
|
10
|
-
supportOffline?: boolean;
|
|
11
10
|
spaPath: string;
|
|
12
11
|
apiUrl: string;
|
|
13
12
|
configUrls: Array<string>;
|
|
@@ -23,7 +22,6 @@ export function runDebug(args: DebugArgs) {
|
|
|
23
22
|
importmap: args.importmap,
|
|
24
23
|
backend: args.backend,
|
|
25
24
|
apiUrl: args.apiUrl,
|
|
26
|
-
supportOffline: args.supportOffline,
|
|
27
25
|
spaPath: args.spaPath,
|
|
28
26
|
configUrls: args.configUrls,
|
|
29
27
|
addCookie: args.addCookie,
|
package/src/commands/develop.ts
CHANGED
|
@@ -19,23 +19,10 @@ export interface DevelopArgs {
|
|
|
19
19
|
configUrls: Array<string>;
|
|
20
20
|
configFiles: Array<string>;
|
|
21
21
|
addCookie: string;
|
|
22
|
-
supportOffline: boolean;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export async function runDevelop(args: DevelopArgs, signal?: AbortSignal) {
|
|
26
|
-
const {
|
|
27
|
-
backend,
|
|
28
|
-
host,
|
|
29
|
-
port,
|
|
30
|
-
open,
|
|
31
|
-
importmap,
|
|
32
|
-
routes,
|
|
33
|
-
watchedRoutesPaths,
|
|
34
|
-
configUrls,
|
|
35
|
-
configFiles,
|
|
36
|
-
addCookie,
|
|
37
|
-
supportOffline,
|
|
38
|
-
} = args;
|
|
25
|
+
const { backend, host, port, open, importmap, routes, watchedRoutesPaths, configUrls, configFiles, addCookie } = args;
|
|
39
26
|
const apiUrl = removeTrailingSlash(args.apiUrl);
|
|
40
27
|
const spaPath = removeTrailingSlash(args.spaPath);
|
|
41
28
|
const app = express();
|
|
@@ -54,7 +41,6 @@ export async function runDevelop(args: DevelopArgs, signal?: AbortSignal) {
|
|
|
54
41
|
apiUrl: ${JSON.stringify(apiUrl)},
|
|
55
42
|
spaPath: ${JSON.stringify(spaPath)},
|
|
56
43
|
env: "development",
|
|
57
|
-
offline: ${supportOffline},
|
|
58
44
|
configUrls: ${JSON.stringify([...configUrls, ...localConfigUrls])},
|
|
59
45
|
});
|
|
60
46
|
</script>
|
|
@@ -64,13 +50,6 @@ export async function runDevelop(args: DevelopArgs, signal?: AbortSignal) {
|
|
|
64
50
|
.replace(/src="\/openmrs\/spa/g, `src="${spaPath}`)
|
|
65
51
|
.replace(/https:\/\/dev3\.openmrs\.org\/openmrs\/spa\/importmap\.json/g, `${spaPath}/importmap.json`);
|
|
66
52
|
|
|
67
|
-
const swContent = supportOffline
|
|
68
|
-
? readFileSync(resolve(source, 'service-worker.js'), 'utf-8').replace(
|
|
69
|
-
/https:\/\/dev3\.openmrs\.org\/openmrs\/spa\//g,
|
|
70
|
-
`${spaPath}`,
|
|
71
|
-
)
|
|
72
|
-
: '';
|
|
73
|
-
|
|
74
53
|
const pageUrl = `http://${host}:${port}${spaPath}`;
|
|
75
54
|
|
|
76
55
|
// Set up routes. Note that different middlewares have different rules
|
|
@@ -119,13 +98,6 @@ export async function runDevelop(args: DevelopArgs, signal?: AbortSignal) {
|
|
|
119
98
|
});
|
|
120
99
|
}
|
|
121
100
|
|
|
122
|
-
// Route for custom `service-worker.js` before most things
|
|
123
|
-
if (supportOffline) {
|
|
124
|
-
app.get(`${spaPath}/service-worker.js`, (_, res) => {
|
|
125
|
-
res.contentType('js').send(swContent);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
101
|
configFiles.forEach((file, i) => {
|
|
130
102
|
const url = localConfigUrls[i];
|
|
131
103
|
app.get(url, (_, res) => {
|
package/src/utils/config.test.ts
CHANGED
|
@@ -27,16 +27,6 @@ describe('setBundlerEnv', () => {
|
|
|
27
27
|
expect(process.env.OMRS_ADD_COOKIE).toBe('session=abc');
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it('sets OMRS_OFFLINE to "enable" when supportOffline is true', () => {
|
|
31
|
-
setBundlerEnv({ supportOffline: true });
|
|
32
|
-
expect(process.env.OMRS_OFFLINE).toBe('enable');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('sets OMRS_OFFLINE to "disable" when supportOffline is false', () => {
|
|
36
|
-
setBundlerEnv({ supportOffline: false });
|
|
37
|
-
expect(process.env.OMRS_OFFLINE).toBe('disable');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
30
|
it('sets OMRS_CONFIG_URLS to semicolon-joined string from configUrls', () => {
|
|
41
31
|
setBundlerEnv({ configUrls: ['https://a.com/config.json', 'https://b.com/config.json'] });
|
|
42
32
|
expect(process.env.OMRS_CONFIG_URLS).toBe('https://a.com/config.json;https://b.com/config.json');
|
package/src/utils/config.ts
CHANGED
|
@@ -11,7 +11,6 @@ export interface BuildOptions {
|
|
|
11
11
|
apiUrl?: string;
|
|
12
12
|
spaPath?: string;
|
|
13
13
|
pageTitle?: string;
|
|
14
|
-
supportOffline?: boolean;
|
|
15
14
|
configUrls?: Array<string>;
|
|
16
15
|
env?: string;
|
|
17
16
|
coreAppsDir?: string;
|
|
@@ -47,10 +46,6 @@ export function setBundlerEnv(options: BuildOptions = {}) {
|
|
|
47
46
|
variables.OMRS_ADD_COOKIE = options.addCookie;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
if (typeof options.supportOffline === 'boolean') {
|
|
51
|
-
variables.OMRS_OFFLINE = options.supportOffline ? 'enable' : 'disable';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
49
|
if (Array.isArray(options.configUrls)) {
|
|
55
50
|
variables.OMRS_CONFIG_URLS = options.configUrls.join(';');
|
|
56
51
|
}
|