Skip to content

Commit

Permalink
(feat) O3-4215: Enable Environment Specification for Shell Builds (#1211
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jayasanka-sack authored Nov 27, 2024
1 parent 5ca5cf1 commit 1d11a98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/tooling/openmrs/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ yargs.command(
describe:
"The locale to use as a default for this build of the app shell. Should be a value that's valid to use in an HTML lang attribute, e.g., en or en_GB.",
type: 'string',
})
.option('env', {
default: 'production',
describe: 'The environment to build for. e.g., development, production.',
type: 'string',
}),
async (args) =>
runCommand('runBuild', {
Expand Down
4 changes: 3 additions & 1 deletion packages/tooling/openmrs/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface BuildArgs {
configUrls: Array<string>;
configPaths: Array<string>;
buildConfig?: string;
env: string;
}

export type BuildConfig = Partial<{
Expand All @@ -33,6 +34,7 @@ export type BuildConfig = Partial<{
importmap: string;
routes: string;
spaPath: string;
env: string;
}>;

function loadBuildConfig(buildConfigPath?: string): BuildConfig {
Expand Down Expand Up @@ -108,7 +110,7 @@ export async function runBuild(args: BuildArgs) {
const config = loadWebpackConfig({
importmap: importMap,
routes,
env: 'production',
env: buildConfig.env || args.env,
apiUrl: buildConfig.apiUrl || args.apiUrl,
configUrls: configUrls,
defaultLocale: args.defaultLocale || buildConfig.defaultLocale,
Expand Down

0 comments on commit 1d11a98

Please sign in to comment.