-
Notifications
You must be signed in to change notification settings - Fork 203
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-3443 Command in the OpenMRS CLI to package up configurations #1052
base: main
Are you sure you want to change the base?
Changes from 2 commits
3a847a3
0f32a94
590c84e
01c7bb0
938cacd
e5d82cb
24a1420
8ee14ce
85c6899
417c5ed
44109f9
217310c
3dc93c7
99698b9
917c6e5
5267e44
1463eb4
29e1615
a532438
9cb2b4f
950aa60
0f62144
fbc311d
c675229
621c8f2
2e08f68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,6 +17,7 @@ | |||||
target: string; | ||||||
mode: string; | ||||||
config: Array<string>; | ||||||
myConfigs: Array<string>; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better naming suggestion:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay will work on this |
||||||
registry?: string; | ||||||
hashImportmap: boolean; | ||||||
fresh: boolean; | ||||||
|
@@ -43,6 +44,7 @@ | |||||
async function readConfig( | ||||||
mode: string, | ||||||
configs: Array<string>, | ||||||
myConfigs: Array<string>, | ||||||
fetchOptions: npmRegistryFetch.Options, | ||||||
): Promise<AssembleConfig> { | ||||||
switch (mode) { | ||||||
|
@@ -101,7 +103,33 @@ | |||||
return config; | ||||||
}); | ||||||
} | ||||||
case 'myConfigs':{ | ||||||
if (!myConfigs.length) { | ||||||
throw new Error('Please specify config files using the --config-file option.'); | ||||||
} | ||||||
|
||||||
const results: { | ||||||
myConfigs: Array<AssembleConfig>; | ||||||
errors: Array<Error>; | ||||||
} = { | ||||||
myConfigs: [], | ||||||
errors: [], | ||||||
}; | ||||||
|
||||||
for (const config of myConfigs) { | ||||||
if (!existsSync(config)) { | ||||||
results.errors.push(new Error(`Could not find the config file "${config}".`)); | ||||||
continue; | ||||||
} | ||||||
|
||||||
logInfo(`Reading configuration ${config} ...`); | ||||||
|
||||||
results.myConfigs.push({ | ||||||
...JSON.parse(await readFile(config, 'utf8')), | ||||||
}); | ||||||
} | ||||||
} | ||||||
case 'survey': { | ||||||
logInfo(`Loading available frontend modules ...`); | ||||||
|
||||||
const packages = await npmRegistryFetch | ||||||
|
@@ -230,7 +258,7 @@ | |||||
|
||||||
export async function runAssemble(args: AssembleArgs) { | ||||||
const npmConf = getNpmRegistryConfiguration(args.registry); | ||||||
const config = await readConfig(args.mode, args.config, npmConf); | ||||||
const config = await readConfig(args.mode, args.config, args.myConfigs, npmConf); | ||||||
|
||||||
const importmap = { | ||||||
imports: {}, | ||||||
|
@@ -303,5 +331,9 @@ | |||||
await writeFile(resolve(args.target, 'spa-assemble-config.json'), JSON.stringify(versionManifest), 'utf8'); | ||||||
} | ||||||
|
||||||
if(args.mode === 'myConfigs'){ | ||||||
await writeFile(resolve(args.target, 'My-Merged-configs.json'), JSON.stringify(config), 'utf8'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This filename should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay |
||||||
} | ||||||
|
||||||
logInfo(`Finished assembling frontend distribution`); | ||||||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @ibacher I am facing a blocker. After making the changes I want to test them but there is a persistent error in
cli.ts
file on theargs,
somehow the new argument ofconfigFiles
is missing from theargs
in thecli
yet its exported in theAssembleArgs interface
. Also when I edit the mode option to put another choice ieconfigFiles
it does not seem to get added (How do I know this, when i runyarn assemble --help
my edits for choices dont show even for the description)