kimu-cli 0.1.0 → 1.0.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/CHANGELOG.md +47 -2
- package/README.md +21 -10
- package/bin/kimu.js +6 -4
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +58 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +167 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/new.d.ts +16 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +316 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +6 -1
- package/dist/config/constants.js.map +1 -1
- package/dist/types/cli-types.d.ts +7 -0
- package/dist/types/cli-types.d.ts.map +1 -1
- package/dist/utils/module-installer.d.ts +11 -0
- package/dist/utils/module-installer.d.ts.map +1 -0
- package/dist/utils/module-installer.js +21 -0
- package/dist/utils/module-installer.js.map +1 -0
- package/dist/utils/registry.d.ts +8 -0
- package/dist/utils/registry.d.ts.map +1 -0
- package/dist/utils/registry.js +109 -0
- package/dist/utils/registry.js.map +1 -0
- package/docs/README.md +126 -0
- package/docs/command-kimu.md +14 -0
- package/docs/commands/create.md +60 -15
- package/docs/commands/install.md +52 -8
- package/docs/commands/list.md +39 -51
- package/docs/commands/new.md +626 -0
- package/docs/configuration-files.md +192 -0
- package/docs/getting-started.md +386 -0
- package/docs/index.md +57 -27
- package/docs/intro.md +30 -8
- package/docs/quick-reference.md +335 -0
- package/package.json +101 -101
- package/templates/generators/README.md +76 -0
- package/templates/generators/extension/config.json +45 -0
- package/templates/generators/extension/templates/component.ts.template +66 -0
- package/templates/generators/extension/templates/style.css.template +40 -0
- package/templates/generators/extension/templates/view.html.template +9 -0
- package/templates/generators/module/config.json +35 -0
- package/templates/generators/module/templates/README.md.template +62 -0
- package/templates/generators/module/templates/module.ts.template +36 -0
- package/templates/generators/module/templates/service.ts.template +41 -0
- package/docs/command-kimu-new.md +0 -207
- package/docs/command-kimu-old.md +0 -51
package/package.json
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "kimu-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Official command-line interface for the KIMU framework ecosystem - Create, build, and manage KIMU applications",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"kimu": "./bin/kimu.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsc",
|
|
11
|
-
"dev": "tsc --watch",
|
|
12
|
-
"test": "jest",
|
|
13
|
-
"test:watch": "jest --watch",
|
|
14
|
-
"test:coverage": "jest --coverage",
|
|
15
|
-
"lint": "eslint src/**/*.ts",
|
|
16
|
-
"lint:fix": "eslint src/**/*.ts --fix",
|
|
17
|
-
"format": "prettier --write src/**/*.ts",
|
|
18
|
-
"link": "npm link",
|
|
19
|
-
"release": "npm run build && npm publish",
|
|
20
|
-
"prepare": "npm run build",
|
|
21
|
-
"package": "npm run build && npm pack",
|
|
22
|
-
"version": "npm run build",
|
|
23
|
-
"prepublishOnly": "npm run lint",
|
|
24
|
-
"preversion": "npm run lint",
|
|
25
|
-
"postversion": "git push && git push --tags"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"kimu",
|
|
29
|
-
"cli",
|
|
30
|
-
"framework",
|
|
31
|
-
"web-components",
|
|
32
|
-
"typescript",
|
|
33
|
-
"developer-tools",
|
|
34
|
-
"scaffolding",
|
|
35
|
-
"generator",
|
|
36
|
-
"build-tool",
|
|
37
|
-
"kimu-framework"
|
|
38
|
-
],
|
|
39
|
-
"author": {
|
|
40
|
-
"name": "Marco Di Pasquale",
|
|
41
|
-
"email": "info@unicoverso.com",
|
|
42
|
-
"url": "https://unicoverso.com"
|
|
43
|
-
},
|
|
44
|
-
"license": "MPL-2.0",
|
|
45
|
-
"repository": {
|
|
46
|
-
"type": "git",
|
|
47
|
-
"url": "https://github.com/UnicoVerso/kimu-cli.git"
|
|
48
|
-
},
|
|
49
|
-
"bugs": {
|
|
50
|
-
"url": "https://github.com/UnicoVerso/kimu-cli/issues"
|
|
51
|
-
},
|
|
52
|
-
"homepage": "https://github.com/UnicoVerso/kimu-cli#readme",
|
|
53
|
-
"engines": {
|
|
54
|
-
"node": ">=18.0.0",
|
|
55
|
-
"npm": ">=8.0.0"
|
|
56
|
-
},
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"axios": "^1.6.2",
|
|
59
|
-
"chalk": "^5.3.0",
|
|
60
|
-
"commander": "^11.1.0",
|
|
61
|
-
"fs-extra": "^11.1.1",
|
|
62
|
-
"glob": "^10.3.10",
|
|
63
|
-
"inquirer": "^9.2.12",
|
|
64
|
-
"ora": "^7.0.1",
|
|
65
|
-
"semver": "^7.5.4",
|
|
66
|
-
"tar": "^6.2.0",
|
|
67
|
-
"validate-npm-package-name": "^5.0.0"
|
|
68
|
-
},
|
|
69
|
-
"devDependencies": {
|
|
70
|
-
"@types/fs-extra": "^11.0.4",
|
|
71
|
-
"@types/inquirer": "^9.0.7",
|
|
72
|
-
"@types/jest": "^29.5.8",
|
|
73
|
-
"@types/node": "^20.10.5",
|
|
74
|
-
"@types/semver": "^7.5.6",
|
|
75
|
-
"@types/tar": "^6.1.10",
|
|
76
|
-
"@types/validate-npm-package-name": "^4.0.2",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
78
|
-
"@typescript-eslint/parser": "^6.14.0",
|
|
79
|
-
"eslint": "^8.55.0",
|
|
80
|
-
"eslint-config-prettier": "^9.1.0",
|
|
81
|
-
"eslint-plugin-prettier": "^5.0.1",
|
|
82
|
-
"jest": "^29.7.0",
|
|
83
|
-
"prettier": "^3.1.1",
|
|
84
|
-
"ts-jest": "^29.1.1",
|
|
85
|
-
"typescript": "^5.3.3"
|
|
86
|
-
},
|
|
87
|
-
"files": [
|
|
88
|
-
"dist/**/*",
|
|
89
|
-
"bin/**/*",
|
|
90
|
-
"templates/**/*",
|
|
91
|
-
"README.md",
|
|
92
|
-
"LICENSE",
|
|
93
|
-
"CHANGELOG.md",
|
|
94
|
-
"docs/**/*"
|
|
95
|
-
],
|
|
96
|
-
"publishConfig": {
|
|
97
|
-
"access": "public",
|
|
98
|
-
"registry": "https://registry.npmjs.org/"
|
|
99
|
-
},
|
|
100
|
-
"preferGlobal": true
|
|
101
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "kimu-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official command-line interface for the KIMU framework ecosystem - Create, build, and manage KIMU applications with extensible template-based generators",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"kimu": "./bin/kimu.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsc --watch",
|
|
12
|
+
"test": "jest",
|
|
13
|
+
"test:watch": "jest --watch",
|
|
14
|
+
"test:coverage": "jest --coverage",
|
|
15
|
+
"lint": "eslint src/**/*.ts",
|
|
16
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
17
|
+
"format": "prettier --write src/**/*.ts",
|
|
18
|
+
"link": "npm link",
|
|
19
|
+
"release": "npm run build && npm publish",
|
|
20
|
+
"prepare": "npm run build",
|
|
21
|
+
"package": "npm run build && npm pack",
|
|
22
|
+
"version": "npm run build",
|
|
23
|
+
"prepublishOnly": "npm run lint",
|
|
24
|
+
"preversion": "npm run lint",
|
|
25
|
+
"postversion": "git push && git push --tags"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"kimu",
|
|
29
|
+
"cli",
|
|
30
|
+
"framework",
|
|
31
|
+
"web-components",
|
|
32
|
+
"typescript",
|
|
33
|
+
"developer-tools",
|
|
34
|
+
"scaffolding",
|
|
35
|
+
"generator",
|
|
36
|
+
"build-tool",
|
|
37
|
+
"kimu-framework"
|
|
38
|
+
],
|
|
39
|
+
"author": {
|
|
40
|
+
"name": "Marco Di Pasquale",
|
|
41
|
+
"email": "info@unicoverso.com",
|
|
42
|
+
"url": "https://unicoverso.com"
|
|
43
|
+
},
|
|
44
|
+
"license": "MPL-2.0",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/UnicoVerso/kimu-cli.git"
|
|
48
|
+
},
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/UnicoVerso/kimu-cli/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/UnicoVerso/kimu-cli#readme",
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0",
|
|
55
|
+
"npm": ">=8.0.0"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"axios": "^1.6.2",
|
|
59
|
+
"chalk": "^5.3.0",
|
|
60
|
+
"commander": "^11.1.0",
|
|
61
|
+
"fs-extra": "^11.1.1",
|
|
62
|
+
"glob": "^10.3.10",
|
|
63
|
+
"inquirer": "^9.2.12",
|
|
64
|
+
"ora": "^7.0.1",
|
|
65
|
+
"semver": "^7.5.4",
|
|
66
|
+
"tar": "^6.2.0",
|
|
67
|
+
"validate-npm-package-name": "^5.0.0"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@types/fs-extra": "^11.0.4",
|
|
71
|
+
"@types/inquirer": "^9.0.7",
|
|
72
|
+
"@types/jest": "^29.5.8",
|
|
73
|
+
"@types/node": "^20.10.5",
|
|
74
|
+
"@types/semver": "^7.5.6",
|
|
75
|
+
"@types/tar": "^6.1.10",
|
|
76
|
+
"@types/validate-npm-package-name": "^4.0.2",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
78
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
79
|
+
"eslint": "^8.55.0",
|
|
80
|
+
"eslint-config-prettier": "^9.1.0",
|
|
81
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
82
|
+
"jest": "^29.7.0",
|
|
83
|
+
"prettier": "^3.1.1",
|
|
84
|
+
"ts-jest": "^29.1.1",
|
|
85
|
+
"typescript": "^5.3.3"
|
|
86
|
+
},
|
|
87
|
+
"files": [
|
|
88
|
+
"dist/**/*",
|
|
89
|
+
"bin/**/*",
|
|
90
|
+
"templates/**/*",
|
|
91
|
+
"README.md",
|
|
92
|
+
"LICENSE",
|
|
93
|
+
"CHANGELOG.md",
|
|
94
|
+
"docs/**/*"
|
|
95
|
+
],
|
|
96
|
+
"publishConfig": {
|
|
97
|
+
"access": "public",
|
|
98
|
+
"registry": "https://registry.npmjs.org/"
|
|
99
|
+
},
|
|
100
|
+
"preferGlobal": true
|
|
101
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Generator Templates
|
|
2
|
+
|
|
3
|
+
This folder contains template configurations for the `kimu new` command.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
Each generator type has its own folder:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
generators/
|
|
11
|
+
├── extension/ # Extension generator
|
|
12
|
+
│ ├── config.json # Generator configuration
|
|
13
|
+
│ └── templates/ # Template files
|
|
14
|
+
├── module/ # Module generator
|
|
15
|
+
│ ├── config.json
|
|
16
|
+
│ └── templates/
|
|
17
|
+
└── ... (other types)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Adding a New Generator
|
|
21
|
+
|
|
22
|
+
1. Create a new folder with the generator name
|
|
23
|
+
2. Add `config.json` with generator configuration
|
|
24
|
+
3. Add template files in `templates/` subfolder
|
|
25
|
+
4. Templates support placeholders like `{{name}}`, `{{className}}`, etc.
|
|
26
|
+
|
|
27
|
+
## Configuration Schema
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"name": "extension",
|
|
32
|
+
"description": "Create a new UI extension",
|
|
33
|
+
"targetPath": "src/extensions/{{name}}",
|
|
34
|
+
"files": [
|
|
35
|
+
{
|
|
36
|
+
"name": "component.ts",
|
|
37
|
+
"template": "component.ts.template"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "style.css",
|
|
41
|
+
"template": "style.css.template"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"registration": {
|
|
45
|
+
"file": "extension-manifest.json",
|
|
46
|
+
"type": "array",
|
|
47
|
+
"entry": {
|
|
48
|
+
"tag": "{{kebabName}}",
|
|
49
|
+
"name": "{{titleName}}",
|
|
50
|
+
"version": "1.0.0"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"postCreate": [
|
|
54
|
+
"Edit {{targetPath}}/component.ts to add your logic",
|
|
55
|
+
"Load it with extensionManager.load('{{name}}')"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Template Placeholders
|
|
61
|
+
|
|
62
|
+
Available placeholders in templates and config:
|
|
63
|
+
- `{{name}}` - Original name (e.g., "my-feature")
|
|
64
|
+
- `{{className}}` - PascalCase class name (e.g., "MyFeature")
|
|
65
|
+
- `{{kebabName}}` - kebab-case name (e.g., "my-feature")
|
|
66
|
+
- `{{camelName}}` - camelCase name (e.g., "myFeature")
|
|
67
|
+
- `{{titleName}}` - Title Case name (e.g., "My Feature")
|
|
68
|
+
- `{{snakeName}}` - snake_case name (e.g., "my_feature")
|
|
69
|
+
- `{{targetPath}}` - Computed target path
|
|
70
|
+
|
|
71
|
+
## Notes
|
|
72
|
+
|
|
73
|
+
- Template files use `.template` extension
|
|
74
|
+
- Placeholders are replaced during generation
|
|
75
|
+
- Registration can be disabled with `--no-register` flag
|
|
76
|
+
- Custom paths can be specified with `--path` option
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "extension",
|
|
3
|
+
"description": "Create a new UI extension with component, styles, and template",
|
|
4
|
+
"targetPath": "src/extensions/{{name}}",
|
|
5
|
+
"files": [
|
|
6
|
+
{
|
|
7
|
+
"name": "component.ts",
|
|
8
|
+
"template": "component.ts.template",
|
|
9
|
+
"description": "Extension logic and lifecycle"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "style.css",
|
|
13
|
+
"template": "style.css.template",
|
|
14
|
+
"description": "Component styles"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "view.html",
|
|
18
|
+
"template": "view.html.template",
|
|
19
|
+
"description": "HTML template"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"registration": {
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"file": "extension-manifest.json",
|
|
25
|
+
"type": "array",
|
|
26
|
+
"entry": {
|
|
27
|
+
"tag": "{{kebabName}}",
|
|
28
|
+
"name": "{{titleName}}",
|
|
29
|
+
"version": "1.0.0",
|
|
30
|
+
"description": "Description for {{name}} extension",
|
|
31
|
+
"author": "Your Name",
|
|
32
|
+
"icon": "🎨",
|
|
33
|
+
"internal": false,
|
|
34
|
+
"path": "{{name}}",
|
|
35
|
+
"dependencies": []
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"postCreate": [
|
|
39
|
+
"Edit {{targetPath}}/component.ts to add your logic",
|
|
40
|
+
"Style your component in {{targetPath}}/style.css",
|
|
41
|
+
"Update the template in {{targetPath}}/view.html",
|
|
42
|
+
"Extension registered in extension-manifest.json",
|
|
43
|
+
"Load it with extensionManager.load('{{name}}')"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { KimuComponent } from '../../core/kimu-component';
|
|
2
|
+
import { KimuComponentElement } from '../../core/kimu-component-element';
|
|
3
|
+
|
|
4
|
+
@KimuComponent({
|
|
5
|
+
tag: '{{kebabName}}',
|
|
6
|
+
name: '{{titleName}}',
|
|
7
|
+
version: '1.0.0',
|
|
8
|
+
description: 'Description for {{name}} extension',
|
|
9
|
+
author: 'Your Name',
|
|
10
|
+
icon: '🎨',
|
|
11
|
+
internal: false,
|
|
12
|
+
path: '{{name}}',
|
|
13
|
+
dependencies: []
|
|
14
|
+
})
|
|
15
|
+
export class {{className}}Extension extends KimuComponentElement {
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the extension
|
|
18
|
+
*/
|
|
19
|
+
async onInit(): Promise<void> {
|
|
20
|
+
console.log('{{className}} extension initialized');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get data for template binding
|
|
25
|
+
*/
|
|
26
|
+
getData() {
|
|
27
|
+
return {
|
|
28
|
+
title: '{{titleName}}',
|
|
29
|
+
message: 'Welcome to {{name}} extension!'
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Called after rendering
|
|
35
|
+
*/
|
|
36
|
+
onRender(): void {
|
|
37
|
+
// Add event listeners or DOM manipulations here
|
|
38
|
+
this.setupEventListeners();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Setup event listeners
|
|
43
|
+
*/
|
|
44
|
+
private setupEventListeners(): void {
|
|
45
|
+
// Example: Button click handler
|
|
46
|
+
const button = this.$('#actionButton');
|
|
47
|
+
if (button) {
|
|
48
|
+
button.addEventListener('click', () => this.handleAction());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Handle button action
|
|
54
|
+
*/
|
|
55
|
+
private handleAction(): void {
|
|
56
|
+
console.log('Action triggered in {{name}}');
|
|
57
|
+
// Add your logic here
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Cleanup when extension is destroyed
|
|
62
|
+
*/
|
|
63
|
+
onDestroy(): void {
|
|
64
|
+
console.log('{{className}} extension destroyed');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* Styles for {{name}} extension */
|
|
2
|
+
|
|
3
|
+
.{{name}}-container {
|
|
4
|
+
padding: 20px;
|
|
5
|
+
margin: 20px;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
8
|
+
color: white;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.{{name}}-title {
|
|
12
|
+
font-size: 2em;
|
|
13
|
+
margin-bottom: 10px;
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.{{name}}-content {
|
|
18
|
+
font-size: 1.2em;
|
|
19
|
+
line-height: 1.6;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.{{name}}-button {
|
|
23
|
+
margin-top: 20px;
|
|
24
|
+
padding: 10px 20px;
|
|
25
|
+
background: white;
|
|
26
|
+
color: #667eea;
|
|
27
|
+
border: none;
|
|
28
|
+
border-radius: 5px;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
font-weight: bold;
|
|
31
|
+
transition: transform 0.2s;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.{{name}}-button:hover {
|
|
35
|
+
transform: scale(1.05);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.{{name}}-button:active {
|
|
39
|
+
transform: scale(0.95);
|
|
40
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "module",
|
|
3
|
+
"description": "Create a new service module with module class and service",
|
|
4
|
+
"targetPath": "src/modules/{{name}}",
|
|
5
|
+
"files": [
|
|
6
|
+
{
|
|
7
|
+
"name": "module.ts",
|
|
8
|
+
"template": "module.ts.template",
|
|
9
|
+
"description": "Module class"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "{{name}}-service.ts",
|
|
13
|
+
"template": "service.ts.template",
|
|
14
|
+
"description": "Service implementation"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "README.md",
|
|
18
|
+
"template": "README.md.template",
|
|
19
|
+
"description": "Module documentation"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"registration": {
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"file": "kimu.config.json",
|
|
25
|
+
"type": "object",
|
|
26
|
+
"path": "modules.installed",
|
|
27
|
+
"entry": "{{name}}"
|
|
28
|
+
},
|
|
29
|
+
"postCreate": [
|
|
30
|
+
"Edit {{targetPath}}/module.ts to implement your module",
|
|
31
|
+
"Create services in {{targetPath}}/{{name}}-service.ts",
|
|
32
|
+
"Module registered in kimu.config.json",
|
|
33
|
+
"Load it with new {{className}}Module()"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# {{className}} Module
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This module provides {{name}} functionality to KIMU applications.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
This module has been created using `kimu new module {{name}}`.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
### Basic Usage
|
|
12
|
+
```typescript
|
|
13
|
+
import { KimuModuleManager } from '@kimu/core';
|
|
14
|
+
import {{className}}Module from './modules/{{name}}/module';
|
|
15
|
+
|
|
16
|
+
// Initialize module manager
|
|
17
|
+
const moduleManager = KimuModuleManager.getInstance();
|
|
18
|
+
|
|
19
|
+
// Load the module
|
|
20
|
+
const {{camelName}}Module = new {{className}}Module();
|
|
21
|
+
await moduleManager.loadModule({{camelName}}Module);
|
|
22
|
+
|
|
23
|
+
// Get the service
|
|
24
|
+
const {{camelName}}Service = moduleManager.getService('{{name}}');
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Advanced Usage
|
|
28
|
+
```typescript
|
|
29
|
+
// Use the service directly
|
|
30
|
+
import { {{camelName}}Service } from './modules/{{name}}/{{name}}-service';
|
|
31
|
+
|
|
32
|
+
// Call service methods
|
|
33
|
+
{{camelName}}Service.exampleMethod();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## API Reference
|
|
37
|
+
|
|
38
|
+
### {{className}}Module
|
|
39
|
+
|
|
40
|
+
#### Methods
|
|
41
|
+
- `getService()`: Returns the module service instance
|
|
42
|
+
- `init()`: Initializes the module
|
|
43
|
+
- `destroy()`: Cleanup when module is destroyed
|
|
44
|
+
|
|
45
|
+
### {{className}}Service
|
|
46
|
+
|
|
47
|
+
#### Methods
|
|
48
|
+
- `getInstance()`: Get the singleton instance
|
|
49
|
+
- `init()`: Initialize the service
|
|
50
|
+
- `exampleMethod()`: Example method implementation
|
|
51
|
+
|
|
52
|
+
## Configuration
|
|
53
|
+
Add any configuration options for your module here.
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
Add usage examples here.
|
|
57
|
+
|
|
58
|
+
## Contributing
|
|
59
|
+
Contributions are welcome! Please follow the KIMU contribution guidelines.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
This module follows the KIMU project license.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { KimuModule } from '../../core/kimu-module';
|
|
2
|
+
import { {{camelName}}Service } from './{{name}}-service';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* {{className}} Module
|
|
6
|
+
*
|
|
7
|
+
* This module provides {{name}} functionality to KIMU applications.
|
|
8
|
+
*/
|
|
9
|
+
export default class {{className}}Module extends KimuModule {
|
|
10
|
+
constructor(name = '{{name}}', version = '1.0.0', options?: any) {
|
|
11
|
+
super(name, version, options);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get the module service instance
|
|
16
|
+
*/
|
|
17
|
+
getService() {
|
|
18
|
+
return {{camelName}}Service;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the module
|
|
23
|
+
*/
|
|
24
|
+
async init(): Promise<void> {
|
|
25
|
+
console.log('{{className}}Module initialized');
|
|
26
|
+
// Add initialization logic here
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Cleanup when module is destroyed
|
|
31
|
+
*/
|
|
32
|
+
destroy(): void {
|
|
33
|
+
console.log('{{className}}Module destroyed');
|
|
34
|
+
// Add cleanup logic here
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{className}} Service
|
|
3
|
+
*
|
|
4
|
+
* This service provides {{name}} functionality to KIMU applications.
|
|
5
|
+
*/
|
|
6
|
+
export class {{className}}Service {
|
|
7
|
+
private static instance: {{className}}Service;
|
|
8
|
+
|
|
9
|
+
private constructor() {
|
|
10
|
+
// Private constructor for singleton pattern
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get the singleton instance
|
|
15
|
+
*/
|
|
16
|
+
static getInstance(): {{className}}Service {
|
|
17
|
+
if (!{{className}}Service.instance) {
|
|
18
|
+
{{className}}Service.instance = new {{className}}Service();
|
|
19
|
+
}
|
|
20
|
+
return {{className}}Service.instance;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the service
|
|
25
|
+
*/
|
|
26
|
+
async init(): Promise<void> {
|
|
27
|
+
console.log('{{className}}Service initialized');
|
|
28
|
+
// Add initialization logic here
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Example method
|
|
33
|
+
*/
|
|
34
|
+
public exampleMethod(): void {
|
|
35
|
+
console.log('{{className}}Service.exampleMethod called');
|
|
36
|
+
// Add your method implementation here
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Export singleton instance
|
|
41
|
+
export const {{camelName}}Service = {{className}}Service.getInstance();
|