Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add vite template #339

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'),
};