@mbc-cqrs-serverless/cli 0.1.49-beta.0 → 0.1.50-beta.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.
Files changed (2) hide show
  1. package/README.md +94 -63
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
  ## Description
6
6
 
7
- The MBC CLI is a command-line interface tool that helps you to initialize your mbc-cqrs-serverless applications.
7
+ The MBC CLI is a command-line interface tool that helps you initialize and manage MBC CQRS Serverless applications. It provides commands for project creation, version management, and development workflow automation.
8
8
 
9
9
  ## Installation
10
10
 
11
- To install `mbc` command, run:
11
+ To install the `mbc` command globally, run:
12
12
 
13
13
  ```bash
14
14
  npm install -g @mbc-cqrs-serverless/cli
@@ -16,86 +16,117 @@ npm install -g @mbc-cqrs-serverless/cli
16
16
 
17
17
  ## Usage
18
18
 
19
- ### `mbc new|n [projectName@version]`
19
+ ### Project Creation
20
20
 
21
- There are 3 usages for the new command:
21
+ The CLI provides flexible options for creating new projects:
22
22
 
23
- - `mbc new`
24
- - Creates a new project in the current folder using a default name with the latest framework version.
25
- - `mbc new [projectName]`
26
- - Creates a new project in the `projectName` folder using the latest framework version.
27
- - `mbc new [projectName@version]`
28
- - If the specified version exists, the CLI uses that exact version.
29
- - If the provided version is a prefix, the CLI uses the latest version matching that prefix.
30
- - If no matching version is found, the CLI logs an error and provides a list of available versions for the user.
23
+ ```bash
24
+ mbc new [projectName[@version]]
25
+ ```
31
26
 
32
- To change current directory
27
+ #### Basic Usage Examples
28
+
29
+ 1. Create a new project in the current directory:
30
+ ```bash
31
+ mbc new
32
+ ```
33
+
34
+ 2. Create a project with a specific name:
35
+ ```bash
36
+ mbc new my-cqrs-app
37
+ ```
33
38
 
39
+ 3. Create a project with a specific version:
34
40
  ```bash
35
- cd [projectName]
41
+ mbc new my-cqrs-app@0.1.45
36
42
  ```
37
43
 
38
- ## Run the Development Server
39
- 1. Run npm run build to the build project using development mode.
40
- 2. Open in other terminal session and run npm run offline:docker
41
- 3. Open in other terminal session and run npm run migrate to migrate RDS and dynamoDB table
42
- 4. Finally, run npm run offline:sls to start serverless offline mode.
44
+ ### Project Structure
45
+
46
+ The CLI creates a standardized project structure:
43
47
 
44
- After the server runs successfully, you can see:
48
+ ```
49
+ my-cqrs-app/
50
+ ├── src/
51
+ │ ├── commands/ # Command handlers
52
+ │ ├── events/ # Event handlers
53
+ │ ├── interfaces/ # TypeScript interfaces
54
+ │ └── services/ # Business logic services
55
+ ├── test/
56
+ │ ├── e2e/ # End-to-end tests
57
+ │ └── unit/ # Unit tests
58
+ ├── package.json
59
+ └── serverless.yml # Serverless Framework configuration
60
+ ```
45
61
 
62
+ ### Development Workflow
63
+
64
+ 1. After creating a project, install dependencies:
46
65
  ```bash
