@fluid-app/fluid-cli-widget 0.1.35 → 0.1.37

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.
@@ -51,7 +51,7 @@ Options:
51
51
  "droplet")
52
52
  --package-version <version> Initial widget package version (default:
53
53
  "0.1.0")
54
- --local Use local monorepo packages via file: links (for
54
+ --local Use local monorepo packages via link: paths (for
55
55
  development testing)
56
56
  --remote-template Use the GitHub starter template instead of the
57
57
  bundled template
package/dist/index.mjs CHANGED
@@ -574,9 +574,9 @@ function isRecord$3(value) {
574
574
  }
575
575
  //#endregion
576
576
  //#region src/utils/template.ts
577
- const EMBEDDED_PORTAL_SDK_VERSION = "0.1.470";
577
+ const EMBEDDED_PORTAL_SDK_VERSION = "0.1.477";
578
578
  const EMBEDDED_CLI_CORE_VERSION = "0.1.17";
579
- const EMBEDDED_CLI_WIDGET_VERSION = "0.1.35";
579
+ const EMBEDDED_CLI_WIDGET_VERSION = "0.1.37";
580
580
  function getDefaultTemplatePath() {
581
581
  return path.join(findPackageRoot(), "templates", "default");
582
582
  }
@@ -615,7 +615,7 @@ async function getWorkspacePackageVersion(packagePathSegments, embeddedVersion,
615
615
  const packageRoot = findPackageRoot();
616
616
  const packagesRoot = path.join(packageRoot, "..", "..");
617
617
  const targetPackageRoot = path.join(packagesRoot, ...packagePathSegments);
618
- if (options.local) return `link:${(options.targetPath ? path.relative(options.targetPath, targetPackageRoot) : targetPackageRoot).replace(/\\/g, "/") || "."}`;
618
+ if (options.local) return getLocalPackageLinkVersion(targetPackageRoot);
619
619
  if (embeddedVersion) return embeddedVersion;
620
620
  const packageJsonPath = path.join(targetPackageRoot, "package.json");
621
621
  const content = await readFile(packageJsonPath, "utf-8");
@@ -627,6 +627,18 @@ async function getWorkspacePackageVersion(packagePathSegments, embeddedVersion,
627
627
  throw new Error(`Could not resolve the exact template package version for ${packagePathSegments.join("/")}`, { cause: error });
628
628
  }
629
629
  }
630
+ /**
631
+ * Builds an absolute pnpm link: specifier for local scaffolds.
632
+ *
633
+ * link: keeps the dependency pointed at the workspace package source instead of
634
+ * packing only package.json "files" entries like file: does. That lets Vite's
635
+ * development export resolve the SDK source and its workspace dependencies. An
636
+ * absolute path also remains valid when the operating system canonicalizes the
637
+ * generated project path, such as macOS resolving /tmp to /private/tmp.
638
+ */
639
+ function getLocalPackageLinkVersion(packagePath) {
640
+ return `link:${path.resolve(packagePath).replace(/\\/g, "/")}`;
641
+ }
630
642
  async function getFiles(dir, baseDir = dir) {
631
643
  const entries = await readdir(dir, { withFileTypes: true });
632
644
  const files = [];
@@ -2430,7 +2442,7 @@ const defaultCreateWidgetProjectDependencies = {
2430
2442
  installDependencies,
2431
2443
  tryFetchGithubTemplate
2432
2444
  };
2433
- const createCommand = new Command("create").description("Create a standalone Fluid widget project").argument("<project-name>", "Name of the widget project to create").option("--skip-install", "Create the scaffold only; skip dependency installation").option("-o, --output-dir <dir>", "Directory to create the project in (defaults to cwd)").option("--scope <scope>", "Widget package scope/namespace", DEFAULT_WIDGET_SCOPE).option("--package-version <version>", "Initial widget package version", DEFAULT_WIDGET_PACKAGE_VERSION).option("--local", "Use local monorepo packages via file: links (for development testing)").option("--remote-template", "Use the GitHub starter template instead of the bundled template").option("--droplet <uuid>", "Existing droplet UUID that owns the package").action(async (projectName, options) => {
2445
+ const createCommand = new Command("create").description("Create a standalone Fluid widget project").argument("<project-name>", "Name of the widget project to create").option("--skip-install", "Create the scaffold only; skip dependency installation").option("-o, --output-dir <dir>", "Directory to create the project in (defaults to cwd)").option("--scope <scope>", "Widget package scope/namespace", DEFAULT_WIDGET_SCOPE).option("--package-version <version>", "Initial widget package version", DEFAULT_WIDGET_PACKAGE_VERSION).option("--local", "Use local monorepo packages via link: paths (for development testing)").option("--remote-template", "Use the GitHub starter template instead of the bundled template").option("--droplet <uuid>", "Existing droplet UUID that owns the package").action(async (projectName, options) => {
2434
2446
  try {
2435
2447
  await createWidgetProject(projectName, options);
2436
2448
  } catch (err) {
@@ -2458,10 +2470,7 @@ async function createWidgetProject(projectName, options, dependencies = defaultC
2458
2470
  if (options.remoteTemplate !== true && !await directoryExists(templatePath)) throw new Error("Default widget template not found.");
2459
2471
  const config = mergeWidgetConfig({}, { droplet });
2460
2472
  const widgetScope = options.scope ?? DEFAULT_WIDGET_SCOPE;
2461
- const localOptions = {
2462
- local: options.local === true,
2463
- targetPath
2464
- };
2473
+ const localOptions = { local: options.local === true };
2465
2474
  const variables = {
2466
2475
  projectName,
2467
2476
  droplet: config.droplet,