@fluid-app/fluid-cli-widget 0.1.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 +41 -0
- package/dist/index.d.mts +185 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1405 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +49 -0
- package/templates/default/.oxlintrc.json +9 -0
- package/templates/default/AGENTS.md +10 -0
- package/templates/default/README.md +38 -0
- package/templates/default/fluid.widget.config.ts +9 -0
- package/templates/default/index.html +12 -0
- package/templates/default/manifest.ts +72 -0
- package/templates/default/package.json.template +37 -0
- package/templates/default/src/builder-preview.tsx +63 -0
- package/templates/default/src/index.ts +109 -0
- package/templates/default/src/preview-entry.tsx +60 -0
- package/templates/default/src/vite-env.d.ts +1 -0
- package/templates/default/src/widget-preview.tsx +17 -0
- package/templates/default/src/widgets/review-carousel/ReviewCarousel.tsx +95 -0
- package/templates/default/styles.css +173 -0
- package/templates/default/tsconfig.json +21 -0
- package/templates/default/vite.config.ts +296 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Fluid Widget CLI
|
|
2
|
+
|
|
3
|
+
`@fluid-app/fluid-cli-widget` provides the dedicated workflow for standalone Fluid widget packages owned by existing Droplets.
|
|
4
|
+
|
|
5
|
+
Droplets are not created by this CLI. Create and approve the Droplet first, then pass its UUID with `--droplet` or save it in `fluid.widget.config.ts` with `fluid widget link`.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
fluid widget create my-widget --droplet <uuid>
|
|
11
|
+
fluid widget link --droplet <uuid>
|
|
12
|
+
pnpm dev
|
|
13
|
+
fluid widget build
|
|
14
|
+
fluid widget publish
|
|
15
|
+
fluid widget status
|
|
16
|
+
fluid widget logs
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- `fluid widget create <project-name>` — scaffold a standalone widget package project.
|
|
20
|
+
- `fluid widget link` — link the current project to an existing Droplet and package name.
|
|
21
|
+
- `pnpm dev` — run the generated project's local Vite preview for widget development.
|
|
22
|
+
- `fluid widget build` — validate and build runtime artifacts into `.fluid/widget-dist`.
|
|
23
|
+
- `fluid widget publish` — publish a droplet-owned widget package version.
|
|
24
|
+
- `fluid widget status` — show published widget package status for a Droplet.
|
|
25
|
+
- `fluid widget logs` — show recent widget package publish logs for a Droplet.
|
|
26
|
+
|
|
27
|
+
`fluid widget validate` is also available for checking package metadata without building.
|
|
28
|
+
|
|
29
|
+
## Typical workflow
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
fluid login
|
|
33
|
+
fluid widget create reviews-widget --droplet <existing-droplet-uuid>
|
|
34
|
+
cd reviews-widget
|
|
35
|
+
pnpm dev
|
|
36
|
+
fluid widget build
|
|
37
|
+
fluid widget publish
|
|
38
|
+
fluid widget status
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use `--dry-run` with `fluid widget publish` to build and inspect the upload payload without creating a widget package version.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { ValidatedWidgetPackageBuild, WidgetPackageValidationError } from "@fluid-app/fluid-cli-portal";
|
|
3
|
+
import { FluidPlugin } from "@fluid-app/fluid-cli";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
interface WidgetTemplateVariables {
|
|
7
|
+
readonly projectName: string;
|
|
8
|
+
readonly widgetScope: string;
|
|
9
|
+
readonly widgetPackageVersion: string;
|
|
10
|
+
readonly sdkVersion: string;
|
|
11
|
+
readonly coreVersion: string;
|
|
12
|
+
readonly fluidCliVersion: string;
|
|
13
|
+
readonly widgetCliVersion: string;
|
|
14
|
+
readonly droplet?: string;
|
|
15
|
+
}
|
|
16
|
+
interface WidgetCreateOptions {
|
|
17
|
+
readonly skipInstall?: boolean;
|
|
18
|
+
readonly outputDir?: string;
|
|
19
|
+
readonly scope?: string;
|
|
20
|
+
readonly local?: boolean;
|
|
21
|
+
readonly droplet?: string;
|
|
22
|
+
/** Initial widget package version written into manifest.ts. */
|
|
23
|
+
readonly packageVersion?: string;
|
|
24
|
+
}
|
|
25
|
+
interface WidgetLinkOptions {
|
|
26
|
+
readonly droplet?: string;
|
|
27
|
+
}
|
|
28
|
+
interface WidgetCommandOptions {
|
|
29
|
+
readonly cwd?: string;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/commands/build.d.ts
|
|
33
|
+
interface BuildWidgetOptions {
|
|
34
|
+
readonly outDir?: string;
|
|
35
|
+
readonly skipTypecheck?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface BuildWidgetPackageOptions {
|
|
38
|
+
readonly projectDir: string;
|
|
39
|
+
readonly outDir: string;
|
|
40
|
+
readonly skipTypecheck?: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface BuildWidgetPackageResult {
|
|
43
|
+
readonly outDir: string;
|
|
44
|
+
readonly packageId: string;
|
|
45
|
+
readonly version: string;
|
|
46
|
+
}
|
|
47
|
+
declare function buildWidgetPackage(options: BuildWidgetPackageOptions): Promise<BuildWidgetPackageResult>;
|
|
48
|
+
declare const buildCommand: Command;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/commands/create.d.ts
|
|
51
|
+
declare const createCommand: Command;
|
|
52
|
+
declare function createWidgetProject(projectName: string, options: WidgetCreateOptions): Promise<void>;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/commands/dev.d.ts
|
|
55
|
+
declare const DEFAULT_WIDGET_DEV_PORT = 5174;
|
|
56
|
+
declare const WIDGET_DEV_ROUTES: readonly ["/", "/builder-preview", "/__manifests__", "/__preview__", "/__runtime-entry__"];
|
|
57
|
+
interface WidgetDevOptions {
|
|
58
|
+
readonly port?: string;
|
|
59
|
+
readonly host?: boolean | string;
|
|
60
|
+
readonly mode?: string;
|
|
61
|
+
}
|
|
62
|
+
interface WidgetDevProjectSummary {
|
|
63
|
+
readonly projectDir: string;
|
|
64
|
+
readonly packageName: string;
|
|
65
|
+
readonly viteConfigPath: string;
|
|
66
|
+
readonly localUrl: string;
|
|
67
|
+
readonly target: string;
|
|
68
|
+
readonly mode: string;
|
|
69
|
+
readonly routes: readonly string[];
|
|
70
|
+
}
|
|
71
|
+
declare const devCommand: Command;
|
|
72
|
+
declare function resolveWidgetDevProject(projectDir: string, options?: WidgetDevOptions): Promise<WidgetDevProjectSummary>;
|
|
73
|
+
declare function buildViteDevArgs(options?: WidgetDevOptions): string[];
|
|
74
|
+
declare function printWidgetDevSummary(summary: WidgetDevProjectSummary): void;
|
|
75
|
+
declare function runViteDevServer(projectDir: string, options?: WidgetDevOptions): Promise<void>;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/commands/link.d.ts
|
|
78
|
+
declare const linkCommand: Command;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/commands/logs.d.ts
|
|
81
|
+
interface LogsCommandOptions {
|
|
82
|
+
readonly droplet?: string;
|
|
83
|
+
readonly limit?: string;
|
|
84
|
+
readonly json?: boolean;
|
|
85
|
+
}
|
|
86
|
+
declare const logsCommand: Command;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/commands/publish.d.ts
|
|
89
|
+
interface PublishWidgetPackageOptions {
|
|
90
|
+
readonly projectDir: string;
|
|
91
|
+
readonly outDir: string;
|
|
92
|
+
readonly droplet?: string;
|
|
93
|
+
readonly dryRun?: boolean;
|
|
94
|
+
readonly skipTypecheck?: boolean;
|
|
95
|
+
readonly client?: unknown;
|
|
96
|
+
}
|
|
97
|
+
interface PublishWidgetPackageResult {
|
|
98
|
+
readonly dryRun: boolean;
|
|
99
|
+
readonly uploaded: boolean;
|
|
100
|
+
readonly outDir: string;
|
|
101
|
+
readonly droplet?: string;
|
|
102
|
+
}
|
|
103
|
+
interface PublishWidgetPackageDependencies {
|
|
104
|
+
readonly buildWidgetPackage: (options: {
|
|
105
|
+
readonly projectDir: string;
|
|
106
|
+
readonly outDir: string;
|
|
107
|
+
}) => Promise<void>;
|
|
108
|
+
readonly uploadWidgetPackage: (options: {
|
|
109
|
+
readonly outDir: string;
|
|
110
|
+
readonly droplet?: string;
|
|
111
|
+
readonly client?: unknown;
|
|
112
|
+
}) => Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
declare function publishWidgetPackage(options: PublishWidgetPackageOptions, dependencies?: PublishWidgetPackageDependencies): Promise<PublishWidgetPackageResult>;
|
|
115
|
+
interface PublishCommandOptions {
|
|
116
|
+
readonly outDir?: string;
|
|
117
|
+
readonly droplet?: string;
|
|
118
|
+
readonly dryRun?: boolean;
|
|
119
|
+
readonly skipTypecheck?: boolean;
|
|
120
|
+
}
|
|
121
|
+
declare const publishCommand: Command;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/commands/status.d.ts
|
|
124
|
+
interface StatusCommandOptions {
|
|
125
|
+
readonly droplet?: string;
|
|
126
|
+
readonly json?: boolean;
|
|
127
|
+
}
|
|
128
|
+
declare const statusCommand: Command;
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/commands/validate.d.ts
|
|
131
|
+
interface ValidateWidgetOptions {
|
|
132
|
+
readonly json?: boolean;
|
|
133
|
+
}
|
|
134
|
+
declare const validateCommand: Command;
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/utils/config.d.ts
|
|
137
|
+
declare const WIDGET_CONFIG_FILE = "fluid.widget.config.ts";
|
|
138
|
+
interface FluidWidgetConfig {
|
|
139
|
+
readonly droplet?: string;
|
|
140
|
+
}
|
|
141
|
+
interface LoadedWidgetConfig {
|
|
142
|
+
readonly path: string;
|
|
143
|
+
readonly config: Partial<FluidWidgetConfig>;
|
|
144
|
+
}
|
|
145
|
+
declare function resolveWidgetConfigPath(projectDir: string): string;
|
|
146
|
+
declare function loadWidgetConfig(projectDir: string): Promise<LoadedWidgetConfig>;
|
|
147
|
+
declare function writeWidgetConfig(projectDir: string, config: FluidWidgetConfig): Promise<void>;
|
|
148
|
+
declare function formatWidgetConfig(config: FluidWidgetConfig): string;
|
|
149
|
+
declare function parseWidgetConfigSource(source: string): Partial<FluidWidgetConfig>;
|
|
150
|
+
declare function mergeWidgetConfig(current: Partial<FluidWidgetConfig>, updates: Partial<FluidWidgetConfig>): FluidWidgetConfig;
|
|
151
|
+
declare function validateDropletUuid(dropletUuid: string): string | undefined;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/utils/source-package.d.ts
|
|
154
|
+
declare const DEFAULT_WIDGET_OUT_DIR = ".fluid/widget-dist";
|
|
155
|
+
declare const ROOT_WIDGET_CONFIG_FILE: string;
|
|
156
|
+
interface WidgetValidationResult {
|
|
157
|
+
readonly projectDir: string;
|
|
158
|
+
readonly sourceConfigPath?: string;
|
|
159
|
+
readonly validated: ValidatedWidgetPackageBuild;
|
|
160
|
+
}
|
|
161
|
+
declare class WidgetValidationError extends Error {
|
|
162
|
+
readonly errors: readonly WidgetPackageValidationError[];
|
|
163
|
+
constructor(errors: readonly WidgetPackageValidationError[]);
|
|
164
|
+
}
|
|
165
|
+
declare function validateDropletWidgetProject(projectDir: string, packageKeyOverride?: string): Promise<WidgetValidationResult>;
|
|
166
|
+
declare function withRootWidgetConfigBridge<T>(projectDir: string, callback: () => Promise<T>, packageKeyOverride?: string): Promise<T>;
|
|
167
|
+
declare function resolveWidgetSourceConfig(projectDir: string): {
|
|
168
|
+
readonly path: string;
|
|
169
|
+
readonly relativePath: string;
|
|
170
|
+
} | undefined;
|
|
171
|
+
declare function formatValidationSuccess(result: WidgetValidationResult): string;
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/utils/validation.d.ts
|
|
174
|
+
interface WidgetCliValidationError {
|
|
175
|
+
readonly path?: string;
|
|
176
|
+
readonly message: string;
|
|
177
|
+
}
|
|
178
|
+
declare function formatValidationErrors(errors: readonly WidgetCliValidationError[]): string;
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/index.d.ts
|
|
181
|
+
declare const widgetCommand: Command;
|
|
182
|
+
declare const plugin: FluidPlugin;
|
|
183
|
+
//#endregion
|
|
184
|
+
export { type BuildWidgetOptions, type BuildWidgetPackageOptions, type BuildWidgetPackageResult, DEFAULT_WIDGET_DEV_PORT, DEFAULT_WIDGET_OUT_DIR, type FluidWidgetConfig, type LoadedWidgetConfig, type LogsCommandOptions, type PublishCommandOptions, type PublishWidgetPackageDependencies, type PublishWidgetPackageOptions, type PublishWidgetPackageResult, ROOT_WIDGET_CONFIG_FILE, type StatusCommandOptions, type ValidateWidgetOptions, WIDGET_CONFIG_FILE, WIDGET_DEV_ROUTES, type WidgetCliValidationError, type WidgetCommandOptions, type WidgetCreateOptions, type WidgetDevOptions, type WidgetDevProjectSummary, type WidgetLinkOptions, type WidgetTemplateVariables, WidgetValidationError, type WidgetValidationResult, buildCommand, buildViteDevArgs, buildWidgetPackage, createCommand, createWidgetProject, plugin as default, devCommand, formatValidationErrors, formatValidationSuccess, formatWidgetConfig, linkCommand, loadWidgetConfig, logsCommand, mergeWidgetConfig, parseWidgetConfigSource, printWidgetDevSummary, publishCommand, publishWidgetPackage, resolveWidgetConfigPath, resolveWidgetDevProject, resolveWidgetSourceConfig, runViteDevServer, statusCommand, validateCommand, validateDropletUuid, validateDropletWidgetProject, widgetCommand, withRootWidgetConfigBridge, writeWidgetConfig };
|
|
185
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/commands/build.ts","../src/commands/create.ts","../src/commands/dev.ts","../src/commands/link.ts","../src/commands/logs.ts","../src/commands/publish.ts","../src/commands/status.ts","../src/commands/validate.ts","../src/utils/config.ts","../src/utils/source-package.ts","../src/utils/validation.ts","../src/index.ts"],"mappings":";;;;;UAAiB,uBAAA;EAAA,SACN,WAAA;EAAA,SACA,WAAA;EAAA,SACA,oBAAA;EAAA,SACA,UAAA;EAAA,SACA,WAAA;EAAA,SACA,eAAA;EAAA,SACA,gBAAA;EA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