Skip to content

Add --remote-source / --github-source flag to CLI #90

@nick-pape

Description

@nick-pape

Summary

PublicGitHubRepositorySource is fully implemented in @microsoft/spfx-template-api but is never exposed in the CLI. The create command only accepts --local-template for specifying template sources. Users need a way to point the CLI at custom public GitHub repos containing SPFx templates.

Requirements

Flag

Flag Type Required Description
--remote-source URL string (repeatable) No Public GitHub repo URL to use as an additional template source

Behavior

  • Accepts URLs like https://github.com/owner/repo or https://github.com/owner/repo.git
  • Can be specified multiple times to add multiple remote sources
  • Templates from remote sources are merged with the default source and any local sources
  • Applies to both create and list-templates commands

Existing infrastructure

  • PublicGitHubRepositorySource in api/spfx-template-api/src/repositories/ handles:
    • URL parsing (owner/repo extraction)
    • ZIP download from codeload.github.com
    • In-memory extraction and template parsing
    • Branch specification (defaults to main)
  • SPFxTemplateRepositoryManager.addSource() already supports multiple sources

Implementation notes

  • Add --remote-source as a CommandLineStringListParameter in both CreateAction and ListTemplatesAction
  • For each URL, create a PublicGitHubRepositorySource and add to the manager
  • Consider whether branch should be specifiable (e.g., URL#branch syntax or separate flag)

Acceptance criteria

  • --remote-source URL flag accepted on create command
  • --remote-source URL flag accepted on list-templates command
  • Multiple --remote-source flags can be combined
  • Templates from remote sources are discoverable and usable for scaffolding
  • Clear error message on invalid GitHub URLs

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions