Strata · API

verifySourceUpgrade

verifySourceUpgrade, from @niscorp/strata/upgrade, compares the edited source with the plan from planSourceUpgrade. Every planned artifact must equal its expected JSON, ignoring key order, and every untouched artifact must still be one no migration would change. strata verify updates the lock only when the result is ok.

Expected JSON (ticket)
{
  component: 'Tile',
  children: [
    { component: 'Text', children: 'The Tempest' },
    {
      component: 'Button',
      props: { text: 'Show my ticket', variant: 'filled' },
    },
  ],
}
Half-edited source (ticket)
{
  component: 'Tile',
  children: [
    { component: 'Text', children: 'The Tempest' },
    {
      component: 'Button',
      props: { text: 'Show my ticket', tone: 'primary' },
    },
  ],
}
Output
{
  halfEdited: {
    ok: false,
    lines: [
      {
        ok: false,
        text: 'nisc.nova/layout:ticket does not match its migrated JSON yet',
        detail: [
          '- children[1].props.tone',
          '+ children[1].props.variant',
        ],
      },
    ],
  },
  edited: {
    ok: true,
    lines: [
      {
        ok: true,
        text: 'nisc.nova/layout:ticket matches its migrated JSON',
      },
      {
        ok: true,
        text: '1 artifact(s) no migration touches, still untouched',
      },
    ],
  },
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.