quick-scaffolds-cli 1.0.0 → 1.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pramuditha Lakshan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,55 +1,60 @@
1
- # quick-scaffolds
1
+ # quick-scaffolds-cli
2
2
 
3
- A lightweight CLI tool for quickly scaffolding web projects with pre-configured templates.
3
+ A lightweight, interactive CLI tool for rapidly scaffolding new web projects with pre-configured starter templates.
4
4
 
5
5
  ## Overview
6
6
 
7
- `quick-scaffolds` is an npm package that provides an interactive command-line interface to generate new projects with starter templates. It's designed to help developers quickly bootstrap projects without manually creating directory structures and boilerplate files.
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.
8
8
 
9
- ## Installation
9
+ **v1.1.0** - Now with improved interactive selection and project type options!
10
10
 
11
- Install globally to use the `create-project` command anywhere:
11
+ ## Quick Start
12
12
 
13
- ```bash
14
- npm install -g quick-scaffolds
15
- ```
13
+ ### Global Installation
16
14
 
17
- Or use `npx` to run without installing:
15
+ Install globally to use the `ct-pro` command anywhere:
18
16
 
19
17
  ```bash
20
- npx quick-scaffolds
18
+ npm install -g quick-scaffolds-cli
21
19
  ```
22
20
 
23
- ## Usage
21
+ Then create a new project:
24
22
 
25
- ### Create a New Project
23
+ ```bash
24
+ ct-pro
25
+ ```
26
26
 
27
- Run the following command in your terminal:
27
+ ### Using npx (No Installation Required)
28
28
 
29
29
  ```bash
30
- create-project
30
+ npx quick-scaffolds-cli
31
31
  ```
32
32
 
33
- The interactive prompt will guide you through the setup:
34
-
35
- 1. **Project Name**: Enter the name of your project (default: `my-new-project`)
36
- 2. **Project Type**: Select the type of project to scaffold (currently: `Static HTML/CSS/JS`)
33
+ ## Usage
37
34
 
38
- The CLI will create a new directory with your project name and populate it with the selected template files.
35
+ ### Creating a New Project
39
36
 
40
- ### Example
37
+ Run the command and follow the interactive prompts:
41
38
 
42
39
  ```bash
43
- $ create-project
44
- ? What is your project name? my-awesome-website
45
- ? What do you want to build? Static HTML/CSS/JS
46
- Successfully scaffolded - my-awesome-website
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
47
44
  ```
48
45
 
49
- This creates a `my-awesome-website` directory with the following structure:
46
+ You'll be guided through:
47
+
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
51
+
52
+ ### Generated Project Structure
53
+
54
+ The scaffolded project will include:
50
55
 
51
56
  ```
52
- my-awesome-website/
57
+ my-awesome-app/
53
58
  ├── index.html
54
59
  ├── css/
55
60
  │ └── style.css
@@ -59,31 +64,43 @@ my-awesome-website/
59
64
 
60
65
  ## Features
61
66
 
62
- - 🚀 **Interactive CLI**: User-friendly command-line prompts using [inquirer.js](https://github.com/SBoudrias/Inquirer.js)
63
- - 📁 **Template Management**: Pre-built project templates ready to use
64
- - 🛠️ **Easy Setup**: Bootstrap new projects in seconds
65
- - 📦 **Lightweight**: Minimal dependencies for fast installation
66
- - 🎯 **Extensible**: Easy to add new project templates
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
73
+
74
+ ## Available Templates
75
+
76
+ - **Static HTML/CSS/JS** - Simple static website starter with basic HTML, CSS, and JavaScript boilerplate
67
77
 
68
78
  ## Project Structure
69
79
 
70
80
  ```
71
- quick-scaffolds/
81
+ quick-scaffolds-cli/
72
82
  ├── bin/
73
- │ └── cli.js # CLI entry point
74
- ├── templates/ # Project templates
75
- ├── index.html
76
- ├── css/
77
- │ └── style.css
78
- │ └── js/
79
- │ └── app.js
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
80
91
  ├── package.json
81
92
  └── README.md
