quick-scaffolds-cli 1.2.0 → 1.2.2

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/README.md CHANGED
@@ -1,59 +1,68 @@
1
1
  # quick-scaffolds-cli
2
2
 
3
- A lightweight, interactive CLI tool for rapidly scaffolding new web projects with pre-configured starter templates.
3
+ A lightweight interactive CLI for scaffolding starter web projects quickly.
4
4
 
5
5
  ## Overview
6
6
 
7
- **quick-scaffolds-cli** is an npm package that provides an interactive command-line interface to generate new projects from customizable templates. Get started with a fully structured project in seconds with an intuitive selection menu.
7
+ quick-scaffolds-cli generates a ready-to-use project from templates with a simple prompt flow.
8
8
 
9
- **v1.1.0** - Now with improved interactive selection and project type options!
9
+ Current release: v1.2.2
10
10
 
11
11
  ## Quick Start
12
12
 
13
- ### Global Installation
13
+ ### Global install
14
14
 
15
- Install globally to use the `ct-pro` command anywhere:
15
+ Install once and use the command anywhere:
16
16
 
17
17
  ```bash
18
18
  npm install -g quick-scaffolds-cli
19
+ ct-pro my-awesome-app
19
20
  ```
20
21
 
21
- Then create a new project:
22
+ ### Use with npx
23
+
24
+ Run without installing globally:
22
25
 
23
26
  ```bash
24
- ct-pro
27
+ npx quick-scaffolds-cli my-awesome-app
25
28
  ```
26
29
 
27
- ### Using npx (No Installation Required)
30
+ ## Usage
31
+
32
+ Run the CLI with an initial project name, then choose whether to keep it or change it:
28
33
 
29
34
  ```bash
30
- npx quick-scaffolds-cli
35
+ ct-pro my-awesome-app
36
+ ? Your project name will be named "my-awesome-app". Do you want to keep it? (Y/n)
37
+ ? What do you want to build?
38
+ Static HTML/CSS/JS
39
+ React starter
31
40
  ```
32
41
 
33
- ## Usage
42
+ Prompt details:
34
43
 
35
- ### Creating a New Project
44
+ 1. Confirm project name:
45
+ - Keep the provided name
46
+ - Change it by entering a new project name (default: `my-new-project`)
47
+ 2. Project type:
48
+ - Static HTML/CSS/JS
49
+ - React starter
36
50
 
37
- Run the command and follow the interactive prompts:
51
+ If you choose not to keep the provided name, the CLI asks:
38
52
 
39
53
  ```bash
40
- ct-pro
41
- ? What is your project name? my-awesome-app
42
- ? What do you want to build? (Use arrow keys)
43
- ❯ Static HTML/CSS/JS
54
+ ? What is your project name? my-updated-app
44
55
  ```
45
56
 
46
- You'll be guided through:
57
+ ## Templates
47
58
 
48
- 1. **Project Name**: Enter your desired project name (default: `my-new-project`)
49
- 2. **Project Type**: Use arrow keys to select a template type:
50
- - **Static HTML/CSS/JS** - A simple, lightweight static site starter with HTML, CSS, and JavaScript
59
+ ### 1. Static HTML/CSS/JS
51
60
 
52
- ### Generated Project Structure
61
+ Creates a simple static site starter.
53
62
 
54
- The scaffolded project will include:
63
+ Generated structure:
55
64
 
56
- ```
65
+ ```text
57
66
  my-awesome-app/
58
67
  ├── index.html
59
68
  ├── css/
@@ -62,45 +71,74 @@ my-awesome-app/
62
71
  └── app.js
