@mahameru/cli 0.0.17 → 0.0.18

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 ADDED
@@ -0,0 +1,115 @@
1
+ # MahameruJS CLI Utility
2
+
3
+ [![npm version](https://img.shields.io/npm/v/mahameru.svg)](https://www.npmjs.com/package/mahameru)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ `@mahameru/cli` is the command-line interface for running and building Mahameru-based applications. This package provides the core workflow for local development and project builds from the terminal.
7
+
8
+ ## Installation
9
+
10
+ Install the CLI globally so the `mahameru` command is available directly from your terminal:
11
+
12
+ ```bash
13
+ npm install -g @mahameru/cli
14
+ ```
15
+
16
+ After that, you can run `mahameru` commands from any Mahameru project.
17
+
18
+ If you don't have any MahameruJS projects, you can create one by running:
19
+
20
+ ```bash
21
+ npm create mahameru
22
+ ```
23
+
24
+ or
25
+
26
+ ```bash
27
+ npx create-mahameru
28
+ ```
29
+
30
+ and follow the prompts.
31
+
32
+ ## Project Requirements
33
+
34
+ This CLI expects a `mahameru.config.ts` file in the project root. That file is loaded when running development mode.
35
+
36
+ Some commands also rely on these project dependencies:
37
+
38
+ - `tsx` to load the TypeScript config file for the `dev` command
39
+ - `typescript` for the compile step in the `build` command
40
+ - `tsc-alias` to rewrite path aliases after compilation
41
+
42
+ For application source aliases, prefer `tsconfig.json` paths such as `@/*`. Do not rely on `package.json#imports` for `src/**` files that must run from `dist/` in production.
43
+
44
+ ## Usage
45
+
46
+ ### Development
47
+
48
+ Run the Mahameru development server with Hot Reload:
49
+
50
+ ```bash
51
+ mahameru dev
52
+ ```
53
+
54
+ Available options:
55
+
56
+ ```bash
57
+ mahameru dev --port 3000
58
+ mahameru dev -p 3000
59
+ mahameru dev --host localhost
60
+ mahameru dev -h localhost
61
+ ```
62
+
63
+ This command will:
64
+
65
+ - load `mahameru.config.ts`
66
+ - run TypeScript typechecking before each start or restart
67
+ - apply default config values when they are not provided
68
+ - run the Mahameru application from the current project
69
+ - watch `src/**` and `mahameru.config.ts`, then hot reload the development server automatically when files change
70
+
71
+ This Hot Reload flow refreshes the server during development when project files change. It does not provide browser HMR or module replacement inside the running app.
72
+ If typechecking fails, the error is shown in the console and the dev server will wait until the next valid save before starting again.
73
+
74
+ ### Build
75
+
76
+ Build the project with TypeScript:
77
+
78
+ ```bash
79
+ mahameru build
80
+ ```
81
+
82
+ This command will:
83
+
84
+ - run `tsc --project tsconfig.json`
85
+ - run `tsc-alias -p tsconfig.json`
86
+ - fail if compiled `dist/**/*.js` files still contain unresolved `@/` or `#/` specifiers
87
+
88
+ ### Start
89
+
90
+ Run the production server from the compiled `dist/` output:
91
+
92
+ ```bash
93
+ mahameru start
94
+ ```
95
+
96
+ This command will:
97
+
98
+ - load `dist/mahameru.config.js`
99
+ - run the Mahameru application using `dist/`, `dist/modules`, and `dist/routes`
100
+ - expect all application path aliases to have been rewritten during `mahameru build`
101
+
102
+ ## Quick Workflow
103
+
104
+ This CLI is focused on the basic development workflow:
105
+
106
+ 1. Use `mahameru dev` during local development and let Hot Reload refresh the server on file changes.
107
+ 2. Use `mahameru build` to produce the TypeScript build output.
108
+ 3. Use `@/*` path aliases in `tsconfig.json` when you want non-relative imports inside `src/`.
109
+ 4. Run `mahameru start` after a successful build to verify the production output.
110
+
111
+ ## Notes
112
+
113
+ - If `mahameru.config.ts` is missing, the CLI will stop and show an error.
114
+ - If `tsx`, `typescript`, or `tsc-alias` are not installed in the project, the related command will fail.
115
+ - `mahameru dev` ignores changes inside `dist/` and `node_modules/`.
package/package.json CHANGED
@@ -1,43 +1,60 @@
1
- {
2
- "name": "@mahameru/cli",
3
- "version": "0.0.17",
4
- "description": "MahameruJS CLI Utility - The command-line interface for running and building Mahameru-based applications",
5
- "bin": {
6
- "mahameru": "./bin.js"
7
- },
8
- "scripts": {
9
- "typecheck": "tsc --noEmit --project tsconfig.json",
10
- "clean": "rimraf dist",
11
- "build": "npm run clean && webpack"
12
- },
13
- "keywords": [
14
- "mahameruJS",
15
- "mahameru",
16
- "cli",
17
- "framework",
18
- "nodejs",
19
- "typescript",
20
- "web-server",
21
- "build-tool",
22
- "developer-tools",
23
- "process-manager"
24
- ],
25
- "author": "Bintan <hello@bintvn.co>",
26
- "license": "ISC",
27
- "files": [
28
- "bin.js",
29
- "mpm"
30
- ],
31
- "engines": {
32
- "node": ">=20.6.0"
33
- },
34
- "dependencies": {
35
- "commander": "^15.0.0",
36
- "ora": "^9.4.1",
37
- "picocolors": "^1.1.1",
38
- "porterman": "^0.0.3",
39
- "socket.io": "^4.8.3",
40
- "tsc-alias": "^1.8.17",
41
- "tsx": "^4.22.4"
42
- }
43
- }
1
+ {
2
+ "name": "@mahameru/cli",
3
+ "version": "0.0.18",
4
+ "description": "MahameruJS CLI Utility - The command-line interface for running and building Mahameru-based applications",
5
+ "bin": {
6
+ "mahameru": "./cli.js"
7
+ },
8
+ "scripts": {
9
+ "typecheck": "tsc --noEmit --project tsconfig.json",
10
+ "clean": "rimraf dist",
11
+ "build": "npm run clean && webpack",
12
+ "build:install": "npm run clean && webpack && cd dist && npm i -g ."
13
+ },
14
+ "keywords": [
15
+ "mahameruJS",
16
+ "mahameru",
17
+ "cli",
18
+ "framework",
19
+ "nodejs",
20
+ "typescript",
21
+ "web-server",
22
+ "build-tool",
23
+ "developer-tools",
24
+ "process-manager"
25
+ ],
26
+ "author": "Bintan <hello@bintvn.co>",
27
+ "license": "ISC",
28
+ "files": [
29
+ "bin.js",
30
+ "mpm"
31
+ ],
32
+ "engines": {
33
+ "node": ">=20.6.0"
34
+ },
35
+ "dependencies": {
36
+ "commander": "^15.0.0",
37
+ "ora": "^9.4.1",
38
+ "picocolors": "^1.1.1",
39
+ "porterman": "^0.0.3",
40
+ "socket.io": "^4.8.3",
41
+ "tsc-alias": "^1.8.17",
42
+ "tsx": "^4.22.4"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "^26.0.0",
46
+ "@types/socket.io": "^3.0.1",
47
+ "@types/webpack-node-externals": "^3.0.4",
48
+ "boxen": "^8.0.1",
49
+ "rimraf": "^6.1.3",
50
+ "strip-ansi": "^7.2.0",
51
+ "terser-webpack-plugin": "^5.6.1",
52
+ "ts-loader": "^9.6.1",
53
+ "ts-node": "^10.9.2",
54
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
55
+ "typescript": "^6.0.3",
56
+ "webpack": "^5.107.2",
57
+ "webpack-cli": "^7.0.3",
58
+ "webpack-node-externals": "^3.0.0"
59
+ }
60
+ }