82
93
  ```
83
94
 
84
95
  ## Dependencies
85
96
 
86
- - `inquirer` (v13.3.2) - Interactive command-line prompts
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
87
104
 
88
105
  ## License
89
106
 
@@ -91,4 +108,4 @@ MIT
91
108
 
92
109
  ## Contributing
93
110
 
94
- Contributions are welcome! Feel free to fork, create a feature branch, and submit a pull request.
111
+ Contributions are welcome! Please feel free to submit pull requests or open issues to suggest improvements.
package/bin/cli.js CHANGED
@@ -1,41 +1,93 @@
1
1
  #!/usr/bin/env node
2
-
2
+ 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 inquirer from 'inquirer';
6
+ import { input, select } 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
- const answers = await inquirer.prompt([
13
- {
14
- type: 'input',
15
- name: 'projectName',
16
- message: 'What is your project name?',
17
- default: 'my-new-project'
18
- },
19
- {
20
- type: 'list',
21
- name: 'projectType',
12
+ try {
13
+ const name = await input(
14
+ {
15
+ name: 'projectName',
16
+ message: 'What is your project name?',
17
+ type: 'input',
18
+ default: 'my-new-project'
19
+ }
20
+ );
21
+ const projectType = await select({
22
22
  message: 'What do you want to build?',
23
- default: 'Static HTML/CSS/JS Page',
24
- choices: ['Static HTML/CSS/JS'
23
+ type: "list",
24
+ choices: [
25
+ { name: 'Static HTML/CSS/JS', value: 'static' },
26
+ { name: 'React starter', value: 'react' }
25
27
  ],
26
- },
27
- ]);
28
+ });
29
+ let templateFolder = '';
30
+ if (projectType === 'static') {
31
+ templateFolder = 'html-template';
32
+ }
28
33
 
29
- const projectName = answers.projectName;
30
- const targetPath = path.join(process.cwd(), projectName);
31
- const templatePath = path.join(__dirname, '../templates');
34
+ if (projectType === 'react') {
35
+ templateFolder = 'react-template';
36
+ await reactApp(name, templateFolder);
37
+ return;
38
+ }
32
39
 
33
- try {
40
+ const projectName = name;
41
+ const targetPath = path.join(process.cwd(), projectName);
42
+
43
+ const templatePath = path.join(__dirname, '../templates', templateFolder);
34
44
  await fs.mkdir(targetPath, { recursive: true });
35
45
  await fs.cp(templatePath, targetPath, { recursive: true });
36
- console.log('Successfully scaffolded the project')
46
+ console.log(`Successfully scaffolded the HTMl project - ${projectName}`)
47
+
48
+ } catch (err) {
49
+ console.error(`Error - ${err.message}`)
50
+ }
51
+ }
52
+
53
+ async function reactApp(projectName, templateFolder) {
54
+ try {
55
+ const targetPath = path.join(process.cwd(), projectName);
56
+ const templatePath = path.join(__dirname, '../templates', templateFolder);
57
+ await fs.mkdir(targetPath, { recursive: true });
58
+ await fs.cp(templatePath, targetPath, { recursive: true })
59
+
60
+ const filesToUpdate = [
61
+ path.join(targetPath, 'package.json'),
62
+ path.join(targetPath, 'public','index.html')
63
+ ];
64
+ for (const filePath of filesToUpdate) {
65
+ try {
66
+ const content = await fs.readFile(filePath, 'utf-8');
67
+ const updateContent = content.replaceAll('{{PROJECT_NAME}}', projectName);
68
+ await fs.writeFile(filePath, updateContent);
69
+ } catch (err) {
70
+ console.error(err);
71
+ console.error(`File path ${path.basename(filePath)} not found`);
72
+ }
73
+ }
74
+
75
+ console.log(`Successfully scaffolded the React starter project - ${projectName}`)
76
+ console.log('📦 Installing dependencies... This may take a minute.');
77
+ try {
78
+ execSync('npm install', {
79
+ cwd: targetPath,
80
+ stdio: 'inherit'
81
+ });
82
+ console.log('✅ Dependencies installed successfully!');
83
+ } catch (err){
84
+ console.error(err);
85
+ console.log('⚠️ Could not install dependencies automatically.');
86
+ console.log('Please run "npm install" manually inside your project folder.');
87
+ }
88
+
37
89
  } catch (err) {
38
- console.error('Error - ${err.message}')
90
+ console.error(`Error - ${err.message}`);
39
91
  }
40
92
  }
41
93
 
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "quick-scaffolds-cli",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ct-pro": "bin/cli.js"
7
7
  },
8
+ "license": "MIT",
8
9
  "files": [
9
10
  "bin",
10
11
  "templates"
11
12
  ],
12
13
  "dependencies": {
13
- "inquirer": "^13.3.2"
14
+ "@inquirer/prompts": "^8.3.2"
14
15
  }
15
16
  }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "react": "^19.0.0",
13
+ "react-dom": "^19.0.0"
14
+ },
15
+ "devDependencies": {
16
+ "@vitejs/plugin-react": "^4.3.4",
17
+ "vite": "^6.0.0"
18
+ }
19
+ }
File without changes
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{PROJECT_NAME}}</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+
11
+ <script type="module" src="/src/main.jsx"></script>
12
+ </body>
13
+ </html>
File without changes
@@ -0,0 +1,12 @@
1
+ import './App.css';
2
+
3
+ function App(){
4
+ return(
5
+ <div className="container">
6
+ <h1>Welcome to your React App!</h1>
7
+ <p>Start building something amazing.</p>
8
+ </div>
9
+ )
10
+ }
11
+
12
+ export default App
File without changes
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import ReactDOM from 'react-dom/client';
3
+ import App from './App.jsx';
4
+
5
+ ReactDOM.createRoot(document.getElementById('root')).render(
6
+ <React.StrictMode>
7
+ <App />
8
+ </React.StrictMode>
9
+ )
File without changes
File without changes