@nishant0121/set-it-up 0.0.7 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESCRIPTION.md +64 -0
- package/README.md +75 -75
- package/bin/index.js +22 -22
- package/package.json +2 -1
- package/src/engines/express.js +86 -0
- package/src/engines/react.js +279 -210
- package/src/engines/reactNative.js +77 -77
- package/src/templates/express/configuration.js +63 -0
- package/src/templates/express/controllers.js +9 -0
- package/src/templates/express/entry.js +42 -0
- package/src/templates/express/main.js +4 -0
- package/src/templates/express/routes.js +11 -0
- package/src/templates/react/main.js +2 -2
- package/src/wizard.js +136 -123
package/DESCRIPTION.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @nishant0121/set-it-up: The Ultimate Project Scaffolding CLI
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
**Set It Up** is a powerful, developer-centric CLI tool engineered to eliminate the repetitive boilerplate work associated with starting new React and React Native projects. It bridges the gap between "Hello World" and a production-ready architecture.
|
|
6
|
+
|
|
7
|
+
Unlike standard create scripts that give you a bare-bones entry point, `set-it-up` (via its command `forge`) constructs a robust, scalable foundation tailored to your preferences (TypeScript/JavaScript, Styling, Routing, etc.).
|
|
8
|
+
|
|
9
|
+
## Why Use This?
|
|
10
|
+
|
|
11
|
+
Starting a modern frontend project often involves 30-60 minutes of configuration:
|
|
12
|
+
- Setting up tailwind.
|
|
13
|
+
- configuring the router.
|
|
14
|
+
- creating folder structures (`pages`, `components`, `context`).
|
|
15
|
+
- installing navigation libraries for mobile.
|
|
16
|
+
- handling safe area contexts.
|
|
17
|
+
|
|
18
|
+
**Set It Up** does this in seconds.
|
|
19
|
+
|
|
20
|
+
## Key Capabilities
|
|
21
|
+
|
|
22
|
+
### 1. Interactive "Forge" Wizard
|
|
23
|
+
The `forge` command launches an intuitive,inquirer-based terminal wizard that asks you exactly what you need. No complex flags to remember—just answer the questions, and the CLI handles the rest.
|
|
24
|
+
|
|
25
|
+
### 2. React (Web) Excellence
|
|
26
|
+
- **Vite-Powered:** Uses the fastest build tool in the ecosystem.
|
|
27
|
+
- **Tailwind CSS v4:** Automatically configured with the latest version using the Vite plugin.
|
|
28
|
+
- **Shadcn UI Integration:** The only CLI that can set up Shadcn UI and automatically transpile its TypeScript components to JavaScript if you prefer a JS-only project.
|
|
29
|
+
- **Auto-configured Path Aliases:** Pre-sets `@/` aliases in Vite and TS/JS configs for cleaner imports.
|
|
30
|
+
- **Structure:** Automatically creates `src/pages`, `src/components`, and `src/layouts`.
|
|
31
|
+
- **Router Ready:** Installs `react-router-dom` and sets up a default routing configuration with a Layout and Navbar.
|
|
32
|
+
- **State & Theme:** Optional `AppContext` boilerplating for global state and dark-mode ready theme management.
|
|
33
|
+
|
|
34
|
+
### 3. React Native (Mobile) Mastery
|
|
35
|
+
- **Modular Architecture:** Moves away from the monolithic `App.tsx` pattern. It generates a clean separation of concerns:
|
|
36
|
+
- `src/pages/` (Screens)
|
|
37
|
+
- `src/components/` (Reusable UI)
|
|
38
|
+
- **Navigation Pre-baked:** Installs and configures React Navigation (Native Stack).
|
|
39
|
+
- **Auto-configured Path Aliases:** Ready-to-use path resolution for cleaner codebase management.
|
|
40
|
+
- **Safe Area Handling:** Implements `react-native-safe-area-context` with `SafeAreaProvider` wrapping the app and `SafeAreaView` in screens.
|
|
41
|
+
- **Polished Templates:** The generated starter screens (`HomeScreen`, `DetailsScreen`) are not blank white pages. They feature modern design, cards, shadows, and proper typography, giving you a beautiful starting point.
|
|
42
|
+
|
|
43
|
+
### 4. Smart & Safe
|
|
44
|
+
- **Prerequisite Checking:** Scans your environment for Node.js, Git, and other tools before starting to prevent mid-install failures.
|
|
45
|
+
- **Package Manager Agnostic:** Works seamlessly with `npm`, `yarn`, and `pnpm`.
|
|
46
|
+
- **Lightning Fast Conversion:** Uses `esbuild` for instant TypeScript to JavaScript transpilation when bridging Shadcn UI into JS projects.
|
|
47
|
+
|
|
48
|
+
## Technology Stack
|
|
49
|
+
|
|
50
|
+
- **CLI Engine:** Node.js, Commander, Inquirer, Ora (spinners), Chalk (styling), Boxen, Gradient-String.
|
|
51
|
+
- **Automation:** Execa (process execution), FS-Extra (file system), Esbuild (fast transpilation).
|
|
52
|
+
- **Templates:** React (Vite), React Native (CLI), Tailwind CSS v4, React Navigation, React Router DOM.
|
|
53
|
+
|
|
54
|
+
## Roadmap (Coming Soon)
|
|
55
|
+
- **Next.js Support:** Full App Router scaffolding with advanced features.
|
|
56
|
+
- **Custom GitHub Templates:** Forge projects from your own private or public repositories.
|
|
57
|
+
- **Backend Forging:** Express.js and FastAPI starter templates.
|
|
58
|
+
|
|
59
|
+
## Get Started
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g @nishant0121/set-it-up
|
|
63
|
+
forge
|
|
64
|
+
```
|
package/README.md
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
# set-it-up
|
|
2
|
-
|
|
3
|
-
set-it-up is a high-performance CLI tool designed to bootstrap and forge new projects with pre-configured templates, prerequisite checking, and interactive setup.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Interactive Wizard: Professional terminal interface to guide you through project configuration.
|
|
8
|
-
- Prerequisite Checks: Automatically verifies necessary tools (Node.js, Git, etc.) are installed before starting.
|
|
9
|
-
- React Support (Vite):
|
|
10
|
-
- Fast project scaffolding using Vite.
|
|
11
|
-
- Automated Tailwind CSS v4 setup.
|
|
12
|
-
- Standardized project structure (src/pages, src/components).
|
|
13
|
-
- Integrated Layout and Navbar with React Router DOM support.
|
|
14
|
-
- Optional Shadcn UI initialization and component addition.
|
|
15
|
-
- Global AppContext setup for state management.
|
|
16
|
-
- Automatic TypeScript to JavaScript conversion for Shadcn UI if JS is selected.
|
|
17
|
-
- React Native Support:
|
|
18
|
-
- Rapid initialization with @react-native-community/cli.
|
|
19
|
-
- Full support for both TypeScript and JavaScript.
|
|
20
|
-
- Automated React Navigation integration with boilerplate code.
|
|
21
|
-
- Smart Defaults: Supports npm, yarn, and pnpm based on user preference.
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
To use set-it-up globally on your system:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install -g @nishant0121/set-it-up
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Using npx:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx @nishant0121/set-it-up
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
Run the tool in your terminal:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
forge
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Follow the prompts to:
|
|
46
|
-
|
|
47
|
-
1. Select your project type (React or React Native).
|
|
48
|
-
2. Provide a project name.
|
|
49
|
-
3. Choose your preferred package manager.
|
|
50
|
-
4. Select language (TypeScript or JavaScript).
|
|
51
|
-
5. Configure additional features (Shadcn UI, Router, Context, Navigation).
|
|
52
|
-
|
|
53
|
-
### Example Workflow
|
|
54
|
-
|
|
55
|
-
```text
|
|
56
|
-
SET-IT-UP
|
|
57
|
-
|
|
58
|
-
Hi there! Let's configure your new project.
|
|
59
|
-
|
|
60
|
-
? What do you want to build today? React
|
|
61
|
-
? Enter your project name: my-web-app
|
|
62
|
-
? Select your preferred package manager: npm
|
|
63
|
-
? Which language do you want to use? TypeScript
|
|
64
|
-
? Would you like to setup Shadcn UI? Yes
|
|
65
|
-
? Would you like to add React Router DOM? Yes
|
|
66
|
-
? Would you like to setup a global AppContext? Yes
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Contributing
|
|
70
|
-
|
|
71
|
-
Contributions are welcome. Please open an issue or submit a pull request for improvements.
|
|
72
|
-
|
|
73
|
-
## License
|
|
74
|
-
|
|
75
|
-
ISC
|
|
1
|
+
# set-it-up
|
|
2
|
+
|
|
3
|
+
set-it-up is a high-performance CLI tool designed to bootstrap and forge new projects with pre-configured templates, prerequisite checking, and interactive setup.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Interactive Wizard: Professional terminal interface to guide you through project configuration.
|
|
8
|
+
- Prerequisite Checks: Automatically verifies necessary tools (Node.js, Git, etc.) are installed before starting.
|
|
9
|
+
- React Support (Vite):
|
|
10
|
+
- Fast project scaffolding using Vite.
|
|
11
|
+
- Automated Tailwind CSS v4 setup.
|
|
12
|
+
- Standardized project structure (src/pages, src/components).
|
|
13
|
+
- Integrated Layout and Navbar with React Router DOM support.
|
|
14
|
+
- Optional Shadcn UI initialization and component addition.
|
|
15
|
+
- Global AppContext setup for state management.
|
|
16
|
+
- Automatic TypeScript to JavaScript conversion for Shadcn UI if JS is selected.
|
|
17
|
+
- React Native Support:
|
|
18
|
+
- Rapid initialization with @react-native-community/cli.
|
|
19
|
+
- Full support for both TypeScript and JavaScript.
|
|
20
|
+
- Automated React Navigation integration with boilerplate code.
|
|
21
|
+
- Smart Defaults: Supports npm, yarn, and pnpm based on user preference.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
To use set-it-up globally on your system:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @nishant0121/set-it-up
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Using npx:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @nishant0121/set-it-up
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Run the tool in your terminal:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
forge
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Follow the prompts to:
|
|
46
|
+
|
|
47
|
+
1. Select your project type (React or React Native).
|
|
48
|
+
2. Provide a project name.
|
|
49
|
+
3. Choose your preferred package manager.
|
|
50
|
+
4. Select language (TypeScript or JavaScript).
|
|
51
|
+
5. Configure additional features (Shadcn UI, Router, Context, Navigation).
|
|
52
|
+
|
|
53
|
+
### Example Workflow
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
SET-IT-UP
|
|
57
|
+
|
|
58
|
+
Hi there! Let's configure your new project.
|
|
59
|
+
|
|
60
|
+
? What do you want to build today? React
|
|
61
|
+
? Enter your project name: my-web-app
|
|
62
|
+
? Select your preferred package manager: npm
|
|
63
|
+
? Which language do you want to use? TypeScript
|
|
64
|
+
? Would you like to setup Shadcn UI? Yes
|
|
65
|
+
? Would you like to add React Router DOM? Yes
|
|
66
|
+
? Would you like to setup a global AppContext? Yes
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Contributing
|
|
70
|
+
|
|
71
|
+
Contributions are welcome. Please open an issue or submit a pull request for improvements.
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
ISC
|
package/bin/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { program } from 'commander';
|
|
4
|
-
import { mainWizard } from '../src/wizard.js';
|
|
5
|
-
|
|
6
|
-
program
|
|
7
|
-
.version('1.0.0')
|
|
8
|
-
.description('A powerful CLI to forge new projects')
|
|
9
|
-
.action(async () => {
|
|
10
|
-
try {
|
|
11
|
-
await mainWizard();
|
|
12
|
-
} catch (error) {
|
|
13
|
-
if (error.name === 'ExitPromptError' || error.message.includes('User force closed the prompt')) {
|
|
14
|
-
console.log('\n👋 Goodbye!');
|
|
15
|
-
process.exit(0);
|
|
16
|
-
} else {
|
|
17
|
-
console.error(error);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
program.parse(process.argv);
|
|
2
|
+
|
|
3
|
+
import { program } from 'commander';
|
|
4
|
+
import { mainWizard } from '../src/wizard.js';
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.version('1.0.0')
|
|
8
|
+
.description('A powerful CLI to forge new projects')
|
|
9
|
+
.action(async () => {
|
|
10
|
+
try {
|
|
11
|
+
await mainWizard();
|
|
12
|
+
} catch (error) {
|
|
13
|
+
if (error.name === 'ExitPromptError' || error.message.includes('User force closed the prompt')) {
|
|
14
|
+
console.log('\n👋 Goodbye!');
|
|
15
|
+
process.exit(0);
|
|
16
|
+
} else {
|
|
17
|
+
console.error(error);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nishant0121/set-it-up",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "A high-performance CLI tool to bootstrap and forge new projects with pre-configured templates, prerequisite checking, and interactive setup.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Nishant Patil",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"chalk": "^5.6.2",
|
|
18
18
|
"command-exists": "^1.2.9",
|
|
19
19
|
"commander": "^14.0.2",
|
|
20
|
+
"esbuild": "^0.27.2",
|
|
20
21
|
"execa": "^9.6.1",
|
|
21
22
|
"fs-extra": "^11.3.3",
|
|
22
23
|
"gradient-string": "^3.0.0",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
getPackageJson,
|
|
9
|
+
getTsConfig,
|
|
10
|
+
getIndex,
|
|
11
|
+
getRouteIndex,
|
|
12
|
+
getController
|
|
13
|
+
} from '../templates/express/main.js';
|
|
14
|
+
|
|
15
|
+
export async function setupExpress(answers, expressAnswers) {
|
|
16
|
+
const spinner = ora('Initializing Express project...').start();
|
|
17
|
+
try {
|
|
18
|
+
const { projectName, packageManager } = answers;
|
|
19
|
+
const isTypescript = expressAnswers.language === 'TypeScript';
|
|
20
|
+
const projectPath = path.join(process.cwd(), projectName);
|
|
21
|
+
|
|
22
|
+
// 1. Create Project Directory
|
|
23
|
+
await fs.ensureDir(projectPath);
|
|
24
|
+
|
|
25
|
+
// 2. Create package.json
|
|
26
|
+
spinner.text = 'Creating package.json...';
|
|
27
|
+
const packageJsonContent = getPackageJson(projectName, isTypescript);
|
|
28
|
+
await fs.writeFile(path.join(projectPath, 'package.json'), packageJsonContent);
|
|
29
|
+
|
|
30
|
+
// 3. Create tsconfig.json (if TypeScript)
|
|
31
|
+
if (isTypescript) {
|
|
32
|
+
spinner.text = 'Creating tsconfig.json...';
|
|
33
|
+
const tsConfigContent = getTsConfig();
|
|
34
|
+
await fs.writeFile(path.join(projectPath, 'tsconfig.json'), tsConfigContent);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 4. Create Source Directories and Files
|
|
38
|
+
spinner.text = 'Generating project structure...';
|
|
39
|
+
const srcDir = path.join(projectPath, 'src');
|
|
40
|
+
const routesDir = path.join(srcDir, 'routes');
|
|
41
|
+
const controllersDir = path.join(srcDir, 'controllers');
|
|
42
|
+
|
|
43
|
+
await fs.ensureDir(srcDir);
|
|
44
|
+
await fs.ensureDir(routesDir);
|
|
45
|
+
await fs.ensureDir(controllersDir);
|
|
46
|
+
|
|
47
|
+
const ext = isTypescript ? 'ts' : 'js';
|
|
48
|
+
|
|
49
|
+
// src/index.ts or src/index.js
|
|
50
|
+
await fs.writeFile(path.join(srcDir, `index.${ext}`), getIndex(isTypescript));
|
|
51
|
+
|
|
52
|
+
// src/routes/index.ts or src/routes/index.js
|
|
53
|
+
await fs.writeFile(path.join(routesDir, `index.${ext}`), getRouteIndex(isTypescript));
|
|
54
|
+
|
|
55
|
+
// src/controllers/exampleController.ts or src/controllers/exampleController.js
|
|
56
|
+
await fs.writeFile(path.join(controllersDir, `exampleController.${ext}`), getController(isTypescript));
|
|
57
|
+
|
|
58
|
+
// Create .env file
|
|
59
|
+
await fs.writeFile(path.join(projectPath, '.env'), 'PORT=3000\n');
|
|
60
|
+
|
|
61
|
+
// Create .gitignore
|
|
62
|
+
const gitignoreContent = `node_modules
|
|
63
|
+
.env
|
|
64
|
+
dist
|
|
65
|
+
.DS_Store
|
|
66
|
+
coverage
|
|
67
|
+
`;
|
|
68
|
+
await fs.writeFile(path.join(projectPath, '.gitignore'), gitignoreContent);
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// 5. Install Dependencies
|
|
72
|
+
spinner.text = 'Installing dependencies...';
|
|
73
|
+
const installCmd = packageManager === 'npm' ? 'install' : 'add';
|
|
74
|
+
await execa(packageManager, [installCmd], { cwd: projectPath });
|
|
75
|
+
|
|
76
|
+
spinner.succeed(chalk.green(`Express project ${projectName} created successfully! 🚀`));
|
|
77
|
+
console.log(chalk.cyan(`
|
|
78
|
+
To get started:
|
|
79
|
+
cd ${projectName}
|
|
80
|
+
${packageManager} run dev`));
|
|
81
|
+
|
|
82
|
+
} catch (error) {
|
|
83
|
+
spinner.fail('Setup failed.');
|
|
84
|
+
console.error(error);
|
|
85
|
+
}
|
|
86
|
+
}
|