63
72
  ```
64
73
 
65
- ## Features
74
+ ### 2. React starter (Vite)
66
75
 
67
- - 🚀 **Interactive CLI** - Modern, intuitive prompts powered by [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js)
68
- - ⬆️⬇️ **Arrow Key Navigation** - Easy project type selection with arrow keys
69
- - 📁 **Template-Based** - Pre-built, production-ready project templates
70
- - ⚡ **Instant Setup** - Scaffold complete projects in seconds
71
- - 📦 **Lightweight** - Minimal dependencies and fast installation
72
- - 🧩 **Extensible** - Easy to add custom project templates
76
+ Creates a React starter app with Vite and automatically runs npm install.
73
77
 
74
- ## Available Templates
78
+ Generated structure:
75
79
 
76
- - **Static HTML/CSS/JS** - Simple static website starter with basic HTML, CSS, and JavaScript boilerplate
80
+ ```text
81
+ my-awesome-app/
82
+ ├── .gitignore
83
+ ├── index.css
84
+ ├── index.html
85
+ ├── package.json
86
+ └── src/
87
+ ├── App.css
88
+ ├── App.jsx
89
+ ├── index.css
90
+ └── main.jsx
91
+ ```
77
92
 
78
- ## Project Structure
93
+ After scaffolding a React project:
79
94
 
95
+ ```bash
96
+ cd my-awesome-app
97
+ npm run dev
80
98
  ```
99
+
100
+ ## Features
101
+
102
+ - Interactive CLI powered by @inquirer/prompts
103
+ - Fast project scaffolding from local templates
104
+ - Two starter options: static web or React + Vite
105
+ - Automatic dependency installation for React template
106
+ - Simple command interface via ct-pro
107
+
108
+ ## Project Structure
109
+
110
+ ```text
81
111
  quick-scaffolds-cli/
112
+ ├── .gitignore
113
+ ├── .npmignore
82
114
  ├── bin/
83
- │ └── cli.js # CLI entry point
84
- ├── templates/ # Starter templates
85
- │ └── html-template/ # Static HTML/CSS/JS template
86
- │ ├── index.html
87
- │ ├── css/
88
- │ │ └── style.css
89
- │ └── js/
90
- │ └── app.js
115
+ │ └── cli.js
116
+ ├── package-lock.json
91
117
  ├── package.json
