@s2script/sdk 0.11.0 → 0.12.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 +53 -0
- package/dist/cli.js +3836 -370
- package/package.json +3 -2
- package/sound.d.ts +17 -2
package/README.md
CHANGED
|
@@ -34,6 +34,59 @@ per-capability subpaths (`@s2script/sdk/entity`, `@s2script/sdk/timers`, `@s2scr
|
|
|
34
34
|
game-specific schema types ship separately in
|
|
35
35
|
[`@s2script/cs2`](https://www.npmjs.com/package/@s2script/cs2).
|
|
36
36
|
|
|
37
|
+
## Workspaces
|
|
38
|
+
|
|
39
|
+
A directory whose root `package.json` carries an `s2script.workspace.plugins` glob list — next to
|
|
40
|
+
npm's own `workspaces` field — is a **workspace**: a repo holding several plugins that build,
|
|
41
|
+
publish, and version together.
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"name": "my-server-plugins",
|
|
46
|
+
"private": true,
|
|
47
|
+
"workspaces": ["plugins/*", "packages/*"],
|
|
48
|
+
"s2script": { "workspace": { "plugins": ["plugins/*"] } }
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx @s2script/sdk create --workspace my-server-plugins
|
|
54
|
+
cd my-server-plugins
|
|
55
|
+
npx @s2script/sdk create shop # detects the workspace, writes plugins/shop (no per-plugin devDeps)
|
|
56
|
+
npm install # links every member into node_modules
|
|
57
|
+
npx @s2script/sdk build # every plugin, dependency order; --filter <pattern> to narrow
|
|
58
|
+
npx @s2script/sdk deploy # build + publish, skipping `private` and already-shipped versions
|
|
59
|
+
npx @s2script/sdk version # applies pending changesets, cascading sibling version ranges
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Finding no `s2script.workspace` marker above the target directory, every command behaves exactly as
|
|
63
|
+
it does today — workspace mode is opt-in by construction. `s2s build <one-plugin-dir>` (naming a
|
|
64
|
+
specific plugin rather than the root) always stays single-plugin mode even inside a workspace;
|
|
65
|
+
`--filter` is the workspace-mode way to narrow to a subset, by package name (`@me/shop`, `@me/*`) or
|
|
66
|
+
by path glob (`plugins/sh*`). `--stamp-version <v>` (build-only) rewrites every plugin's version
|
|
67
|
+
*and* the sibling ranges that would otherwise break.
|
|
68
|
+
|
|
69
|
+
**Sibling interfaces need no `.s2script/types/` copy.** npm already symlinks every workspace member
|
|
70
|
+
into `node_modules` — declared as a dependency or not — so a consumer's `import type { ShopAPI }
|
|
71
|
+
from "@me/shop"` resolves straight to `@me/shop`'s own published `types` file under
|
|
72
|
+
`moduleResolution: "bundler"`, no config and no copy required. Contrast this with depending on a
|
|
73
|
+
**registry** package (`s2s add @edge/admin-core`): that pulls the producer's `.d.ts` down into your
|
|
74
|
+
own `.s2script/types/<dep>/index.d.ts`, because a registry producer isn't sitting in the same
|
|
75
|
+
checkout — a byte-copy (hashed into `manifest.compiledAgainst`, re-verified against the producer's
|
|
76
|
+
published hash at load) is the only way your build can see its shape at all, and it goes stale the
|
|
77
|
+
moment the producer's interface changes until you re-run `s2s add`. A workspace sibling's contract
|
|
78
|
+
can never go stale that way: the file your build resolves to *is* the producer's current contract,
|
|
79
|
+
on the same disk, in the same commit. If a plugin still carries a pre-migration
|
|
80
|
+
`.s2script/types/<dep>/` copy after joining a workspace, the live sibling wins and the build warns
|
|
81
|
+
that the copy is now dead weight.
|
|
82
|
+
|
|
83
|
+
**`private: true` means built, never published.** Ordinary npm/Changesets semantics, not a new
|
|
84
|
+
field: `s2s build` builds every plugin in a workspace regardless of `private`, but `s2s deploy`
|
|
85
|
+
prints a per-plugin plan that skips a `private: true` package by name instead of shipping it. That's
|
|
86
|
+
what lets a workspace hold a large first-party or in-house plugin suite that must never reach the
|
|
87
|
+
public registry — build it, drop the `.s2sp`s into your own server, never `s2s deploy` it. (`s2s
|
|
88
|
+
deploy <dir>` on a single private plugin outside a workspace refuses the same way.)
|
|
89
|
+
|
|
37
90
|
## Docs
|
|
38
91
|
|
|
39
92
|
**[s2script.com/docs](https://s2script.com/docs)** — getting started, guides, and the full API
|