mn-rails-cli 0.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/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "mn-rails-cli",
3
+ "version": "0.1.0",
4
+ "description": "CLI tool for MN Rails framework",
5
+ "type": "module",
6
+ "bin": {
7
+ "mn-rails": "./dist/index.js"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Temsys-Shen/mn-rails.git"
14
+ },
15
+ "author": "Temsys-Shen",
16
+ "license": "MIT",
17
+ "keywords": [
18
+ "marginnote",
19
+ "plugin",
20
+ "cli",
21
+ "framework"
22
+ ],
23
+ "files": [
24
+ "dist",
25
+ "src/templates",
26
+ "README.md"
27
+ ],
28
+ "dependencies": {
29
+ "mn-rails-core": "^0.1.0",
30
+ "@vue/compiler-sfc": "^3.5.27",
31
+ "chalk": "^5.3.0",
32
+ "chokidar": "^3.5.3",
33
+ "commander": "^11.1.0",
34
+ "consola": "^3.4.2",
35
+ "cosmiconfig": "^9.0.0",
36
+ "esbuild": "^0.27.2",
37
+ "fs-extra": "^11.2.0",
38
+ "inquirer": "^9.2.12",
39
+ "ts-morph": "^27.0.2",
40
+ "ws": "^8.16.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/fs-extra": "^11.0.4",
44
+ "@types/inquirer": "^9.0.7",
45
+ "@types/node": "^20.10.0",
46
+ "@types/ws": "^8.5.10",
47
+ "tsup": "^8.0.1",
48
+ "typescript": "^5.3.3"
49
+ },
50
+ "scripts": {
51
+ "build": "tsup src/index.ts --format cjs,esm --dts --outDir dist",
52
+ "dev": "tsup src/index.ts --format cjs,esm --dts --outDir dist --watch",
53
+ "clean": "rm -rf dist"
54
+ }
55
+ }
@@ -0,0 +1,29 @@
1
+ # {{PROJECT_TITLE}}
2
+
3
+ A MarginNote plugin built with MN Rails.
4
+
5
+ ## Development
6
+
7
+ \`\`\`bash
8
+ # Install dependencies
9
+ npm install
10
+
11
+ # Build the plugin
12
+ mn-rails build
13
+
14
+ # Start development server (coming soon)
15
+ mn-rails dev
16
+ \`\`\`
17
+
18
+ ## Project Structure
19
+
20
+ \`\`\`
21
+ src/
22
+ ├── index.ts # Plugin entry point
23
+ └── controllers/ # Business logic controllers
24
+ └── MainController.ts
25
+ \`\`\`
26
+
27
+ ## License
28
+
29
+ MIT
@@ -0,0 +1,6 @@
1
+ export default {
2
+ name: '{{PROJECT_NAME}}',
3
+ version: '0.1.0',
4
+ title: '{{PROJECT_TITLE}}',
5
+ author: '',
6
+ };
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "version": "0.1.0",
4
+ "description": "A MarginNote plugin built with MN Rails",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "scripts": {
8
+ "build": "mn-rails build",
9
+ "dev": "mn-rails dev"
10
+ },
11
+ "dependencies": {
12
+ "mn-rails-core": "workspace:*"
13
+ },
14
+ "devDependencies": {
15
+ "typescript": "^5.3.3"
16
+ }
17
+ }
@@ -0,0 +1,16 @@
1
+ import { Controller, MN } from 'mn-rails-core';
2
+
3
+ export default class MainController extends Controller {
4
+ onInit() {
5
+ MN.log('MainController initialized');
6
+ }
7
+
8
+ actions = {
9
+ /**
10
+ * Example action: greet someone
11
+ */
12
+ async greet(name: string): Promise<string> {
13
+ return `Hello, ${name}!`;
14
+ }
15
+ };
16
+ }
@@ -0,0 +1,18 @@
1
+ import { App, MN } from 'mn-rails-core';
2
+ import MainController from './controllers/MainController.js';
3
+
4
+ class Plugin extends App {
5
+ private controller?: MainController;
6
+
7
+ onLaunch() {
8
+ MN.log('Plugin launched!');
9
+ this.controller = new MainController();
10
+ }
11
+
12
+ onExit() {
13
+ MN.log('Plugin exiting...');
14
+ this.controller?.onDestroy?.();
15
+ }
16
+ }
17
+
18
+ export default new Plugin();
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "mn-rails-core/tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*"]
8
+ }