express-module-cli 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/index.js +1 -1
- package/package.json +15 -1
- package/src/index.ts +1 -1
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Mohammad Ashiqur Rahman
|
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
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# express-module-cli
|
2
|
+
|
3
|
+
A CLI tool to generate modules for TypeScript-based Express applications.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- Quickly generate controllers, services, routes, models, and interfaces.
|
8
|
+
- Designed for TypeScript-based Express apps.
|
9
|
+
- Flexible commands with aliases for convenience.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
### 1. Using npm
|
14
|
+
|
15
|
+
Install the package globally for easy usage:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
npm install -g express-module-cli
|
19
|
+
```
|
20
|
+
|
21
|
+
### 2. As a Development Dependency
|
22
|
+
|
23
|
+
Install it as a dev dependency in your project:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
npm install --save-dev create-module-cli
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
### 1. Global Usage
|
32
|
+
|
33
|
+
Run the CLI tool with the create command:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
create module <module-name>
|
37
|
+
```
|
38
|
+
|
39
|
+
For example:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
create module user
|
43
|
+
```
|
44
|
+
|
45
|
+
or,
|
46
|
+
|
47
|
+
```bash
|
48
|
+
create m user
|
49
|
+
```
|
50
|
+
|
51
|
+
### 2. Using npx
|
52
|
+
|
53
|
+
Without installation:
|
54
|
+
|
55
|
+
```bash
|
56
|
+
npx express-module-cli module <module-name>
|
57
|
+
```
|
58
|
+
|
59
|
+
For example:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
npx express-module-cli module user
|
63
|
+
```
|
64
|
+
|
65
|
+
or,
|
66
|
+
|
67
|
+
```bash
|
68
|
+
npx express-module-cli m user
|
69
|
+
```
|
70
|
+
|
71
|
+
## Example Output
|
72
|
+
|
73
|
+
```bash
|
74
|
+
npx create-module-cli module user
|
75
|
+
```
|
76
|
+
|
77
|
+
The following files will be created in src/modules/user:
|
78
|
+
|
79
|
+
- user.controller.ts
|
80
|
+
- user.service.ts
|
81
|
+
- user.route.ts
|
82
|
+
- user.model.ts
|
83
|
+
- user.interface.ts
|
84
|
+
|
85
|
+
## Prerequisites
|
86
|
+
|
87
|
+
This CLI tool is designed specifically for **TypeScript-based Express applications**. Ensure your project meets the following requirements:
|
88
|
+
|
89
|
+
- TypeScript installed (`npm install typescript --save-dev`)
|
90
|
+
- `tsconfig.json` configured in your project root
|
91
|
+
- Express.js installed (`npm install express`)
|
package/dist/index.js
CHANGED
@@ -9,7 +9,7 @@ const capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
|
|
9
9
|
// Main CLI logic
|
10
10
|
yargs(hideBin(process.argv))
|
11
11
|
.scriptName("create") // Allows using "npx create" or "create" if globally installed
|
12
|
-
.command("module <module>", "Create a new module", (yargs) => {
|
12
|
+
.command(["module <module>", "m <module>"], "Create a new module", (yargs) => {
|
13
13
|
return yargs.positional("module", {
|
14
14
|
describe: "The name of the module",
|
15
15
|
type: "string",
|
package/package.json
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "express-module-cli",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.1",
|
4
|
+
"license": "MIT",
|
5
|
+
"keywords": [
|
6
|
+
"CLI",
|
7
|
+
"TypeScript",
|
8
|
+
"Express",
|
9
|
+
"Module Generator"
|
10
|
+
],
|
11
|
+
"engines": {
|
12
|
+
"node": ">=14.0.0"
|
13
|
+
},
|
14
|
+
"peerDependencies": {
|
15
|
+
"typescript": "^4.0.0"
|
16
|
+
},
|
17
|
+
"author": "Mohammad Ashiqur Rahman",
|
4
18
|
"description": "A CLI tool to create modules for TypeScript-based Express apps",
|
5
19
|
"bin": {
|
6
20
|
"create": "./dist/index.js"
|
package/src/index.ts
CHANGED
@@ -14,7 +14,7 @@ const capitalize = (name: string): string =>
|
|
14
14
|
yargs(hideBin(process.argv))
|
15
15
|
.scriptName("create") // Allows using "npx create" or "create" if globally installed
|
16
16
|
.command(
|
17
|
-
"module <module>",
|
17
|
+
["module <module>", "m <module>"],
|
18
18
|
"Create a new module",
|
19
19
|
(yargs) => {
|
20
20
|
return yargs.positional("module", {
|