Skip to content

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Aug 27, 2025

This PR addresses the request in #286 to add scaffolding for new templates.

Changes

  • Added scripts/new_template.sh: New script for scaffolding templates similar to the existing module script
  • Created examples/templates/: Example template files with comprehensive boilerplate including:
    • Terraform configuration with Coder provider setup
    • README template with proper frontmatter and documentation structure
    • Placeholder replacements for template names
  • Enhanced scripts/new_module.sh: Now creates namespace directories automatically if they don't exist

Usage

# Create a new template
./scripts/new_template.sh my-namespace/my-template

# Create a new module (now with auto namespace creation)
./scripts/new_module.sh my-namespace/my-module

Testing

Both scripts have been tested and successfully:

  • Create namespace directories when they don't exist
  • Copy example files correctly
  • Replace placeholders with actual names
  • Set proper file permissions

Closes #286

- Add new_template.sh script for scaffolding new templates
- Create example template files in examples/templates/
- Enhance new_module.sh to create namespace directory if it doesn't exist
- Both scripts now support automatic namespace creation

Co-authored-by: matifali <[email protected]>
@matifali matifali marked this pull request as ready for review August 27, 2025 19:56
@DevelopmentCats
Copy link
Contributor

LGTM the only other thing I was thinking though, is it would be nice if in either the new_module or new_template script, it would be nice if in both scripts when its generating the namespace folder if it could also generate an example namespace README.md based on the coder namespace README as an example if it doesn't already exist.

Copy link
Contributor Author

blink-so bot commented Aug 28, 2025

Great suggestion! I'll add namespace README.md generation to both scripts. Let me implement that now.

I'll use the coder namespace README as a template and create a generic version that gets populated when a new namespace is created.

- Create examples/namespace/README.md template
- Update both new_template.sh and new_module.sh to generate namespace README
- Only creates README if namespace doesn't already have one
- Replaces NAMESPACE_NAME placeholder with actual namespace name

Co-authored-by: matifali <[email protected]>
Copy link
Contributor Author

blink-so bot commented Aug 28, 2025

Namespace README generation implemented!

What's new:

  • Created examples/namespace/README.md template based on the coder namespace
  • Both new_template.sh and new_module.sh now automatically generate namespace READMEs
  • Only creates the README if the namespace doesn't already have one (won't overwrite existing)
  • Replaces NAMESPACE_NAME placeholder with the actual namespace name

Example output when creating a new namespace:

$ ./scripts/new_template.sh my-company/docker-dev
Creating namespace directory: registry/my-company
Creating namespace README: registry/my-company/README.md
Template scaffolded successfully at registry/my-company/templates/docker-dev

The generated README includes frontmatter with display_name, bio, github, avatar, etc. - all ready for customization by the namespace owner.

@matifali matifali merged commit 65edb54 into main Aug 28, 2025
4 checks passed
@matifali matifali deleted the blink/template-scaffolder branch August 28, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve documentation and flow for contributing templates
2 participants