Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayevans committed Jun 28, 2024
2 parents bb1a8af + de76c8c commit 05c5127
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pnpm start examples/kitchen-sink --name="My Kitchen Sink" --includeStyle=false -
pnpm start https://raw.githubusercontent.com/lindsayevans/scffld/develop/examples/simple.md --name="My Remote Component"
pnpm start github:lindsayevans/scffld/examples/simple --name="My Github Component"
pnpm start github:lindsayevans/scffld/examples/simple@main --name="My Github Component"
pnpm start reg:parcel-web-app --overwrite --outputDirectory=./demo-src/reg-app/
```

Generator
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@querc/scffld",
"version": "1.2.0",
"version": "1.3.0",
"description": "Simple code scaffolding tool using a Markdown file to define templates & properties",
"main": "dist/index.js",
"bin": "./dist/cli.js",
Expand Down
16 changes: 15 additions & 1 deletion src/cli/loadTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const loadTemplate = async (templateName: string): Promise<string> => {
if (
templateName.startsWith('http:') ||
templateName.startsWith('https:') ||
templateName.startsWith('github:')
templateName.startsWith('github:') ||
templateName.startsWith('reg:')
) {
// Remote template
console.log('');
Expand All @@ -30,6 +31,19 @@ export const loadTemplate = async (templateName: string): Promise<string> => {
}/${revision}/${parts.slice(2).join('/')}${
templateName.endsWith('.md') ? '' : '.md'
}`;
} else if (templateName.startsWith('reg:')) {
let revision = 'HEAD';
const revisionMatch = templateName.match(/@([^\/]*)/i);
if (revisionMatch) {
revision = revisionMatch[1];
templateName = templateName.replace(revisionMatch[0], '');
}

const parts = templateName.replace('reg:', '').split('/');

url = `https://raw.githubusercontent.com/querc-net/scffld-registry/${revision}/templates/${parts.join(
'/'
)}${templateName.endsWith('.md') ? '' : '.md'}`;
}

const response = await fetch(url);
Expand Down

0 comments on commit 05c5127

Please sign in to comment.