@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.
- package/LICENSE +9 -0
- package/README.md +80 -0
- package/dist/bin/create-motrix-plugin.js +56 -0
- package/dist/bin/motrix-plugin.js +15237 -0
- package/dist/templates/basic-resolver/README.md.tpl +13 -0
- package/dist/templates/basic-resolver/esbuild.config.mjs.tpl +13 -0
- package/dist/templates/basic-resolver/locales/en-US.json.tpl +4 -0
- package/dist/templates/basic-resolver/locales/zh-CN.json.tpl +4 -0
- package/dist/templates/basic-resolver/motrix-plugin.json.tpl +18 -0
- package/dist/templates/basic-resolver/package.json.tpl +17 -0
- package/dist/templates/basic-resolver/src/index.ts.tpl +7 -0
- package/dist/templates/basic-resolver/tsconfig.json.tpl +13 -0
- package/dist/templates/post-action/README.md.tpl +13 -0
- package/dist/templates/post-action/esbuild.config.mjs.tpl +13 -0
- package/dist/templates/post-action/locales/en-US.json.tpl +4 -0
- package/dist/templates/post-action/locales/zh-CN.json.tpl +4 -0
- package/dist/templates/post-action/motrix-plugin.json.tpl +17 -0
- package/dist/templates/post-action/package.json.tpl +17 -0
- package/dist/templates/post-action/src/index.ts.tpl +8 -0
- package/dist/templates/post-action/tsconfig.json.tpl +13 -0
- package/package.json +40 -0
|
@@ -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,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,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
|
+
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,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,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
|
+
}
|