Skip to content

Commit

Permalink
adjust create template order
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 committed Sep 4, 2024
1 parent ec6828d commit ebb4f8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/cli/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function createProject(cwd: string, options: Options) {
if (options.template) return Promise.resolve(options.template);
return p.select<TemplateType>({
message: 'Which Svelte app template',
initialValue: 'demo',
initialValue: 'skeleton',
options: templates.map((t) => ({ label: t.title, value: t.name, hint: t.description }))
});
},
Expand Down
6 changes: 4 additions & 2 deletions packages/create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import fs from 'node:fs';
import path from 'node:path';
import { mkdirp, copy, dist } from './utils';

export type TemplateType = 'demo' | 'skeleton' | 'skeletonlib';
export type TemplateType = (typeof templateTypes)[number];
export type LanguageType = 'typescript' | 'checkjs' | 'none';

const templateTypes = ['skeleton', 'skeletonlib', 'demo'] as const;

export type Options = {
name: string;
template: TemplateType;
Expand Down Expand Up @@ -35,7 +37,7 @@ export function create(cwd: string, options: Options): void {
}

export type TemplateMetadata = { name: TemplateType; title: string; description: string };
export const templates: TemplateMetadata[] = fs.readdirSync(dist('templates')).map((dir) => {
export const templates: TemplateMetadata[] = templateTypes.map((dir) => {
const meta_file = dist(`templates/${dir}/meta.json`);
const { title, description } = JSON.parse(fs.readFileSync(meta_file, 'utf8'));

Expand Down

0 comments on commit ebb4f8c

Please sign in to comment.