Skip to content

Commit 36a42a1

Browse files
authored
feat: wdx 64 (#299)
1 parent bf6fdde commit 36a42a1

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

packages/cli/src/commands/create/actions.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,15 @@ describe('fetchBlueprintRepositories', () => {
353353
clone_url: 'https://github.com/storyblok/blueprint-core-vue.git',
354354
description: 'A Vue starter',
355355
updated_at: '2024-01-01T00:00:00Z',
356+
stargazers_count: 50,
356357
},
357358
{
358359
name: 'blueprint-core-react',
359360
topics: ['port-3000'],
360361
clone_url: 'https://github.com/storyblok/blueprint-core-react.git',
361362
description: 'A React starter',
362363
updated_at: '2024-01-02T00:00:00Z',
364+
stargazers_count: 75,
363365
},
364366
// Should be filtered out - not a blueprint
365367
{
@@ -395,7 +397,7 @@ describe('fetchBlueprintRepositories', () => {
395397

396398
// Only blueprint-core-* repos should be mapped and sorted alphabetically
397399
expect(blueprints).toHaveLength(2);
398-
expect(blueprints?.[0]?.name).toBe('React'); // Sorted alphabetically
400+
expect(blueprints?.[0]?.name).toBe('React');
399401
expect(blueprints?.[1]?.name).toBe('Vue');
400402

401403
// Verify blueprint structure
@@ -406,6 +408,7 @@ describe('fetchBlueprintRepositories', () => {
406408
location: 'https://localhost:3000/',
407409
description: 'A React starter',
408410
updated_at: '2024-01-02T00:00:00Z',
411+
stars: 75,
409412
});
410413
});
411414

packages/cli/src/commands/create/actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export const repositoryToTemplate = (repo: any): DynamicTemplate => {
176176
location: port ? `https://localhost:${port}/` : 'https://localhost:3000/',
177177
description: repo.description,
178178
updated_at: repo.updated_at,
179+
stars: repo.stargazers_count,
179180
};
180181
};
181182

@@ -195,7 +196,7 @@ export const fetchBlueprintRepositories = async () => {
195196
const blueprints = data.items
196197
.filter(repo => repo.name.startsWith('blueprint-core-'))
197198
.map(repositoryToTemplate)
198-
.sort((a, b) => a.name.localeCompare(b.name));
199+
.sort((a, b) => (b.stars || 0) - (a.stars || 0));
199200

200201
return blueprints;
201202
}

packages/cli/src/commands/create/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ export interface DynamicTemplate {
5959
location: string;
6060
description?: string | null;
6161
updated_at?: string;
62+
stars?: number;
6263
}

packages/cli/src/commands/create/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ export const createCommand = program
247247
cd ${finalProjectPath}
248248
npm install
249249
npm run dev
250-
`);
250+
`);
251+
konsola.info(`Or check the dedicated guide at: ${chalk.hex(colorPalette.PRIMARY)(`https://www.storyblok.com/docs/guides/${technologyTemplate}`)}`);
251252
}
252253
catch (error) {
253254
spinnerSpace.failed();

0 commit comments

Comments
 (0)