@penvhq/cli 0.12.0 → 0.13.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/dist/bin.cjs CHANGED
@@ -50926,6 +50926,7 @@ function escapeArgument(argument, doubleEscape) {
50926
50926
  // src/install.ts
50927
50927
  var RUNTIME_PACKAGE = "@penvhq/penv";
50928
50928
  var SCHEMA_PACKAGE = "zod";
50929
+ var TYPES_PACKAGE = "@penvhq/core";
50929
50930
  var LOCKFILES = [
50930
50931
  ["pnpm", "pnpm-lock.yaml"],
50931
50932
  ["yarn", "yarn.lock"],
@@ -51151,6 +51152,7 @@ function stepFor(manager, manifest, packages, options) {
51151
51152
  manifest,
51152
51153
  packages,
51153
51154
  command: addCommand(manager, options, specs),
51155
+ dev: options.dev,
51154
51156
  satisfied: pending.length === 0
51155
51157
  };
51156
51158
  }
@@ -51162,6 +51164,7 @@ function planInstall(root, version2 = engineVersion()) {
51162
51164
  const workspaceRoot = manager === "pnpm" && isPnpmWorkspaceRoot(root);
51163
51165
  const runtime = declaredIn(root, RUNTIME_PACKAGE);
51164
51166
  const zod = declaredIn(root, SCHEMA_PACKAGE);
51167
+ const types = declaredIn(root, TYPES_PACKAGE);
51165
51168
  const packages = [
51166
51169
  {
51167
51170
  name: RUNTIME_PACKAGE,
@@ -51178,12 +51181,21 @@ function planInstall(root, version2 = engineVersion()) {
51178
51181
  satisfied: zod !== void 0
51179
51182
  }
51180
51183
  ];
51184
+ const typesPackage = {
51185
+ name: TYPES_PACKAGE,
51186
+ version: version2,
51187
+ ...types === void 0 ? {} : { declared: types.version },
51188
+ // Any declared version counts, for zod's reason: the augmentation binds on
51189
+ // the module resolving, not on which release of it a project pinned.
51190
+ satisfied: types !== void 0
51191
+ };
51181
51192
  const pending = packages.filter((entry) => !entry.satisfied);
51182
51193
  const steps = [
51183
51194
  stepFor(manager, "package.json", packages, {
51184
51195
  workspaceRoot,
51185
51196
  dev: runtime?.dev === true && pending.every((entry) => entry.name === RUNTIME_PACKAGE) && pending.length > 0
51186
- })
51197
+ }),
51198
+ stepFor(manager, "package.json", [typesPackage], { workspaceRoot, dev: true })
51187
51199
  ];
51188
51200
  for (const dir of workspaceMembers(root, RUNTIME_PACKAGE)) {
51189
51201
  const declared = declaredIn(dir, RUNTIME_PACKAGE);
@@ -51222,14 +51234,22 @@ function installedPackages(plan2) {
51222
51234
  const pending = plan2.steps.flatMap((step) => step.packages).filter((entry) => !entry.satisfied);
51223
51235
  return [...new Map(pending.map((entry) => [entry.name, entry])).values()];
51224
51236
  }
51237
+ function plannedPackages(plan2) {
51238
+ const all = plan2.steps.flatMap((step) => step.packages);
51239
+ return [...new Map(all.map((entry) => [entry.name, entry])).values()];
51240
+ }
51241
+ function series(values) {
51242
+ return values.length < 2 ? values[0] ?? "" : `${values.slice(0, -1).join(", ")} and ${values.at(-1)}`;
51243
+ }
51225
51244
  function renderStep(step) {
51226
51245
  const pending = step.packages.filter((entry) => !entry.satisfied);
51227
51246
  const added = pending.filter((entry) => entry.declared === void 0);
51228
51247
  const replaced = pending.filter((entry) => entry.declared !== void 0);
51248
+ const block = step.dev ? "devDependencies" : "dependencies";
51229
51249
  return [
51230
51250
  step.manifest,
51231
51251
  ...added.length === 0 ? [] : [
51232
- ' + "dependencies": {',
51252
+ ` + "${block}": {`,
51233
51253
  ...added.map((entry) => ` + "${entry.name}": "${entry.version}"`),
51234
51254
  " + }"
51235
51255
  ],
@@ -51241,9 +51261,8 @@ function renderStep(step) {
51241
51261
  }
51242
51262
  function renderInstallPlan(plan2) {
51243
51263
  if (plan2.satisfied) {
51244
- const packages = plan2.steps[0]?.packages ?? [];
51245
51264
  return [
51246
- `package.json already has ${packages.map(describe4).join(" and ")} \u2014 nothing to install.`
51265
+ `package.json already has ${series(plannedPackages(plan2).map(describe4))} \u2014 nothing to install.`
51247
51266
  ];
51248
51267
  }
51249
51268
  const pending = plan2.steps.filter((step) => !step.satisfied);