mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
chore: rename the plugin sdk to @termix-ssh/plugin-sdk
This commit is contained in:
1 parent
0c4f673318
commit
e608505b39
132 files changed
+250
-1336
No files matched your search
@@ -12,14 +12,14 @@
|
||||
|
||||
## Overview
|
||||
|
||||
`@termix/plugin-sdk` is what every [Termix](https://github.com/Termix-SSH/Termix) plugin builds against, including the ones that ship with Termix. It has the types for a plugin's backend and frontend, table definitions, the manifest schema, test helpers, and the `termix-plugin` CLI. The easiest way to start is the [Termix Plugin Template](https://github.com/Termix-SSH/Termix-Plugin-Template).
|
||||
`@termix-ssh/plugin-sdk` is what every [Termix](https://github.com/Termix-SSH/Termix) plugin builds against, including the ones that ship with Termix. It has the types for a plugin's backend and frontend, table definitions, the manifest schema, test helpers, and the `termix-plugin` CLI. The easiest way to start is the [Termix Plugin Template](https://github.com/Termix-SSH/Termix-Plugin-Template).
|
||||
|
||||
<br />
|
||||
|
||||
## What's Inside
|
||||
|
||||
- **Backend:** the types for `activate(ctx)`, database and table helpers, host commands and SSH certificates
|
||||
- **Frontend:** the types for `activate(app)`, plus `@termix/plugin-sdk/ui`, the components and theme Termix serves to plugins
|
||||
- **Frontend:** the types for `activate(app)`, plus `@termix-ssh/plugin-sdk/ui`, the components and theme Termix serves to plugins
|
||||
- **Manifest:** the manifest schema, the capability catalog and settings types
|
||||
- **Testing:** `createMockCtx()`, `createTestDb()`, `renderWithApp()` and a Vitest preset
|
||||
- **CLI:** `termix-plugin`, which builds, tests, validates, packs and signs a plugin and writes its migrations
|
||||
@@ -29,7 +29,7 @@
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install --save-dev @termix/plugin-sdk
|
||||
npm install --save-dev @termix-ssh/plugin-sdk
|
||||
```
|
||||
|
||||
<br />
|
||||
|
||||
@@ -37,7 +37,7 @@ async function loadDefinitions(cwd) {
|
||||
|
||||
// Emitted inside the plugin rather than in the system temp dir: the SDK
|
||||
// stays external to the bundle, so the output has to sit somewhere node can
|
||||
// resolve @termix/plugin-sdk from.
|
||||
// resolve @termix-ssh/plugin-sdk from.
|
||||
const outdir = fs.mkdtempSync(path.join(cwd, ".termix-tables-"));
|
||||
const outfile = path.join(outdir, "tables.mjs");
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@ function validatePackage(cwd, raw) {
|
||||
}
|
||||
|
||||
const sdkRange =
|
||||
pkg.peerDependencies?.["@termix/plugin-sdk"] ??
|
||||
pkg.dependencies?.["@termix/plugin-sdk"] ??
|
||||
pkg.devDependencies?.["@termix/plugin-sdk"];
|
||||
pkg.peerDependencies?.["@termix-ssh/plugin-sdk"] ??
|
||||
pkg.dependencies?.["@termix-ssh/plugin-sdk"] ??
|
||||
pkg.devDependencies?.["@termix-ssh/plugin-sdk"];
|
||||
if (!sdkRange) {
|
||||
problems.push("package.json does not depend on @termix/plugin-sdk");
|
||||
problems.push("package.json does not depend on @termix-ssh/plugin-sdk");
|
||||
} else if (sdkRange === "*" || sdkRange === "latest") {
|
||||
problems.push(
|
||||
`@termix/plugin-sdk is "${sdkRange}"; pin a range such as "^1.0.0"`,
|
||||
`@termix-ssh/plugin-sdk is "${sdkRange}"; pin a range such as "^1.0.0"`,
|
||||
);
|
||||
}
|
||||
return problems;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
export const BACKEND_EXTERNALS = [
|
||||
"@termix/plugin-sdk",
|
||||
"@termix/plugin-sdk/*",
|
||||
"@termix-ssh/plugin-sdk",
|
||||
"@termix-ssh/plugin-sdk/*",
|
||||
"express",
|
||||
"ssh2",
|
||||
"ws",
|
||||
@@ -41,6 +41,6 @@ export const FRONTEND_EXTERNALS = [
|
||||
"i18next",
|
||||
"react-i18next",
|
||||
"sonner",
|
||||
"@termix/plugin-sdk/frontend",
|
||||
"@termix/plugin-sdk/ui",
|
||||
"@termix-ssh/plugin-sdk/frontend",
|
||||
"@termix-ssh/plugin-sdk/ui",
|
||||
];
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@termix/plugin-sdk",
|
||||
"name": "@termix-ssh/plugin-sdk",
|
||||
"version": "1.0.0",
|
||||
"description": "The contract between Termix core and a plugin: types, the capability catalog and the manifest schema.",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -213,7 +213,7 @@ export interface ShellApi {
|
||||
/**
|
||||
* Asks a yes or no question over the main area, for code that runs outside
|
||||
* a panel or tab (a keybinding, a toolbar action). Inside one, prefer
|
||||
* useConfirm from @termix/plugin-sdk/ui, which asks over that surface.
|
||||
* useConfirm from @termix-ssh/plugin-sdk/ui, which asks over that surface.
|
||||
*/
|
||||
confirm?: (options: ConfirmRequest) => Promise<boolean>;
|
||||
}
|
||||
@@ -897,7 +897,7 @@ export interface TermixApp extends TermixAppInfo {
|
||||
invokeAction: (id: string, ...args: unknown[]) => Promise<unknown>;
|
||||
/**
|
||||
* Offers a component to other plugins and to core by id, rendered where
|
||||
* they choose with `PluginComponent` from @termix/plugin-sdk/ui or
|
||||
* they choose with `PluginComponent` from @termix-ssh/plugin-sdk/ui or
|
||||
* `usePluginComponent`. The id should start with a name the plugin owns
|
||||
* ("terminal.view"). The props are the owner's contract; document them.
|
||||
*/
|
||||
@@ -941,7 +941,7 @@ export interface TermixApp extends TermixAppInfo {
|
||||
tabs: TabsApi;
|
||||
/**
|
||||
* Asks a yes or no question over the main area. For code that runs outside
|
||||
* a panel or tab; inside one, useConfirm from @termix/plugin-sdk/ui asks
|
||||
* a panel or tab; inside one, useConfirm from @termix-ssh/plugin-sdk/ui asks
|
||||
* over that surface instead.
|
||||
*/
|
||||
confirm: (options: ConfirmRequest) => Promise<boolean>;
|
||||
@@ -1190,7 +1190,7 @@ let host: PluginHostBridge | null = null;
|
||||
export function __setPluginHost(bridge: PluginHostBridge | null): void {
|
||||
if (host && bridge !== host) {
|
||||
throw new Error(
|
||||
"@termix/plugin-sdk/frontend: the plugin host is already set",
|
||||
"@termix-ssh/plugin-sdk/frontend: the plugin host is already set",
|
||||
);
|
||||
}
|
||||
host = bridge;
|
||||
@@ -1209,7 +1209,7 @@ function requireHost(): PluginHostBridge {
|
||||
if (!host && fallback) return fallback;
|
||||
if (!host) {
|
||||
throw new Error(
|
||||
"@termix/plugin-sdk/frontend: no plugin host. Hooks only work inside Termix or renderWithApp().",
|
||||
"@termix-ssh/plugin-sdk/frontend: no plugin host. Hooks only work inside Termix or renderWithApp().",
|
||||
);
|
||||
}
|
||||
return host;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* real runtime does. createFakeContext stays for tests that only need a
|
||||
* context-shaped object and do not care about the gates.
|
||||
*
|
||||
* The vitest config these run under comes from @termix/plugin-sdk/vitest-preset.
|
||||
* The vitest config these run under comes from @termix-ssh/plugin-sdk/vitest-preset.
|
||||
*/
|
||||
|
||||
import {
|
||||
@@ -2080,7 +2080,7 @@ export async function createTestDb(
|
||||
* so a test sees exactly what the shell would: which rail items, tabs, host
|
||||
* actions and cards it registered, and each of those rendered with the SDK
|
||||
* hooks working. It is implemented by the Termix host, which is where the
|
||||
* registries live; the vitest preset points "@termix/plugin-host/testing" at
|
||||
* registries live; the vitest preset points "@termix-ssh/plugin-host/testing" at
|
||||
* core's implementation.
|
||||
*/
|
||||
export interface RenderWithAppOptions {
|
||||
@@ -2205,7 +2205,7 @@ interface PluginTestHost {
|
||||
) => Promise<RenderedPluginApp>;
|
||||
}
|
||||
|
||||
const TEST_HOST = "@termix/plugin-host/testing";
|
||||
const TEST_HOST = "@termix-ssh/plugin-host/testing";
|
||||
|
||||
export async function renderWithApp(
|
||||
plugin: FrontendPluginModule,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* A plugin's vitest.config.ts is one line:
|
||||
*
|
||||
* import { pluginVitestConfig } from "@termix/plugin-sdk/vitest-preset";
|
||||
* import { pluginVitestConfig } from "@termix-ssh/plugin-sdk/vitest-preset";
|
||||
* export default pluginVitestConfig(import.meta.url);
|
||||
*
|
||||
* Two projects: tests/backend runs in node, tests/frontend in jsdom.
|
||||
@@ -56,21 +56,21 @@ export function pluginVitestConfig(
|
||||
const alias: Record<string, string> = {
|
||||
...(repoRoot
|
||||
? {
|
||||
"@termix/plugin-sdk/frontend": path.join(
|
||||
"@termix-ssh/plugin-sdk/frontend": path.join(
|
||||
repoRoot,
|
||||
"packages",
|
||||
"plugin-sdk",
|
||||
"src",
|
||||
"frontend.ts",
|
||||
),
|
||||
"@termix/plugin-sdk/ui": path.join(
|
||||
"@termix-ssh/plugin-sdk/ui": path.join(
|
||||
repoRoot,
|
||||
"src",
|
||||
"ui",
|
||||
"plugin-host",
|
||||
"sdk-ui.ts",
|
||||
),
|
||||
"@termix/plugin-host/testing": path.join(
|
||||
"@termix-ssh/plugin-host/testing": path.join(
|
||||
repoRoot,
|
||||
"src",
|
||||
"ui",
|
||||
@@ -85,7 +85,7 @@ export function pluginVitestConfig(
|
||||
: {
|
||||
// Outside a Termix checkout: the UI kit resolves through the
|
||||
// package, and the test host is the copy the SDK ships.
|
||||
"@termix/plugin-host/testing": fileURLToPath(
|
||||
"@termix-ssh/plugin-host/testing": fileURLToPath(
|
||||
new URL("./host/testing-host.js", import.meta.url),
|
||||
),
|
||||
}),
|
||||
@@ -119,8 +119,8 @@ export function pluginVitestConfig(
|
||||
setupFiles: [setupFile],
|
||||
// Run the SDK through Vite rather than plain Node, so its import
|
||||
// of the test host sees the alias above and the plugin and the
|
||||
// host share one copy of @termix/plugin-sdk/frontend.
|
||||
server: { deps: { inline: [/@termix\/plugin-sdk/] } },
|
||||
// host share one copy of @termix-ssh/plugin-sdk/frontend.
|
||||
server: { deps: { inline: [/@termix-ssh\/plugin-sdk/] } },
|
||||
include: ["tests/frontend/**/*.test.{ts,tsx}"],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user