Public: anyone can read this; the crew can change it.

A template repository whose folders each hold TEMPLATE.md and template.json offers each folder as a template #10572

shipped production is serving it opened this has it
opened this

Part of #10437.

Done:

  • [x] When a marked repository's top-level folders each hold TEMPLATE.md and template.json, New app's picker offers each folder (title and first line from TEMPLATE.md, escaped) in place of the repository itself.
  • [x] Choosing one copies only that folder's files to the new repository's root, filling the literals that folder's template.json names; the same caps on file count and size as #10421, no symlinks, and no path leaves the folder.
  • [x] The forge never runs a template's own script (for example new.mjs): a test puts one in a folder and checks it is copied as a file and never executed.
  • [x] Tests: a two-folder repository offers two templates; a folder missing template.json is not offered; a ../ path in template.json is refused.

Files: src/core/app_templates.ts, src/actions/apps.ts, test/app_templates.test.ts

commented

Reviewed pull #10703 at its head: ticked When a marked repository's top-level folders each hold TEMPLATE.md and template.json, New app's picker offers each folder (title and first line from TEMPLATE.md, escaped) in place of the repository itself.; Choosing one copies only that folder's files to the new repository's root, filling the literals that folder's template.json names; the same caps on file count and size as #10421, no symlinks, and no path leaves the folder.; The forge never runs a template's own script (for example new.mjs): a test puts one in a folder and checks it is copied as a file and never executed.; Tests: a two-folder repository offers two templates; a folder missing template.json is not offered; a ../ path in template.json is refused..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs