@s2script/sdk 0.27.1 → 0.29.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 +82 -1
- package/commands.d.ts +1 -1
- package/dist/cli.js +4132 -745
- package/package.json +3 -1
- package/phrases.d.ts +1 -1
- package/plugins.d.ts +31 -1
- package/unsafe.d.ts +3 -3
package/README.md
CHANGED
|
@@ -113,7 +113,88 @@ field: `s2s build` builds every plugin in a workspace regardless of `private`, b
|
|
|
113
113
|
prints a per-plugin plan that skips a `private: true` package by name instead of shipping it. That's
|
|
114
114
|
what lets a workspace hold a large first-party or in-house plugin suite that must never reach the
|
|
115
115
|
public registry — build it, drop the `.s2sp`s into your own server, never `s2s deploy` it. (`s2s
|
|
116
|
-
deploy <dir>` on a single private plugin outside a workspace refuses the same way.)
|
|
116
|
+
deploy <dir>` on a single private plugin outside a workspace refuses the same way.) To publish a
|
|
117
|
+
package that only your org can see, use npm's other mechanism, `access`, instead (see Publishing).
|
|
118
|
+
|
|
119
|
+
### Bundles
|
|
120
|
+
|
|
121
|
+
A workspace whose plugins only make sense together (a game mode split into several plugins) can
|
|
122
|
+
publish as one **bundle**: the registry lists it as a single entry, installs it with one command,
|
|
123
|
+
and records which member versions each release pinned. Make the workspace root the bundle:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"name": "@edge/jailbreak",
|
|
128
|
+
"version": "1.0.0",
|
|
129
|
+
"workspaces": ["plugins/*"],
|
|
130
|
+
"s2script": {
|
|
131
|
+
"kind": "bundle",
|
|
132
|
+
"workspace": { "plugins": ["plugins/*"] },
|
|
133
|
+
"bundle": { "optional": ["@edge/jailbreak-gangperks"] }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- **Members** are the workspace's non-private plugins, and must share the bundle's scope. A bundle
|
|
139
|
+
has no code of its own, so the root has no `main` and must not be `private`.
|
|
140
|
+
- **`s2s deploy`** at the root publishes the members first, each claiming the bundle, then the
|
|
141
|
+
bundle itself, pinning every member to the version just built. The plan shows it as the last row.
|
|
142
|
+
A bundle version already published with different member versions is refused before anything
|
|
143
|
+
uploads — bump it.
|
|
144
|
+
- **`s2s version`** bumps the bundle whenever a member is released, by the largest member bump.
|
|
145
|
+
- **`s2s install @edge/jailbreak`** installs the required members (and whatever they depend on);
|
|
146
|
+
`--with @edge/jailbreak-gangperks` adds an optional one. `s2s add` refuses a bundle: depend on a
|
|
147
|
+
member's interface instead.
|
|
148
|
+
- A plugin already published **before** it joined a bundle must be republished at a new version
|
|
149
|
+
from the bundle's workspace, so that its registry entry carries the claim.
|
|
150
|
+
|
|
151
|
+
The membership claim travels in the registry upload only — the `.s2sp` manifest the runtime loads
|
|
152
|
+
is unchanged, and the runtime has no notion of bundles.
|
|
153
|
+
|
|
154
|
+
## Publishing
|
|
155
|
+
|
|
156
|
+
`s2s deploy` builds the package and publishes it to the registry. Its page on s2script.com
|
|
157
|
+
is filled in from what you already keep beside your code:
|
|
158
|
+
|
|
159
|
+
- **README:** `README.md` next to `package.json` (found the way npm finds one, up to 100,000
|
|
160
|
+
characters). Each deploy that carries one replaces the page's README.
|
|
161
|
+
- **Source link:** package.json's standard `repository` field, in any npm form.
|
|
162
|
+
`{ "url": …, "directory": … }` links straight into a monorepo directory.
|
|
163
|
+
- **Config:** the `s2script.config` block, shown as a table of options with their defaults.
|
|
164
|
+
Options marked `"sensitive": true` keep their default off the page.
|
|
165
|
+
|
|
166
|
+
The README and `repository` travel with the deploy, not inside the `.s2sp`: the runtime never sees
|
|
167
|
+
them. A deploy without them leaves what the page already shows, so a README or link set on the
|
|
168
|
+
site stays until a deploy replaces it.
|
|
169
|
+
|
|
170
|
+
**Source.** Like `npm publish`, every deploy also uploads the package's source as an npm-shaped
|
|
171
|
+
tarball (every file under `package/`), downloadable from the package page. Files are chosen with
|
|
172
|
+
npm's own rules: package.json `files` if present, otherwise everything minus `.npmignore` (or
|
|
173
|
+
`.gitignore` where there is no `.npmignore`); package.json, README and LICENSE are always in;
|
|
174
|
+
`node_modules`, `.git`, `.npmrc` and lockfiles never are. One deliberate difference: `.env` files
|
|
175
|
+
are never packed. `s2s pack --dry-run` lists exactly what a deploy would send, and `s2s pack`
|
|
176
|
+
writes the tarball (`<scope>-<name>-<version>.tgz`). The source of a public package is public, so
|
|
177
|
+
check that list before the first deploy.
|
|
178
|
+
|
|
179
|
+
**Restricted packages.** As on npm, a scoped package can be published **restricted**: only the
|
|
180
|
+
members of its org can see or install it, and everyone else gets a 404. Use
|
|
181
|
+
`s2s deploy --access restricted`, or `"publishConfig": { "access": "restricted" }` in package.json
|
|
182
|
+
(the flag wins). Access is fixed when the package is first published. A deploy that names none
|
|
183
|
+
keeps the current one. Before uploading, the CLI checks that the registry can keep the package
|
|
184
|
+
restricted, and refuses otherwise, so it never goes out public by accident. `s2s install` and
|
|
185
|
+
`s2s add` send your login, so members install restricted packages as usual. A server that only
|
|
186
|
+
installs should use a read-only token (s2script.com → Deploy tokens) as `S2SCRIPT_TOKEN`.
|
|
187
|
+
|
|
188
|
+
## Servers
|
|
189
|
+
|
|
190
|
+
A game server lists its registry plugins as npm-style `dependencies` in
|
|
191
|
+
`addons/s2script/plugins.json`, with a `plugins-lock.json` beside it. These are npm's shapes under
|
|
192
|
+
their own names, so npm never treats the folder as a Node project. From the game directory,
|
|
193
|
+
`s2s install <name>[@range]` adds a plugin (creating `plugins.json` the first time, like npm). Plain
|
|
194
|
+
`s2s install` installs exactly the lock, and `s2s update` moves each plugin to the newest version
|
|
195
|
+
its range allows. `s2s server init` writes both files from plugins already installed. The runtime
|
|
196
|
+
runs the same update at every startup before loading plugins (`"autoUpdate": false` turns it off).
|
|
197
|
+
See [INSTALL.md](https://github.com/s2script/s2script/blob/main/docs/INSTALL.md).
|
|
117
198
|
|
|
118
199
|
## Docs
|
|
119
200
|
|
package/commands.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface CommandInvocation {
|
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* // `!help` answers in chat; `sm_help` typed at a console answers in that console.
|
|
60
|
-
* command("sm_help", (cmd) => { cmd.reply("[
|
|
60
|
+
* command("sm_help", (cmd) => { cmd.reply("[S2S] Commands: …"); return HookResult.Handled; });
|
|
61
61
|
*/
|
|
62
62
|
reply(message: string): void;
|
|
63
63
|
/**
|