Skip to content

CLI/API: add a config-driven generate command - #211

Open
sussdorff wants to merge 3 commits into
atomic-ehr:mainfrom
cognovis:feat/cli-generate-command
Open

CLI/API: add a config-driven generate command#211
sussdorff wants to merge 3 commits into
atomic-ehr:mainfrom
cognovis:feat/cli-generate-command

Conversation

@sussdorff

Copy link
Copy Markdown
Contributor
  • Add the advertised generate command, which was documented in the CLI header but did not exist.
  • Drive one or more APIBuilder pipelines from a JSON config instead of a hand-written script.
  • Resolve relative paths against the config file directory, reject unknown keys, and keep going after a failed builder so every failure is reported in one pass.
  • Walk up from the calling module to find generator assets, so the bundled CLI at dist/cli/index.js can load profile-helpers.ts.
  • Report --version from package.json instead of a hardcoded 0.1.0.

The CLI currently only emits TypeSchema NDJSON:

atomic-codegen typeschema generate hl7.fhir.r4.core@4.0.1 -o schemas.ndjson

After this change, code generation is a config file:

atomic-codegen generate --config ./codegen.json
atomic-codegen generate --config ./codegen.json --dry-run
{
  "version": 1,
  "builders": [
    {
      "name": "core",
      "fromPackages": [{ "name": "hl7.fhir.r4.core", "version": "4.0.1" }],
      "typescript": {},
      "outputTo": "./out/core",
      "cleanOutput": true
    }
  ]
}

The CLI advertised a generate command that did not exist. Add
`atomic-codegen generate --config` so APIBuilder pipelines can be
described as JSON instead of a hand-written script, and report
--version from package.json.
The previous dist/index.js filename test missed dist/cli/index.js, so
TypeScript generation from the bundled CLI could not find
profile-helpers.ts. Walk up from the calling module instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant