projects-init-cli 1.1.0 ā 2.1.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/dist/index.js +1 -1
- package/dist/prompts.js +12 -1
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const program = new commander_1.Command();
|
|
|
12
12
|
program
|
|
13
13
|
.name('projects-init')
|
|
14
14
|
.description('CLI tool to initialize projects with customizable tech stacks')
|
|
15
|
-
.version('1.0
|
|
15
|
+
.version('2.1.0')
|
|
16
16
|
.action(async () => {
|
|
17
17
|
try {
|
|
18
18
|
console.log(chalk_1.default.blue.bold('\nš Project Initializer CLI\n'));
|
package/dist/prompts.js
CHANGED
|
@@ -4,14 +4,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.promptUser = promptUser;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
7
8
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
9
|
+
function getDefaultProjectName() {
|
|
10
|
+
const folderName = path_1.default.basename(process.cwd());
|
|
11
|
+
const sanitized = folderName
|
|
12
|
+
.toLowerCase()
|
|
13
|
+
.replace(/[\s_]+/g, '-')
|
|
14
|
+
.replace(/[^a-z0-9-]/g, '')
|
|
15
|
+
.replace(/-+/g, '-')
|
|
16
|
+
.replace(/^-|-$/g, '');
|
|
17
|
+
return sanitized || 'my-project';
|
|
18
|
+
}
|
|
8
19
|
async function promptUser() {
|
|
9
20
|
const answers = await inquirer_1.default.prompt([
|
|
10
21
|
{
|
|
11
22
|
type: 'input',
|
|
12
23
|
name: 'projectName',
|
|
13
24
|
message: 'What is your project name?',
|
|
14
|
-
default:
|
|
25
|
+
default: getDefaultProjectName(),
|
|
15
26
|
validate: (input) => {
|
|
16
27
|
if (!input.trim()) {
|
|
17
28
|
return 'Project name cannot be empty';
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projects-init-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "CLI tool to initialize projects with customizable frontend, backend, and storage options",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"projects-init": "
|
|
7
|
+
"projects-init": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc",
|
|
@@ -31,19 +31,22 @@
|
|
|
31
31
|
],
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "https://github.com/
|
|
34
|
+
"url": "git+https://github.com/MacAndersonUche/Projects-Init-CLI.git"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
35
38
|
},
|
|
36
39
|
"engines": {
|
|
37
40
|
"node": ">=18.0.0"
|
|
38
41
|
},
|
|
39
42
|
"dependencies": {
|
|
40
43
|
"commander": "^11.1.0",
|
|
41
|
-
"inquirer": "^
|
|
44
|
+
"inquirer": "^8.2.6",
|
|
42
45
|
"chalk": "^4.1.2",
|
|
43
46
|
"fs-extra": "^11.2.0"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"@types/inquirer": "^
|
|
49
|
+
"@types/inquirer": "^8.2.10",
|
|
47
50
|
"@types/node": "^20.10.6",
|
|
48
51
|
"@types/fs-extra": "^11.0.4",
|
|
49
52
|
"typescript": "^5.3.3",
|