|
| 1 | +# Template Relocation And Naming |
| 2 | + |
| 3 | +## Context |
| 4 | + |
| 5 | +Templates currently live under `apps/` and `packages/*-template`. We want to move all template sources to a root `templates/` folder, remove the `-template` suffix from directory names, and keep generated projects in the standard `apps/` and `packages/` layout. The new templates should still be part of the workspace for lint/build/test. |
| 6 | + |
| 7 | +## Goals |
| 8 | + |
| 9 | +- Relocate template source directories into a flat `templates/` folder at the repo root. |
| 10 | +- Rename template directories to drop the `-template` suffix (for example `vue-lib-template` -> `vue-lib`). |
| 11 | +- Keep generated project outputs in `apps/` and `packages/` (not under `templates/`). |
| 12 | +- Keep template metadata in one place for `create-icebreaker` and `@icebreakers/monorepo`. |
| 13 | +- Include `templates/*` in the workspace (Option A). |
| 14 | + |
| 15 | +## Non-Goals |
| 16 | + |
| 17 | +- Changing template selection keys (for example `vue-lib`, `tsup`, `vitepress`). |
| 18 | +- Changing runtime behavior of the templates themselves. |
| 19 | + |
| 20 | +## Proposed Changes |
| 21 | + |
| 22 | +- Move templates from `apps/` and `packages/*-template` into `templates/`. |
| 23 | +- Update `pnpm-workspace.yaml` to include `templates/*`. |
| 24 | +- Replace template metadata to include both source and target paths. |
| 25 | + - Source path: location inside `templates/`. |
| 26 | + - Target path: location inside generated projects (`apps/` or `packages/`). |
| 27 | +- Update `@icebreakers/monorepo-templates` to export the new metadata and copy assets from `templates/`. |
| 28 | +- Update `create-icebreaker` to copy from source path to target path. |
| 29 | +- Update `@icebreakers/monorepo` `create` command to use source/target paths instead of a single path. |
| 30 | +- Update docs and tests that reference the old template paths. |
| 31 | + |
| 32 | +## Data Flow |
| 33 | + |
| 34 | +- `template-data.mjs` exports `{ key, label, source, target }`. |
| 35 | +- `@icebreakers/monorepo-templates` exposes the template list and directories. |
| 36 | +- `create-icebreaker` copies `templatesDir/<source>` into `<target>` under the new project. |
| 37 | +- `@icebreakers/monorepo` copies packaged `templates/<source>` into workspace `<target>`. |
| 38 | + |
| 39 | +## Risks And Mitigations |
| 40 | + |
| 41 | +- Risk: new paths break existing tests and docs. |
| 42 | + - Mitigation: update snapshot tests, docs, and references in one pass. |
| 43 | +- Risk: template packages stop participating in lint/build/test. |
| 44 | + - Mitigation: include `templates/*` in `pnpm-workspace.yaml`. |
| 45 | + |
| 46 | +## Testing |
| 47 | + |
| 48 | +- Update snapshots and unit tests referencing template paths. |
| 49 | +- Run `pnpm lint` and `pnpm test` after relocation (optional here). |
0 commit comments