Strata · API
planSourceUpgrade
planSourceUpgrade, from @niscorp/strata/upgrade, computes the upgraded form of each artifact written in an app’s source. For each artifact that a migration changes it returns the expected JSON, the migrations applied and a positional diff; the others are listed in untouched. It does not rewrite any source file.
{ nisc.nova: 2, nisc.prism: 3, theatre.kit: 0 }[
{
id: 'ticket',
file: 'src/app/ticket.layout.ts',
document: {
component: 'Card',
children: [
{ component: 'Text', children: 'The Tempest' },
{
component: 'Button',
props: { label: 'Show my ticket', tone: 'primary' },
},
],
},
},
{
id: 'programme',
file: 'src/app/programme.layout.ts',
document: { component: 'Text', children: 'This week' },
},
]{
documents: [
{
id: 'ticket',
file: 'src/app/ticket.layout.ts',
applied: ['theatre.kit/1', 'theatre.kit/2', 'theatre.kit/3'],
changes: [
'- children[1].props.label',
'+ children[1].props.text',
'- children[1].props.tone',
'+ children[1].props.variant',
'~ component: "Card" → "Tile"',
],
expected: {
component: 'Tile',
children: [
{ component: 'Text', children: 'The Tempest' },
{
component: 'Button',
props: { text: 'Show my ticket', variant: 'filled' },
},
],
},
},
],
untouched: ['nisc.nova/layout:programme'],
problems: [],
}Runs in this page on the installed package. The input and the expected output are defined by the example.