Skip to content

Commit

Permalink
feat: Add vite template (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrr523 authored Sep 15, 2023
1 parent 5fab330 commit 6aaf062
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-toys-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bnb-chain/create-gnfd-app': patch
---

feat: Add vite template
2 changes: 1 addition & 1 deletion packages/create-gnfd-app/createApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function createApp({
}

/* eslint-disable-next-line no-console */
console.log(`Creating a new Greenfield app in ${green(root)}.`);
console.log(`Creating a new Greenfield app in ${green(appName)}.`);
process.chdir(root);

startSpinner('downloading template...');
Expand Down
Binary file modified packages/create-gnfd-app/example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/create-gnfd-app/helpers/install-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { failSpinner, startSpinner, succeedSpiner } from './spinner';

export const SRC_DIR_NAMES = ['app', 'pages', 'styles'];

export type TemplateType = 'nextjs' | 'cra';
export type TemplateType = 'nextjs' | 'cra' | 'vite';
export type TemplateMode = 'js' | 'ts';

export const installTemplate = async ({ appName, root, packageManager }: InstallTemplateArgs) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-gnfd-app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import path, { resolve } from 'path';
import { cyan, green } from 'picocolors';
import validateNpmName from 'validate-npm-package-name';
import { createApp } from './createApp';
import { getPkgManager, PackageManager } from './helpers/get-pkg-manager';
import { PackageManager } from './helpers/get-pkg-manager';
import { TemplateType } from './helpers/install-template';
import { isFolderEmpty } from './helpers/is-folder-empty';

const packageJson = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), 'utf-8'));
let projectPath = '';
// const projectName = 'xxx';

const program = new Commander.Command(packageJson.name);
program
Expand Down Expand Up @@ -57,6 +56,7 @@ async function runInitPrompts(): Promise<void> {
choices: [
{ name: 'nextjs', value: 'nextjs' },
{ name: 'create-react-app', value: 'cra' },
{ name: 'vite', value: 'vite' },
],
});

Expand Down
1 change: 1 addition & 0 deletions packages/create-gnfd-app/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import { TemplateType } from './helpers/install-template';
export const TEMPLATES_MAP: Record<TemplateType, string> = {
nextjs: getTemplateUrl('nextjs'),
cra: getTemplateUrl('cra'),
vite: getTemplateUrl('vite'),
};

0 comments on commit 6aaf062

Please sign in to comment.