quick-scaffolds-cli 1.2.1 → 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 +28 -16
- package/bin/cli.js +36 -27
- package/package.json +1 -1
- /package/templates/react-template/{public/index.css → index.css} +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A lightweight interactive CLI for scaffolding starter web projects quickly.
|
|
|
6
6
|
|
|
7
7
|
quick-scaffolds-cli generates a ready-to-use project from templates with a simple prompt flow.
|
|
8
8
|
|
|
9
|
-
Current release: v1.2.
|
|
9
|
+
Current release: v1.2.2
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Install once and use the command anywhere:
|
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm install -g quick-scaffolds-cli
|
|
19
|
-
ct-pro
|
|
19
|
+
ct-pro my-awesome-app
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
### Use with npx
|
|
@@ -24,16 +24,16 @@ ct-pro
|
|
|
24
24
|
Run without installing globally:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
npx quick-scaffolds-cli
|
|
27
|
+
npx quick-scaffolds-cli my-awesome-app
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
|
-
Run the CLI
|
|
32
|
+
Run the CLI with an initial project name, then choose whether to keep it or change it:
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
ct-pro
|
|
36
|
-
?
|
|
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
37
|
? What do you want to build?
|
|
38
38
|
Static HTML/CSS/JS
|
|
39
39
|
React starter
|
|
@@ -41,11 +41,19 @@ ct-pro
|
|
|
41
41
|
|
|
42
42
|
Prompt details:
|
|
43
43
|
|
|
44
|
-
1.
|
|
44
|
+
1. Confirm project name:
|
|
45
|
+
- Keep the provided name
|
|
46
|
+
- Change it by entering a new project name (default: `my-new-project`)
|
|
45
47
|
2. Project type:
|
|
46
48
|
- Static HTML/CSS/JS
|
|
47
49
|
- React starter
|
|
48
50
|
|
|
51
|
+
If you choose not to keep the provided name, the CLI asks:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
? What is your project name? my-updated-app
|
|
55
|
+
```
|
|
56
|
+
|
|
49
57
|
## Templates
|
|
50
58
|
|
|
51
59
|
### 1. Static HTML/CSS/JS
|
|
@@ -71,10 +79,10 @@ Generated structure:
|
|
|
71
79
|
|
|
72
80
|
```text
|
|
73
81
|
my-awesome-app/
|
|
82
|
+
├── .gitignore
|
|
83
|
+
├── index.css
|
|
84
|
+
├── index.html
|
|
74
85
|
├── package.json
|
|
75
|
-
├── public/
|
|
76
|
-
│ ├── index.html
|
|
77
|
-
│ └── index.css
|
|
78
86
|
└── src/
|
|
79
87
|
├── App.css
|
|
80
88
|
├── App.jsx
|
|
@@ -101,8 +109,13 @@ npm run dev
|
|
|
101
109
|
|
|
102
110
|
```text
|
|
103
111
|
quick-scaffolds-cli/
|
|
112
|
+
├── .gitignore
|
|
113
|
+
├── .npmignore
|
|
104
114
|
├── bin/
|
|
105
115
|
│ └── cli.js
|
|
116
|
+
├── package-lock.json
|
|
117
|
+
├── package.json
|
|
118
|
+
├── README.md
|
|
106
119
|
├── templates/
|
|
107
120
|
│ ├── html-template/
|
|
108
121
|
│ │ ├── index.html
|
|
@@ -111,17 +124,16 @@ quick-scaffolds-cli/
|
|
|
111
124
|
│ │ └── js/
|
|
112
125
|
│ │ └── app.js
|
|
113
126
|
│ └── react-template/
|
|
127
|
+
│ ├── .gitignore
|
|
128
|
+
│ ├── index.css
|
|
129
|
+
│ ├── index.html
|
|
114
130
|
│ ├── package.json
|
|
115
|
-
│ ├── public/
|
|
116
|
-
│ │ ├── index.css
|
|
117
|
-
│ │ └── index.html
|
|
118
131
|
│ └── src/
|
|
119
132
|
│ ├── App.css
|
|
120
133
|
│ ├── App.jsx
|
|
121
134
|
│ ├── index.css
|
|
122
135
|
│ └── main.jsx
|
|
123
|
-
|
|
124
|
-
└── README.md
|
|
136
|
+
└── LICENSE
|
|
125
137
|
```
|
|
126
138
|
|
|
127
139
|
## Dependencies
|
|
@@ -134,4 +146,4 @@ MIT
|
|
|
134
146
|
|
|
135
147
|
## Contributing
|
|
136
148
|
|
|
137
|
-
Issues and pull requests are welcome on
|
|
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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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(
|
|
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, '
|
|
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
|
File without changes
|