@savvy-web/silk-effects 4.2.5 → 4.2.6

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.
@@ -272,20 +272,25 @@ function readRawPackageJson(fs, pkgDir) {
272
272
  }
273
273
  /**
274
274
  * Build resolved scopes from the discovered workspace packages, keeping only
275
- * those that are a release surface (declare publishConfig that yields at least
276
- * one publish target). Used both when `.changeset/config.json` declares no
277
- * explicit `packages` record AND to augment an explicit record with the
278
- * remaining workspace packages it does not list (so the record annotates the
279
- * listed packages without shrinking the release surface). The changeset
280
- * `ignore` list is intentionally NOT consulted here an ignored package still
281
- * declares publishConfig and remains a valid changeset target.
275
+ * those that are a release surface: a package that declares publishConfig
276
+ * yielding at least one publish target, OR when the changeset config sets
277
+ * `privatePackages.version: true` (`versionPrivate`) any workspace package
278
+ * at all, since changesets versions private packages too in that mode (#360:
279
+ * a private single-root repo with `privatePackages.version: true` previously
280
+ * produced an empty release surface and left every file unmapped). Used both
281
+ * when `.changeset/config.json` declares no explicit `packages` record AND to
282
+ * augment an explicit record with the remaining workspace packages it does
283
+ * not list (so the record annotates the listed packages without shrinking the
284
+ * release surface). The changeset `ignore` list is intentionally NOT
285
+ * consulted here — an ignored package still declares publishConfig and
286
+ * remains a valid changeset target.
282
287
  */
283
- function buildFallbackScopes(fs, workspaces) {
288
+ function buildFallbackScopes(fs, workspaces, versionPrivate) {
284
289
  return Effect.forEach(workspaces, (ws) => Effect.gen(function* () {
285
290
  const raw = yield* readRawPackageJson(fs, ws.path);
286
291
  if (raw === null) return [];
287
292
  const binding = yield* readTargetsBinding(fs, ws.path);
288
- if (SilkPublishability.detect(ws.name, raw, binding).length === 0) return [];
293
+ if (SilkPublishability.detect(ws.name, raw, binding).length === 0 && !versionPrivate) return [];
289
294
  return [{
290
295
  name: ws.name,
291
296
  workspaceDir: ws.path,
@@ -391,6 +396,8 @@ function makeShape(reader, discovery, fs) {
391
396
  version: w.version
392
397
  }));
393
398
  const hasExplicitPackages = Object.keys(decodedOptions.packages ?? {}).length > 0;
399
+ const privatePackages = config.privatePackages;
400
+ const versionPrivate = privatePackages !== void 0 && privatePackages !== false && privatePackages.version === true;
394
401
  let scopes;
395
402
  if (hasExplicitPackages) {
396
403
  const explicitScopes = yield* buildResolvedScopes({
@@ -406,9 +413,9 @@ function makeShape(reader, discovery, fs) {
406
413
  throw e;
407
414
  }
408
415
  const explicitNames = new Set(explicitScopes.map((s) => s.name));
409
- const discoveredScopes = yield* buildFallbackScopes(fs, workspaces.filter((w) => !explicitNames.has(w.name)));
416
+ const discoveredScopes = yield* buildFallbackScopes(fs, workspaces.filter((w) => !explicitNames.has(w.name)), versionPrivate);
410
417
  scopes = [...explicitScopes, ...discoveredScopes];
411
- } else scopes = yield* buildFallbackScopes(fs, workspaces);
418
+ } else scopes = yield* buildFallbackScopes(fs, workspaces, versionPrivate);
412
419
  const inspected = {
413
420
  configPath,
414
421
  projectDir,
@@ -442,12 +449,19 @@ function makeShape(reader, discovery, fs) {
442
449
  function classifyOne(inspected, path) {
443
450
  const abs = resolve(inspected.projectDir, path);
444
451
  let bestWorkspace = null;
445
- for (const s of inspected.packages) if (isInside(s.workspaceDir, abs)) {
446
- const depth = s.workspaceDir.length;
447
- if (!bestWorkspace || depth > bestWorkspace.depth) bestWorkspace = {
448
- pkg: s.name,
449
- depth
450
- };
452
+ let rootScope = null;
453
+ for (const s of inspected.packages) {
454
+ if (s.workspaceDir === inspected.projectDir) {
455
+ rootScope = s.name;
456
+ continue;
457
+ }
458
+ if (isInside(s.workspaceDir, abs)) {
459
+ const depth = s.workspaceDir.length;
460
+ if (!bestWorkspace || depth > bestWorkspace.depth) bestWorkspace = {
461
+ pkg: s.name,
462
+ depth
463
+ };
464
+ }
451
465
  }
452
466
  if (bestWorkspace) return {
453
467
  path,
@@ -474,6 +488,11 @@ function classifyOne(inspected, path) {
474
488
  glob: vf.glob
475
489
  }
476
490
  };
491
+ if (rootScope && isInside(inspected.projectDir, abs)) return {
492
+ path,
493
+ package: rootScope,
494
+ reason: "workspace"
495
+ };
477
496
  return {
478
497
  path,
479
498
  package: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvy-web/silk-effects",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "private": false,
5
5
  "description": "Shared Effect library for Silk Suite conventions",
6
6
  "homepage": "https://github.com/savvy-web/systems/tree/main/packages/silk-effects",
@@ -33,13 +33,13 @@
33
33
  "@changesets/config": "^4.0.0-next.6",
34
34
  "@changesets/get-github-info": "^1.0.0-next.3",
35
35
  "@changesets/get-release-plan": "^5.0.0-next.7",
36
- "@effected/git": "^0.4.2",
36
+ "@effected/git": "^0.5.0",
37
37
  "@effected/glob": "^0.2.1",
38
38
  "@effected/jsonc": "^0.5.1",
39
- "@effected/package-json": "^0.5.1",
39
+ "@effected/package-json": "^0.5.2",
40
40
  "@effected/walker": "^0.3.2",
41
- "@effected/workspaces": "^0.7.0",
42
- "@effected/yaml": "^0.5.1",
41
+ "@effected/workspaces": "^0.8.0",
42
+ "@effected/yaml": "^0.6.0",
43
43
  "@manypkg/get-packages": "^3.1.0",
44
44
  "mdast-util-heading-range": "^4.0.0",
45
45
  "mdast-util-to-string": "^4.0.0",