包文件→ .shtukbase/packages/quality/actions/place.ts
actions/place.ts
21 行, 1.3 KB.
文件按包中的原样显示:代码及其注释不做翻译。
- // On install and update: adds the six record types of the layer "Quality" to the placement map. The runs were
- // of the type `Run` before 0.2.0, the type of the agent run log of the package `runs`; a row `Run -> /quality/runs`
- // left by an older version is taken out first.
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
- import { place } from './lib/place.ts';
- const map = `${process.cwd()}/base/ontology/placement.md`;
- if (existsSync(map)) {
- const text = readFileSync(map, 'utf8');
- const next = text.replace(/^ +- \{itemType: Run, path: \/quality\/runs[^\n]*\n/m, '').replace(/^\|[^\n]*\| `Run` \| `\/quality\/runs` \|[^\n]*\n/m, '');
- if (next !== text) writeFileSync(map, next);
- }
- console.log(place([
- { itemType: 'Outcome', path: '/quality/outcomes', label: 'Work benefit', pkg: 'quality' },
- { itemType: 'Indicator', path: '/quality/indicators', label: 'Indicators', pkg: 'quality' },
- { itemType: 'Assumption', path: '/quality/assumptions', label: 'Assumptions', pkg: 'quality' },
- { itemType: 'Dataset', path: '/quality/datasets', label: 'Datasets', pkg: 'quality' },
- { itemType: 'QualityRun', path: '/quality/runs', label: 'Runs', pkg: 'quality' },
- { itemType: 'Measurement', path: '/quality/measurements', label: 'Measurements', pkg: 'quality' },
- ]).join('\n'));