webim-plugin 1.1.1 → 1.2.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/README.md +2 -2
- package/bin/webim-plugin.js +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Requires Node 18+.
|
|
|
32
32
|
```bash
|
|
33
33
|
webim-plugin init my-widget # scaffold: webim-plugin.json, src/, README
|
|
34
34
|
cd my-widget
|
|
35
|
-
webim-plugin build # esbuild ->
|
|
35
|
+
webim-plugin build # esbuild -> build/plugin.js + validation
|
|
36
36
|
webim-plugin push # build, sign in, merge into builder_plugins
|
|
37
37
|
webim-plugin dev # watch src/, rebuild + push on every change
|
|
38
38
|
```
|
|
@@ -67,7 +67,7 @@ needed).
|
|
|
67
67
|
```json
|
|
68
68
|
{
|
|
69
69
|
"entry": "src/index.js",
|
|
70
|
-
"out": "
|
|
70
|
+
"out": "build/plugin.js",
|
|
71
71
|
"api": "https://your-webim/api",
|
|
72
72
|
"tenant": "your-tenant-slug"
|
|
73
73
|
}
|
package/bin/webim-plugin.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// webim-plugin — the Web-IM builder plugin CLI.
|
|
4
4
|
//
|
|
5
5
|
// webim-plugin init [dir] scaffold a plugin project
|
|
6
|
-
// webim-plugin build bundle src/ into
|
|
6
|
+
// webim-plugin build bundle src/ into build/plugin.js and validate it
|
|
7
7
|
// webim-plugin push build + upload to the tenant's builder_plugins
|
|
8
8
|
// webim-plugin dev watch src/, rebuild and push on every change
|
|
9
9
|
//
|
|
@@ -31,12 +31,12 @@ Commands:
|
|
|
31
31
|
wrap [dir] convert an EXISTING project: add config, an adapter entry
|
|
32
32
|
(Shadow-DOM boilerplate, React-aware) and WEBIM_PLUGIN.md —
|
|
33
33
|
the plugin contract written as rules for AI assistants
|
|
34
|
-
build bundle the entry into
|
|
34
|
+
build bundle the entry into build/plugin.js and validate it
|
|
35
35
|
push build, then upload to the tenant's builder_plugins setting
|
|
36
36
|
dev watch the source; rebuild and push on every change
|
|
37
37
|
|
|
38
38
|
Config (webim-plugin.json):
|
|
39
|
-
{ "entry": "src/index.js", "out": "
|
|
39
|
+
{ "entry": "src/index.js", "out": "build/plugin.js",
|
|
40
40
|
"api": "https://webim.app/api", "tenant": "root" }
|
|
41
41
|
|
|
42
42
|
Auth (push/dev): WEBIM_TOKEN, or WEBIM_EMAIL + WEBIM_PASSWORD.`;
|
|
@@ -45,7 +45,7 @@ Auth (push/dev): WEBIM_TOKEN, or WEBIM_EMAIL + WEBIM_PASSWORD.`;
|
|
|
45
45
|
// scaffolding
|
|
46
46
|
|
|
47
47
|
const TEMPLATE_CONFIG = (name) => `${JSON.stringify(
|
|
48
|
-
{ entry: 'src/index.js', out: '
|
|
48
|
+
{ entry: 'src/index.js', out: 'build/plugin.js', api: 'https://webim.app/api', tenant: 'root' },
|
|
49
49
|
null,
|
|
50
50
|
2
|
|
51
51
|
)}\n`;
|
|
@@ -106,7 +106,7 @@ A Web-IM builder plugin. Develop:
|
|
|
106
106
|
|
|
107
107
|
\`\`\`bash
|
|
108
108
|
npm install
|
|
109
|
-
npx webim-plugin build # bundle + validate ->
|
|
109
|
+
npx webim-plugin build # bundle + validate -> build/plugin.js
|
|
110
110
|
npx webim-plugin push # upload to the tenant in webim-plugin.json
|
|
111
111
|
npx webim-plugin dev # watch + rebuild + push
|
|
112
112
|
\`\`\`
|
|
@@ -172,7 +172,7 @@ const TEMPLATE_GUIDE = (id, name, entry) => `# Web-IM plugin rules — ${name}
|
|
|
172
172
|
|
|
173
173
|
Directives for AI assistants (and humans) working on the Web-IM builder
|
|
174
174
|
plugin in this project. Follow every MUST. The plugin entry is \`${entry}\`;
|
|
175
|
-
\`npx webim-plugin build\` bundles it to \`
|
|
175
|
+
\`npx webim-plugin build\` bundles it to \`build/plugin.js\` and validates it.
|
|
176
176
|
|
|
177
177
|
## The contract
|
|
178
178
|
|
|
@@ -261,7 +261,7 @@ must have a default in \`props\`.
|
|
|
261
261
|
## Ship
|
|
262
262
|
|
|
263
263
|
\`\`\`bash
|
|
264
|
-
npx webim-plugin build # bundle + validate ->
|
|
264
|
+
npx webim-plugin build # bundle + validate -> build/plugin.js
|
|
265
265
|
npx webim-plugin push # upload to the tenant in webim-plugin.json
|
|
266
266
|
npx webim-plugin dev # watch + rebuild + push
|
|
267
267
|
\`\`\`
|
|
@@ -448,7 +448,7 @@ async function wrap(dirArg) {
|
|
|
448
448
|
|
|
449
449
|
await mkdir(path.dirname(entryFile), { recursive: true });
|
|
450
450
|
await writeFile(path.join(dir, CONFIG_FILE), `${JSON.stringify(
|
|
451
|
-
{ entry, out: '
|
|
451
|
+
{ entry, out: 'build/plugin.js', api: 'https://webim.app/api', tenant: 'root' },
|
|
452
452
|
null,
|
|
453
453
|
2
|
|
454
454
|
)}\n`);
|
|
@@ -490,7 +490,7 @@ async function loadConfig() {
|
|
|
490
490
|
|
|
491
491
|
return {
|
|
492
492
|
entry: config.entry ?? 'src/index.js',
|
|
493
|
-
out: config.out ?? '
|
|
493
|
+
out: config.out ?? 'build/plugin.js',
|
|
494
494
|
api: config.api ?? 'https://webim.app/api',
|
|
495
495
|
tenant: config.tenant ?? ''
|
|
496
496
|
};
|
package/package.json
CHANGED