92
- └── README.md
118
+ ├── README.md
119
+ ├── templates/
120
+ │ ├── html-template/
121
+ │ │ ├── index.html
122
+ │ │ ├── css/
123
+ │ │ │ └── style.css
124
+ │ │ └── js/
125
+ │ │ └── app.js
126
+ │ └── react-template/
127
+ │ ├── .gitignore
128
+ │ ├── index.css
129
+ │ ├── index.html
130
+ │ ├── package.json
131
+ │ └── src/
132
+ │ ├── App.css
133
+ │ ├── App.jsx
134
+ │ ├── index.css
135
+ │ └── main.jsx
136
+ └── LICENSE
93
137
  ```
94
138
 
95
139
  ## Dependencies
96
140
 
97
- - **@inquirer/prompts** (^8.3.2) - Modern, interactive prompt library
98
- - **inquirer** (^13.3.2) - Command-line interface utilities
99
-
100
- ## Version History
101
-
102
- - **v1.1.0** - Improved interactive selection with arrow key navigation, organized template structure
103
- - **v1.0.0** - Initial release with basic scaffolding functionality
141
+ - @inquirer/prompts ^8.3.2
104
142
 
105
143
  ## License
106
144
 
@@ -108,4 +146,4 @@ MIT
108
146
 
109
147
  ## Contributing
110
148
 
111
- Contributions are welcome! Please feel free to submit pull requests or open issues to suggest improvements.
149
+ Issues and pull requests are welcome on GitHub.
package/bin/cli.js CHANGED
@@ -3,14 +3,21 @@ import { execSync } from 'node:child_process';
3
3
  import fs from 'node:fs/promises';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
- import { input, select } from '@inquirer/prompts';
6
+ import { input, select, confirm } from '@inquirer/prompts';
7
7
 
8
8
  const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = path.dirname(__filename);
10
10
 
11
11
  async function main() {
12
- try {
13
- const name = await input(
12
+ let name = process.argv[2];
13
+
14
+ const keepName = await confirm({
15
+ message: `Your project name will be named "${name}". Do you want to keep it ?`,
16
+ default: true
17
+ });
18
+
19
+ if (!keepName) {
20
+ name = await input(
14
21
  {
15
22
  name: 'projectName',
16
23
  message: 'What is your project name?',
@@ -18,32 +25,34 @@ async function main() {
18
25
  default: 'my-new-project'
19
26
  }
20
27
  );
21
- const projectType = await select({
22
- message: 'What do you want to build?',
23
- type: "list",
24
- choices: [
25
- { name: 'Static HTML/CSS/JS', value: 'static' },
26
- { name: 'React starter', value: 'react' }
27
- ],
28
- });
29
- let templateFolder = '';
30
- if (projectType === 'static') {
31
- templateFolder = 'html-template';
32
- }
28
+ }
33
29
 
34
- if (projectType === 'react') {
35
- templateFolder = 'react-template';
36
- await reactApp(name, templateFolder);
37
- return;
38
- }
30
+ const projectType = await select({
31
+ message: 'What do you want to build?',
32
+ type: "list",
33
+ choices: [
34
+ { name: 'Static HTML/CSS/JS', value: 'static' },
35
+ { name: 'React starter', value: 'react' }
36
+ ],
37
+ });
38
+ let templateFolder = '';
39
+ if (projectType === 'static') {
40
+ templateFolder = 'html-template';
41
+ }
39
42
 
43
+ if (projectType === 'react') {
44
+ templateFolder = 'react-template';
45
+ await reactApp(name, templateFolder);
46
+ return;
47
+ }
48
+ try {
40
49
  const projectName = name;
41
50
  const targetPath = path.join(process.cwd(), projectName);
42
51
 
43
52
  const templatePath = path.join(__dirname, '../templates', templateFolder);
44
53
  await fs.mkdir(targetPath, { recursive: true });
45
54
  await fs.cp(templatePath, targetPath, { recursive: true });
46
- console.log(`Successfully scaffolded the HTMl project - ${projectName}`)
55
+ console.log(`\nSuccessfully scaffolded the HTMl project - ${projectName}\n`)
47
56
 
48
57
  } catch (err) {
49
58
  console.error(`Error - ${err.message}`)
@@ -59,7 +68,7 @@ async function reactApp(projectName, templateFolder) {
59
68
 
60
69
  const filesToUpdate = [
61
70
  path.join(targetPath, 'package.json'),
62
- path.join(targetPath, 'public','index.html')
71
+ path.join(targetPath, 'index.html')
63
72
  ];
64
73
  for (const filePath of filesToUpdate) {
65
74
  try {
@@ -72,17 +81,17 @@ async function reactApp(projectName, templateFolder) {
72
81
  }
73
82
  }
74
83
 
75
- console.log(`Successfully scaffolded the React starter project - ${projectName}`)
76
- console.log('📦 Installing dependencies... This may take a minute.');
84
+ console.log(`Successfully scaffolded the React starter project - ${projectName}\n`)
85
+ console.log('📦 Installing dependencies... This may take a minute.\n');
77
86
  try {
78
87
  execSync('npm install', {
79
88
  cwd: targetPath,
80
89
  stdio: 'inherit'
81
90
  });
82
- console.log('✅ Dependencies installed successfully!');
83
- } catch (err){
91
+ console.log('✅ Dependencies installed successfully!\n');
92
+ } catch (err) {
84
93
  console.error(err);
85
- console.log('⚠️ Could not install dependencies automatically.');
94
+ console.log('⚠️ Could not install dependencies automatically.\n');
86
95
  console.log('Please run "npm install" manually inside your project folder.');
87
96
  }
88
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quick-scaffolds-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ct-pro": "bin/cli.js"