@motrix/plugin-cli 2.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.
@@ -0,0 +1,13 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Motrix plugin scaffolded by `motrix-plugin init`.
4
+
5
+ ## Develop
6
+ ```
7
+ motrix-plugin dev
8
+ ```
9
+
10
+ ## Pack
11
+ ```
12
+ motrix-plugin pack
13
+ ```
@@ -0,0 +1,13 @@
1
+ import { build } from 'esbuild'
2
+
3
+ await build({
4
+ entryPoints: ['src/index.ts'],
5
+ bundle: true,
6
+ format: 'esm',
7
+ target: 'es2020',
8
+ platform: 'neutral',
9
+ outfile: 'dist/plugin.js',
10
+ external: ['motrix:plugin-api'],
11
+ minify: true,
12
+ treeShaking: true,
13
+ })
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "description": "Edit motrix-plugin.json description"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "description": "请编辑 motrix-plugin.json description"
4
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://motrix.app/schemas/plugin/v1.json",
3
+ "manifestVersion": 1,
4
+ "id": "{{PLUGIN_ID}}",
5
+ "name": "%name%",
6
+ "version": "0.1.0",
7
+ "description": "%description%",
8
+ "categories": ["site-resolver"],
9
+ "engines": { "motrix": ">=2.0.0 <3.0.0" },
10
+ "main": "dist/plugin.js",
11
+ "permissions": ["http"],
12
+ "hostPermissions": ["https://example.com/*"],
13
+ "activationEvents": ["onTaskType:http"],
14
+ "contributes": {
15
+ "hooks": { "beforeCreate": { "role": "resolve" } }
16
+ },
17
+ "l10n": "locales"
18
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "scripts": {
7
+ "build": "node esbuild.config.mjs",
8
+ "pack": "motrix-plugin pack",
9
+ "dev": "motrix-plugin dev"
10
+ },
11
+ "devDependencies": {
12
+ "@motrix/plugin-api": "^2.0.0",
13
+ "@motrix/plugin-cli": "^2.0.0",
14
+ "esbuild": "^0.24",
15
+ "typescript": "^5.6"
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ import { hooks, log } from 'motrix:plugin-api'
2
+
3
+ hooks.beforeCreate(async (ctx) => {
4
+ log.info('resolving', { uri: ctx.uris[0] })
5
+ // TODO: rewrite ctx via ctx.update(...)
6
+ return ctx
7
+ })
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": ["ES2022", "DOM"],
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "types": ["@motrix/plugin-api"]
11
+ },
12
+ "include": ["src"]
13
+ }
@@ -0,0 +1,13 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Motrix plugin scaffolded by `motrix-plugin init`.
4
+
5
+ ## Develop
6
+ ```
7
+ motrix-plugin dev
8
+ ```
9
+
10
+ ## Pack
11
+ ```
12
+ motrix-plugin pack
13
+ ```
@@ -0,0 +1,13 @@
1
+ import { build } from 'esbuild'
2
+
3
+ await build({
4
+ entryPoints: ['src/index.ts'],
5
+ bundle: true,
6
+ format: 'esm',
7
+ target: 'es2020',
8
+ platform: 'neutral',
9
+ outfile: 'dist/plugin.js',
10
+ external: ['motrix:plugin-api'],
11
+ minify: true,
12
+ treeShaking: true,
13
+ })
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "description": "Edit motrix-plugin.json description"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "description": "请编辑 motrix-plugin.json description"
4
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://motrix.app/schemas/plugin/v1.json",
3
+ "manifestVersion": 1,
4
+ "id": "{{PLUGIN_ID}}",
5
+ "name": "%name%",
6
+ "version": "0.1.0",
7
+ "description": "%description%",
8
+ "categories": ["post-action"],
9
+ "engines": { "motrix": ">=2.0.0 <3.0.0" },
10
+ "main": "dist/plugin.js",
11
+ "permissions": ["notify"],
12
+ "activationEvents": ["onStartup"],
13
+ "contributes": {
14
+ "hooks": { "afterComplete": { "role": "post-process" } }
15
+ },
16
+ "l10n": "locales"
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "scripts": {
7
+ "build": "node esbuild.config.mjs",
8
+ "pack": "motrix-plugin pack",
9
+ "dev": "motrix-plugin dev"
10
+ },
11
+ "devDependencies": {
12
+ "@motrix/plugin-api": "^2.0.0",
13
+ "@motrix/plugin-cli": "^2.0.0",
14
+ "esbuild": "^0.24",
15
+ "typescript": "^5.6"
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ import { hooks, log, notify } from 'motrix:plugin-api'
2
+
3
+ hooks.afterComplete(async (ctx) => {
4
+ log.info('completed', { task: ctx.task.id })
5
+ if (notify.available) {
6
+ await notify.show({ title: '%name%', body: `Done: ${ctx.filePath}` })
7
+ }
8
+ })
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": ["ES2022", "DOM"],
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "types": ["@motrix/plugin-api"]
11
+ },
12
+ "include": ["src"]
13
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@motrix/plugin-cli",
3
+ "version": "2.0.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "motrix-plugin": "dist/bin/motrix-plugin.js",
7
+ "create-motrix-plugin": "dist/bin/create-motrix-plugin.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/motrixapp/plugin-sdk.git",
18
+ "directory": "packages/plugin-cli"
19
+ },
20
+ "license": "MIT",
21
+ "dependencies": {
22
+ "chokidar": "^4",
23
+ "commander": "^12",
24
+ "esbuild": "^0.24",
25
+ "yazl": "^2"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^24",
29
+ "tsup": "^8",
30
+ "typescript": "^5.6",
31
+ "vitest": "^3",
32
+ "zod": "^4",
33
+ "@motrix/plugin-manifest-schema": "2.0.0"
34
+ },
35
+ "scripts": {
36
+ "build": "tsup",
37
+ "typecheck": "tsc --noEmit",
38
+ "test": "vitest run"
39
+ }
40
+ }