create-deck-plugin 1.7.0 → 1.8.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/index.mjs +9 -2
- package/package.json +1 -1
- package/template/AGENTS.md +5 -1
- package/template/LICENSE +21 -0
- package/template/plugin.json +10 -9
package/index.mjs
CHANGED
|
@@ -52,13 +52,19 @@ cpSync(sdkTemplate, dir, { recursive: true });
|
|
|
52
52
|
// npm refuses to publish a file called .gitignore, so the template ships it renamed.
|
|
53
53
|
if (existsSync(join(dir, "gitignore"))) renameSync(join(dir, "gitignore"), join(dir, ".gitignore"));
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
// Who the licence names: the git identity this machine commits as, which is who will publish it.
|
|
56
|
+
let author = "the author";
|
|
57
|
+
try { author = execFileSync("git", ["config", "user.name"], { stdio: ["ignore", "pipe", "ignore"] }).toString().trim() || author; } catch { /* no git identity yet */ }
|
|
58
|
+
|
|
59
|
+
for (const rel of ["plugin.json", "package.json", "src/plugin.tsx", "README.md", "AGENTS.md", "LICENSE"]) {
|
|
56
60
|
const p = join(dir, rel);
|
|
57
61
|
if (!existsSync(p)) continue;
|
|
58
62
|
writeFileSync(p, readFileSync(p, "utf8")
|
|
59
63
|
.replaceAll("__ID__", id)
|
|
60
64
|
.replaceAll("__NAME__", name)
|
|
61
|
-
.replaceAll("__COMPONENT__", component)
|
|
65
|
+
.replaceAll("__COMPONENT__", component)
|
|
66
|
+
.replaceAll("__YEAR__", String(new Date().getFullYear()))
|
|
67
|
+
.replaceAll("__AUTHOR__", author));
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
/**
|
|
@@ -107,4 +113,5 @@ console.log(" cd " + id);
|
|
|
107
113
|
if (!installed) console.log(" npm install # this failed; run it yourself");
|
|
108
114
|
console.log(" npm run dev # rebuild as you edit; each save shows in your test Deck");
|
|
109
115
|
console.log(" npm run install-local # when it is done: install it into your real Deck");
|
|
116
|
+
console.log(" npx deck-plugin publish --dry-run # then without --dry-run: list it in Deck's registry");
|
|
110
117
|
console.log("\nStart a test Deck from Deck's Settings › Plugins › Open a test Deck.\n");
|
package/package.json
CHANGED
package/template/AGENTS.md
CHANGED
|
@@ -11,6 +11,7 @@ npm run dev # build on every save and install into the test Deck, whi
|
|
|
11
11
|
npm run build # build once into plugin.js
|
|
12
12
|
npm run install-local # build and install into the user's real Deck
|
|
13
13
|
npx deck-plugin check # validate plugin.json
|
|
14
|
+
npx deck-plugin publish --dry-run # everything the registry checks, nothing published
|
|
14
15
|
```
|
|
15
16
|
|
|
16
17
|
The test Deck is a second Deck with its own data, started with
|
|
@@ -22,7 +23,10 @@ the plugin's `console.warn` and `console.error` lines land there.
|
|
|
22
23
|
## Files
|
|
23
24
|
|
|
24
25
|
- `plugin.json`: `id` (letters, digits, dashes; it is a folder name and a config key), `name`,
|
|
25
|
-
`description`, `icon` (a lucide icon name), `color`, `version`, `minDeck
|
|
26
|
+
`description`, `icon` (a lucide icon name), `color`, `version`, `minDeck`, and `permissions`:
|
|
27
|
+
what it uses of Deck (`files`, `processes`, `git`, `network`, `terminals`, `browser`,
|
|
28
|
+
`secrets`, `system`, `deck`; the table is `node_modules/deck-plugin-sdk/permissions.json`). A
|
|
29
|
+
bridge call outside them throws, naming the one to add: add it rather than working around it.
|
|
26
30
|
- `src/plugin.tsx`: the entry. Its exports are what Deck uses (below).
|
|
27
31
|
- `src/mcp.ts`, if present: tools for Deck's MCP server, built to `mcp.js`.
|
|
28
32
|
- `plugin.js` (and `mcp.js`): the build's output, gitignored. Never edit them.
|
package/template/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) __YEAR__ __AUTHOR__
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/template/plugin.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "__ID__",
|
|
3
|
-
"name": "__NAME__",
|
|
4
|
-
"description": "One line on what this is for, shown under its name in Settings.",
|
|
5
|
-
"icon": "Sparkles",
|
|
6
|
-
"color": "#a78bfa",
|
|
7
|
-
"version": "0.1.0",
|
|
8
|
-
"minDeck": "1.
|
|
9
|
-
|
|
1
|
+
{
|
|
2
|
+
"id": "__ID__",
|
|
3
|
+
"name": "__NAME__",
|
|
4
|
+
"description": "One line on what this is for, shown under its name in Settings.",
|
|
5
|
+
"icon": "Sparkles",
|
|
6
|
+
"color": "#a78bfa",
|
|
7
|
+
"version": "0.1.0",
|
|
8
|
+
"minDeck": "1.8.0",
|
|
9
|
+
"permissions": []
|
|
10
|
+
}
|