quick-scaffolds-cli 1.1.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
@@ -78,7 +78,7 @@ my-awesome-app/
78
78
  ## Project Structure
79
79
 
80
80
  ```
81
- quick-scaffolds/
81
+ quick-scaffolds-cli/
82
82
  ├── bin/
83
83
  │ └── cli.js # CLI entry point
84
84
  ├── templates/ # Starter templates
package/bin/cli.js CHANGED
@@ -1,5 +1,5 @@
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';
@@ -23,7 +23,7 @@ async function main() {
23
23
  type: "list",
24
24
  choices: [
25
25
  { name: 'Static HTML/CSS/JS', value: 'static' },
26
-
26
+ { name: 'React starter', value: 'react' }
27
27
  ],
28
28
  });
29
29
  let templateFolder = '';
@@ -31,17 +31,64 @@ async function main() {
31
31
  templateFolder = 'html-template';
32
32
  }
33
33
 
34
+ if (projectType === 'react') {
35
+ templateFolder = 'react-template';
36
+ await reactApp(name, templateFolder);
37
+ return;
38
+ }
39
+
34
40
  const projectName = name;
35
41
  const targetPath = path.join(process.cwd(), projectName);
36
42
 
37
43
  const templatePath = path.join(__dirname, '../templates', templateFolder);
38
44
  await fs.mkdir(targetPath, { recursive: true });
39
45
  await fs.cp(templatePath, targetPath, { recursive: true });
40
- console.log(`Successfully scaffolded the project ${projectName}`)
46
+ console.log(`Successfully scaffolded the HTMl project - ${projectName}`)
41
47
 
42
48
  } catch (err) {
43
49
  console.error(`Error - ${err.message}`)
44
50
  }
45
51
  }
46
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
+
89
+ } catch (err) {
90
+ console.error(`Error - ${err.message}`);
91
+ }
92
+ }
93
+
47
94
  main();
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "quick-scaffolds-cli",
3
- "version": "1.1.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/prompts": "^8.3.2",
14
- "inquirer": "^13.3.2"
14
+ "@inquirer/prompts": "^8.3.2"
15
15
  }
16
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
+ )