47
- DEBUG[serverless-offline-sns][adapter]: successfully subscribed queue "http://localhost:9324/101010101010/notification-queue" to topic: "arn:aws:sns:ap-northeast-1:101010101010:MySnsTopic"
48
- Offline Lambda Server listening on http://localhost:4000
49
- serverless-offline-aws-eventbridge :: Plugin ready
50
- serverless-offline-aws-eventbridge :: Mock server running at port: 4010
51
- Starting Offline SQS at stage dev (ap-northeast-1)
52
- Starting Offline Dynamodb Streams at stage dev (ap-northeast-1)
53
-
54
- Starting Offline at stage dev (ap-northeast-1)
55
-
56
- Offline [http for lambda] listening on http://localhost:3002
57
- Function names exposed for local invocation by aws-sdk:
58
- * main: serverless-example-dev-main
59
- Configuring JWT Authorization: ANY /{proxy+}
60
-
61
- ┌────────────────────────────────────────────────────────────────────────┐
62
- │ │
63
- │ ANY | http://localhost:3000/api/public │
64
- │ POST | http://localhost:3000/2015-03-31/functions/main/invocations │
65
- │ ANY | http://localhost:3000/swagger-ui/{proxy*} │
66
- │ POST | http://localhost:3000/2015-03-31/functions/main/invocations │
67
- │ ANY | http://localhost:3000/{proxy*} │
68
- │ POST | http://localhost:3000/2015-03-31/functions/main/invocations │
69
- │ │
70
- └────────────────────────────────────────────────────────────────────────┘
71
-
72
- Server ready: http://localhost:3000 🚀
66
+ cd my-cqrs-app
67
+ npm install
73
68
  ```
74
69
 
75
- You can also use several endpoints:
70
+ 2. Build the project:
71
+ ```bash
72
+ npm run build
73
+ ```
76
74
 
77
- - API gateway: http://localhost:3000
78
- - Offline Lambda Server: http://localhost:4000
79
- - HTTP for lambda: http://localhost:3002
80
- - Step functions: http://localhost:8083
81
- - DynamoDB: http://localhost:8000
82
- - DynamoDB admin: http://localhost:8001
83
- - SNS: http://localhost:4002
84
- - SQS: http://localhost:9324
85
- - SQS admin: http://localhost:9325
86
- - Localstack: http://localhost:4566
87
- - AppSync: http://localhost:4001
88
- - Cognito: http://localhost:9229
89
- - EventBridge: http://localhost:4010
90
- - Simple Email Service: http://localhost:8005
91
- - Run `npx prisma studio` to open studio web: http://localhost:5000
75
+ 3. Start local development environment:
76
+ ```bash
77
+ npm run offline:docker # Start local infrastructure
78
+ npm run migrate # Run database migrations
79
+ npm run offline:sls # Start serverless offline
80
+ ```
92
81
 
82
+ ### Available Commands
93
83
 
84
+ - `mbc new`: Create a new project
85
+ - `mbc version`: Display CLI version
86
+ - `mbc help`: Show command help
87
+ - `mbc list`: List available project templates
94
88
 
89
+ ### Configuration
90
+
91
+ The CLI supports configuration through:
92
+ - Command line arguments
93
+ - Environment variables
94
+ - Configuration files
95
+
96
+ Example configuration file (`.mbcrc.json`):
97
+ ```json
98
+ {
99
+ "defaultTemplate": "basic",
100
+ "region": "ap-northeast-1",
101
+ "stage": "dev"
102
+ }
103
+ ```
95
104
 
96
105
  ## Documentation
97
106
 
98
- Visit https://mbc-cqrs-serverless.mbc-net.com/ to view the full documentation.
107
+ Visit https://mbc-cqrs-serverless.mbc-net.com/ to view the full documentation, including:
108
+ - Detailed CLI commands and options
109
+ - Project setup and configuration
110
+ - Development server setup
111
+ - Available endpoints and services
112
+
113
+ ## Troubleshooting
114
+
115
+ Common issues and solutions:
116
+
117
+ 1. Version not found:
118
+ ```bash
119
+ mbc new myapp@999.999.999
120
+ # Error: Version not found. Available versions: [0.1.45, 0.1.44, ...]
121
+ ```
122
+ Solution: Use `mbc list versions` to see available versions.
123
+
124
+ 2. Project creation fails:
125
+ ```bash
126
+ mbc new my-project
127
+ # Error: Directory not empty
128
+ ```
129
+ Solution: Use a new directory or remove existing files.
99
130
 
100
131
  ## License
101
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbc-cqrs-serverless/cli",
3
- "version": "0.1.49-beta.0",
3
+ "version": "0.1.50-beta.0",
4
4
  "description": "a CLI to get started with MBC CQRS serverless framework",
5
5
  "keywords": [
6
6
  "mbc",
@@ -15,7 +15,7 @@
15
15
  "fargate",
16
16
  "step-functions",
17
17
  "sqs",
18
- "typpescript"
18
+ "typescript"
19
19
  ],
20
20
  "bin": {
21
21
  "mbc": "./dist/index.js"
@@ -49,5 +49,5 @@
49
49
  "devDependencies": {
50
50
  "@faker-js/faker": "^8.3.1"
51
51
  },
52
- "gitHead": "4fb13a54044022d4423830c985b51dd8ec58259a"
52
+ "gitHead": "d61475400eb1b00a1c427769875d2f056e48c73c"
53
53
  }