Skip to content

Conversation

adamdicarlo0
Copy link
Contributor

@adamdicarlo0 adamdicarlo0 commented Jul 29, 2025

This version is factored into logical commits(!).

Unlike the first version of this effort, this one does not use any tricks to make Elm think the local package is a real package; it just uses source-directories for that (and is careful about not having any Gen. modules in the example project, in order to avoid name collisions).

  • Move the CLI-only files into ./cli
  • Start with a copy of original elm.json in ./cli
  • Move /codegen/Gen into /src, add to CLI source-directories
  • Rewrite root elm.json to be for elm-open-api-codegen package
  • Remove the one reference in package to the Cli module
  • Move Cli -> OpenApi.BackendTask to preserve git history
  • Move CLI generation to OpenApi.BackendTask module
  • Readd Cli.elm
  • Adjust elm-review config to reflect new project structure
  • Add docstrings for package
  • Split package.json into root and cli
  • Update TestGenScript
  • Add elm-open-api-codegen example project
  • Fix CI

CAVEATS:

  • A single Elm Review project is reviewing the package and the CLI code.
  • This is not intended to be published directly, but rather followed up with a PR(s) to more thoughtfully consider the package's exposed API. I have left a number of TODO markers where it seems like an easy call that "this should not be exposed".

- Since the root project is now an Elm package, all code it needs must be
  in its src folder. (Packages don't support `source-directories`.)
- Add package's src folder to the CLI's `elm.json`.
@adamdicarlo0 adamdicarlo0 force-pushed the split-into-package-plus-cli-redux branch from 312c443 to 6f6261a Compare July 30, 2025 00:42
@adamdicarlo0 adamdicarlo0 force-pushed the split-into-package-plus-cli-redux branch from 6f6261a to 722866d Compare July 30, 2025 00:53
The previously installed version had a bug where it required you to
install Vite yourself for its use.
@adamdicarlo0 adamdicarlo0 force-pushed the split-into-package-plus-cli-redux branch from 577c885 to 5afec96 Compare July 30, 2025 01:21
@adamdicarlo0
Copy link
Contributor Author

Sorry for the force-pushes!

The first was to fix a bug (I'd used a slightly outdated Cli.elm).

The second was to preserve git history for src/Cli.elm -- that git history is now in src/OpenApi/BackendTask.elm. Now cli/src/Cli.elm is all attributed to me, but the majority of its code, which is now in OpenApi.BackendTask, has its proper history. (It was opposite before.)

The third was to upgrade elm-pages rather than re-install vite to make the older elm-pages version work.

@miniBill
Copy link
Collaborator

Force pushes are fine in branches, no worries 👍

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.

2 participants