Skip to content
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

Capture model merge #529

Merged
merged 5 commits into from
Mar 14, 2022
Merged

Conversation

stephenwf
Copy link
Member

This is a chunky PR, but a relatively small change. It is non-breaking.

Why?

At the moment, to change a the styling on a label requires building a separate project, building, a pull request, and finally a published package, and then finally a PR to Madoc with a version bump - no easy visibility of the change - and then a Madoc build, review, merge, publish. Madoc is the only consumer of the capture model packages, and development of the two are closely tied.

We need to accelerate the development of capture models, and the UI is becoming more interconnected with Madoc (while still being reusable). This change will make iterations quicker, and changes clearer.

How?

  • Copied all typescript code from https://github.com/digirati-co-uk/capture-models
  • Organised into similar folder structure, but single source
  • Changed all imports
  • Fixed long standing typo with the "caputre-models" folder
  • Fixed previous interface extension
  • Added some extra imports for default capture model fields, selectors and content types
  • Migrated fixtures
  • Migrates stories - renamed with "Capture Model /" prefix for the storybook (fixed imports)
  • Migrated tests - fixed import paths
  • Fixed path with universal viewer
  • Removed @capture-model/* dependencies

The old repository

The last 2 packages still in the old repository are the following

  • @capture-models/repository
  • @capture-models/server

These will be merged together into a new repository, and a single package will be created for spinning up a server easily with NodeJS (as it currently works now). The new source of truth for the types and helpers is Madoc.

The NPM folder in Madoc is there to allow Madoc to publish multiple packages, each tied to Madoc published tags. A new package will be created under the @capture-models/ name space (e.g. @capture-models/core) that will contain all of the current helpers, plugin systems and types provided by the previous packages. It makes more sense for these to be tied to Madoc versions for now, as that is the primary (and currently only) consumer of those packages.

Until that is in place however, the code for saving capture models will need to be updated with changes to types or helpers (which is rare - for helpers used by both). Any helpers used exclusively by the server will be copied across to there, and remove from here.

Benefits

  • Much quicker iterations
  • Easier to scale content types, input types and selectors for the next set of Madoc updates
  • The Vault/Canvas Panel upgrade path is simplified, with only one repository to update - with typescript doing half of the work.
  • Broader tests to cover mixed interactions with Madoc + Models
  • Single styled components theme
  • Single translations

Downsides

  • The builds will be longer, this is a non-trivial amount of code being added from the other repository - however the code size will reduce overtime, as it is now safer to remove large unused sections of old UI and duplications previously copied into Madoc.
  • Extra overhead to maintain the server - however this is quickly displaced by time saved
  • Capture model packages in limbo - As mentioned, Madoc will eventually publish a replacement for types and helpers - but not right away.

Follow up work

  • Pruning - Not included in this PR is any sort of pruning of old components. This is intended to be reduce risk and ensure all model code is included in Madoc history, if something is removed that is later required.
  • International model field - Since capture models can now access all of Madoc's components, they can use the International field used for editing IIIF language maps, which would be a welcome addition to Capture Models.
  • Canvas panel/Vault - This does not include any migration for Canvas Panel or Vault, but it will make this process smoother, as previously mentioned.

@netlify
Copy link

netlify bot commented Mar 11, 2022

✔️ Deploy Preview for madoc-storybook ready!

🔨 Explore the source changes: 9470f24

🔍 Inspect the deploy log: https://app.netlify.com/sites/madoc-storybook/deploys/622b21a2b3c8f9000886f601

😎 Browse the preview: https://deploy-preview-529--madoc-storybook.netlify.app

@stephenwf stephenwf merged commit de0d1ce into feature/quick-fixes Mar 14, 2022
@stephenwf stephenwf deleted the feature/capture-model-merge branch March 14, 2022 09:39
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