Skip to content

Commit 34e1fa5

Browse files
committed
feat: update the CLI to consider the new packages, also consider Bun as pkg manager
Signed-off-by: Rai Siqueira <rai93siqueira@gmail.com>
1 parent eaa8112 commit 34e1fa5

File tree

3 files changed

+8
-70
lines changed

3 files changed

+8
-70
lines changed

lib/__tests__/index.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@ describe('eruption-cli', () => {
3232
// Simulate the user pressing the down arrow key and then the enter key. (We're removing vscode folder)
3333
userEvent.keyboard(`${CLIUserEvents.ArrowDown}${CLIUserEvents.Enter}`);
3434

35-
const docker = await findByText(/Do you want to include Docker support?/i);
36-
expect(docker).toBeTruthy();
37-
// Simulate the user pressing the enter key. By default we aren't including docker support.
38-
userEvent.keyboard(`${CLIUserEvents.Enter}`);
39-
40-
const packageManager = await findByText(/Select your package manager/i);
41-
expect(packageManager).toBeTruthy();
42-
// Simulate the user pressing the down arrow key and then the enter key. (For now, we are selecting yarn)
43-
userEvent.keyboard(`${CLIUserEvents.ArrowDown}${CLIUserEvents.Enter}`);
44-
4535
// Simulate the user pressing the down arrow key and then the enter key. (For now, we are selecting the core kit)
4636
const confirm = await findByText(/Do you want to continue/i);
4737
expect(confirm).toBeTruthy();
@@ -79,11 +69,6 @@ describe('eruption-cli', () => {
7969
// Simulate the user pressing the down arrow key and then the enter key. (We're removing vscode folder)
8070
userEvent.keyboard(`${CLIUserEvents.ArrowDown}${CLIUserEvents.Enter}`);
8171

82-
const docker = await findByText(/Do you want to include Docker support?/i);
83-
expect(docker).toBeTruthy();
84-
// Simulate the user pressing the enter key. By default we aren't including docker support.
85-
userEvent.keyboard(`${CLIUserEvents.Enter}`);
86-
8772
const packageManager = await findByText(/Select your package manager/i);
8873
expect(packageManager).toBeTruthy();
8974
// Simulate the user pressing the down arrow key and then the enter key. (For now, we are selecting yarn)

lib/src/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export const AVAILABLE_KITS: Kit[] = [
99
value: 'core',
1010
hint: 'The core kit for Eruption',
1111
},
12+
{
13+
label: "React Full (React, Vite, Vitest, React Router, Mantine and more)",
14+
value: 'react-full',
15+
hint: 'An opinionated React setup with Vite, Vitest, React Router and more',
16+
}
1217
];
1318

1419
/**

lib/src/index.ts

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@ import path from 'path';
55
import parser from 'yargs-parser';
66

77
import { AVAILABLE_KITS, AVAILABLE_LIBRARIES } from './constants';
8-
import { PackageManagers } from './types';
98
import {
109
handleCancelation,
1110
getKitFromGitHub,
1211
initGitRepo as initializeGit,
1312
initNodeProject,
1413
removeFolder,
15-
removeFile,
1614
getPmInstallCommands,
1715
} from './utils';
1816

1917
export async function main() {
2018
const cleanArgv = process.argv.filter((arg) => arg !== '--');
2119
const args = parser(cleanArgv, {
22-
string: ['name', 'kit', 'pm'], // --pm is the package manager. E.g: --pm yarn
20+
string: ['name', 'kit'],
2321
boolean: ['git', 'yes', 'vscode'],
2422
default: {
2523
git: true,
@@ -88,42 +86,6 @@ export async function main() {
8886

8987
handleCancelation(useVscode);
9088

91-
let dockerSupport = false;
92-
if (flavor === 'application') {
93-
dockerSupport =
94-
'docker' in args
95-
? args.vscode
96-
: await confirm({
97-
message: 'Do you want to include Docker support?',
98-
initialValue: false,
99-
});
100-
}
101-
102-
// NPM will be the default package manager.
103-
const packageManager: PackageManagers = args.pm
104-
? args.pm
105-
: await select({
106-
message: 'Select your package manager',
107-
options: [
108-
{
109-
value: 'npm',
110-
label: 'NPM',
111-
hint: 'Default package manager',
112-
},
113-
{
114-
value: 'yarn',
115-
label: 'Yarn',
116-
},
117-
{
118-
value: 'pnpm',
119-
label: 'PNPM',
120-
},
121-
],
122-
});
123-
124-
// If the user cancel the package manager selection, we will use NPM as default.
125-
handleCancelation(packageManager);
126-
12789
const install =
12890
'yes' in args
12991
? args.yes
@@ -152,15 +114,6 @@ export async function main() {
152114
await removeFolder('.vscode', destPath);
153115
}
154116

155-
if (!dockerSupport) {
156-
const destPath = path.join(process.cwd(), projectName as string);
157-
await removeFile('.dockerignore', destPath);
158-
await removeFile('Dockerfile', destPath);
159-
await removeFile('dockerfile.dev', destPath);
160-
await removeFile('docker-compose-dev.yml', destPath);
161-
await removeFile('docker-compose.yml', destPath);
162-
}
163-
164117
if (initGitRepo) {
165118
const projectFolder = path.join(process.cwd(), projectName as string);
166119
try {
@@ -171,14 +124,9 @@ export async function main() {
171124
}
172125
}
173126

174-
if (packageManager !== 'npm') {
175-
const destPath = path.join(process.cwd(), projectName as string);
176-
await removeFile('package-lock.json', destPath);
177-
}
178-
179127
const nextSteps = `cd ${projectName as string} \n${
180-
install ? `${green(getPmInstallCommands(packageManager))} to install the dependencies\n` : ''
181-
}and ${green(`${packageManager} run dev`)} to start the development server`;
128+
install ? `${green(getPmInstallCommands("bun"))} to install the dependencies\n` : ''
129+
}and ${green(`bun dev`)} to start the development server`;
182130

183131
note(nextSteps, 'Next steps:');
184132

0 commit comments

Comments
 (0)