ShtukbaseStandard
файл пакета→ .shtukbase/packages/quality/actions/place.ts

actions/place.ts

21 строка, 1.3 КБ.

Файл как есть в пакете: код и комментарии в нём не переводятся.

  1. // On install and update: adds the six record types of the layer "Quality" to the placement map. The runs were
  2. // of the type `Run` before 0.2.0, the type of the agent run log of the package `runs`; a row `Run -> /quality/runs`
  3. // left by an older version is taken out first.
  4. import { existsSync, readFileSync, writeFileSync } from 'node:fs';
  5. import { place } from './lib/place.ts';
  6. const map = `${process.cwd()}/base/ontology/placement.md`;
  7. if (existsSync(map)) {
  8. const text = readFileSync(map, 'utf8');
  9. const next = text.replace(/^ +- \{itemType: Run, path: \/quality\/runs[^\n]*\n/m, '').replace(/^\|[^\n]*\| `Run` \| `\/quality\/runs` \|[^\n]*\n/m, '');
  10. if (next !== text) writeFileSync(map, next);
  11. }
  12. console.log(place([
  13. { itemType: 'Outcome', path: '/quality/outcomes', label: 'Work benefit', pkg: 'quality' },
  14. { itemType: 'Indicator', path: '/quality/indicators', label: 'Indicators', pkg: 'quality' },
  15. { itemType: 'Assumption', path: '/quality/assumptions', label: 'Assumptions', pkg: 'quality' },
  16. { itemType: 'Dataset', path: '/quality/datasets', label: 'Datasets', pkg: 'quality' },
  17. { itemType: 'QualityRun', path: '/quality/runs', label: 'Runs', pkg: 'quality' },
  18. { itemType: 'Measurement', path: '/quality/measurements', label: 'Measurements', pkg: 'quality' },
  19. ]).join('\n'));