digidem / mapeo-core-next

The upcoming version of Mapeo Core
MIT License
7 stars 1 forks source link

Feat: default config as dependency #543

Closed tomasciccola closed 4 months ago

tomasciccola commented 5 months ago

should close #496 . Depends on this issue to be fixed so that tests can pass.

My approach to vendoring the config was:

  1. add @mapeo/default-config as a devDependency
  2. create a script in scripts/config.js that
    1. looks for the default config file in @mapeo/default by parsing its package.json to get the version (so that we don't hardcode the filename)
    2. copies it into tests/fixtures/config/
  3. add that script as build:config and add it to test

I'm not sure if the default config should be published with core or not (I kinda remember that it shouldn't and that the default config should be a dependency of the frontend separately...)

tomasciccola commented 4 months ago
* I changed the artifact (built config) filename published by `@mapeo/default-config`, to  remove the version name from the filename. No need to make life difficult for ourselves.

:laughing:

* I made the artifact the `main` of `@mapeo/default-config`, so that we don't need to use the filename at all here - any `require` of `@mapeo/default-config` will resolve to the build config file.

Hey this is so cool, I didn't know you could do that with arbitrary assets!