문제 템플릿은 지울 수 있는 기능을 둘 둔다. 참조 기능(README)과 예제 화면 기능 platform-examples-feature(starter-experience.md, CHANGELOG 6단계)다. 그 기능이 가진 경로는 제거 드릴의 SAMPLE_EXTRAS에만 있다. 그래서 문서 검사가 "이 경로는 지운 템플릿 기능의 것"을 알 길이 없다(1105/14-01, 14-03). 문서 검사가 따로 목록을 가지면 드릴과 갈라진다. 고른 방법 - scripts/lib/removable-template-features.ts에 두 기능을 적는다. 기능 ID(= src/features·tests/features 폴더 이름), 혼자 속한 context, 폴더 밖 전용 파일, 전용 package script. - 드릴은 참조 기능의 전용 파일·script를 이 모듈에서 읽는다. 목록 내용과 주석은 그대로 옮겼다. 동작은 바뀌지 않는다. - 예제 기능 항목은 다음 커밋(1105/14-01)의 문서 검사가 읽는다. 드릴은 예제 기능을 지금처럼 locateFeature로 찾는다. - 버린 대안: 문서 검사 안에 목록을 따로 두기. 드릴의 SAMPLE_EXTRAS와 두 벌이 된다. 위험·한계 - 동작 변경은 없다. 드릴 출력과 지우는 경로가 같다. 검증 - desktop batch에서 확인: corepack pnpm check:types, corepack pnpm lint, node scripts/run-vitest.ts run tests/unit/feature-removal-argument.test.ts Refs: 1105/14-01, 1105/14-03
63 lines
2.8 KiB
TypeScript
63 lines
2.8 KiB
TypeScript
/**
|
|
* The features this template ships that a copied project may delete: the
|
|
* reference sample (README "Files you can delete after copying") and the
|
|
* example screens (docs/architecture/starter-experience.md, CHANGELOG "먼저
|
|
* 할 일" 6). Each owns its folder under `src/features/` and `tests/features/`
|
|
* and the context it is the only feature of. The reference sample also owns
|
|
* files outside them, which `scripts/test-sample-removal.ts` deletes with it.
|
|
*
|
|
* This is the one list. The removal drill reads the reference sample's paths
|
|
* and scripts from it, and the documentation check reads the whole of it.
|
|
*/
|
|
export type RemovableTemplateFeature = Readonly<{
|
|
/** Its FEATURE_MODULE_ID, also its folder under src/features and tests/features. */
|
|
featureId: string;
|
|
/** The bounded context it is the only feature of; it goes with the feature. */
|
|
contextDirectory: string;
|
|
/** Files outside those folders that only this feature uses. */
|
|
extraPaths: readonly string[];
|
|
/** Package scripts that only this feature uses. */
|
|
scripts: readonly string[];
|
|
}>;
|
|
|
|
export const REMOVABLE_TEMPLATE_FEATURES: readonly RemovableTemplateFeature[] = Object.freeze([
|
|
Object.freeze({
|
|
featureId: "reference-feature",
|
|
contextDirectory: "src/contexts/reference-context",
|
|
// 0929/10-02. The HTTP scenario catalog (tests/mocks) and the negative
|
|
// type fixtures of the feature APIs run on the test contracts, so they
|
|
// are platform checks and stay (commonTestPaths in the drill).
|
|
extraPaths: Object.freeze([
|
|
"tests/component/product-feature-switch.test.tsx",
|
|
"tests/e2e/reference-form.spec.ts",
|
|
"tests/e2e/reference-route.spec.ts",
|
|
"tests/e2e/reference-save.spec.ts",
|
|
// 11-04: the growth measurement copies this sample feature.
|
|
"tests/unit/feature-shape-growth.test.ts",
|
|
"scripts/scale/measure-feature-shape-growth.ts",
|
|
"config/scale/feature-shape-growth.json",
|
|
"config/scale/feature-shape-ceilings.json",
|
|
]),
|
|
scripts: Object.freeze(["test:reference-feature"]),
|
|
}),
|
|
// 1103/09-04. The example screens /examples/ui, /examples/states and
|
|
// /examples/auth. The platform overview (/examples/platform) is a platform
|
|
// route and is not part of it.
|
|
Object.freeze({
|
|
featureId: "platform-examples-feature",
|
|
contextDirectory: "src/contexts/platform-examples-context",
|
|
extraPaths: Object.freeze([]),
|
|
scripts: Object.freeze([]),
|
|
}),
|
|
]);
|
|
|
|
/** Every path removing `feature` deletes: its folders, its context and its extra files. */
|
|
export function removableTemplateFeaturePaths(feature: RemovableTemplateFeature): readonly string[] {
|
|
return Object.freeze([
|
|
`src/features/${feature.featureId}`,
|
|
`tests/features/${feature.featureId}`,
|
|
feature.contextDirectory,
|
|
...feature.extraPaths,
|
|
]);
|
|
}
|