@orkestrel/scaffold 0.0.10 → 0.0.12

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.
@@ -1746,7 +1746,8 @@ function selectOrkestrelEntries(value) {
1746
1746
  * `app/<environment>/`; a target with no environment on either axis is also a coded
1747
1747
  * `TARGET` failure. The `bin`, `integration`, and `service` facts probe physical
1748
1748
  * directories at `src/bin`, `tests/integration`, and `tests/service`, respectively,
1749
- * never the workspace name. `dependencies` /
1749
+ * while `global` probes the physical exact-case `tests/setupGlobal.ts` file; none is
1750
+ * inferred from the workspace name. `dependencies` /
1750
1751
  * `peers` are the `@orkestrel/`-prefixed entries of `manifest.dependencies` /
1751
1752
  * `manifest.peerDependencies` (a peer flagged `peerDependenciesMeta[name]
1752
1753
  * .optional === true` carries `optional: true`). `extras` is EVERY entry of
@@ -1775,7 +1776,8 @@ function selectOrkestrelEntries(value) {
1775
1776
  * ```
1776
1777
  */
1777
1778
  function deriveBlueprint(target) {
1778
- const parsed = (0, _orkestrel_contract.parseJSON)(readManifest(target));
1779
+ const text = readManifest(target);
1780
+ const parsed = (0, _orkestrel_contract.parseJSON)(text);
1779
1781
  if (!(0, _orkestrel_contract.isRecord)(parsed)) throw new _src_core.ScaffoldError("TARGET", `Manifest at ${target} is not a valid JSON object`, { target });
1780
1782
  const src = _src_core.ENVIRONMENTS.filter((environment) => isRealDirectory((0, node_path.join)(target, "src", environment)));
1781
1783
  const app = _src_core.ENVIRONMENTS.filter((environment) => isRealDirectory((0, node_path.join)(target, "app", environment)));
@@ -1799,11 +1801,15 @@ function deriveBlueprint(target) {
1799
1801
  const keywords = Array.isArray(rawKeywords) && rawKeywords.every((word) => typeof word === "string") ? rawKeywords : [];
1800
1802
  const rawVersion = (0, _src_core.ownDataValue)(parsed, "version");
1801
1803
  const version = typeof rawVersion === "string" ? rawVersion : _src_core.DEFAULT_VERSION;
1802
- const rawNode = (0, _src_core.ownDataValue)((0, _src_core.ownDataValue)(parsed, "engines"), "node");
1804
+ const rawEngines = (0, _src_core.ownDataValue)(parsed, "engines");
1805
+ const rawNode = (0, _src_core.ownDataValue)(rawEngines, "node");
1803
1806
  const engines = typeof rawNode === "string" ? rawNode : _src_core.DEFAULT_ENGINES;
1804
1807
  const bin = isRealDirectory((0, node_path.join)(target, "src", "bin"));
1805
1808
  const integration = isRealDirectory((0, node_path.join)(target, "tests", "integration"));
1806
1809
  const service = isRealDirectory((0, node_path.join)(target, "tests", "service"));
1810
+ const tests = (0, node_path.join)(target, (0, node_path.dirname)(_src_core.GLOBAL_SETUP_PATH));
1811
+ const entries = (0, _orkestrel_contract.attempt)(() => (0, node_fs.readdirSync)(tests));
1812
+ const global = entries.success && entries.value.includes((0, node_path.basename)(_src_core.GLOBAL_SETUP_PATH)) && isRealFile((0, node_path.join)(target, _src_core.GLOBAL_SETUP_PATH));
1807
1813
  if (service) {
1808
1814
  const missing = [];
1809
1815
  if (!isRealFile((0, node_path.join)(target, "tests", "setupService.ts"))) missing.push("tests/setupService.ts");
@@ -1841,7 +1847,8 @@ function deriveBlueprint(target) {
1841
1847
  extras: [],
1842
1848
  bin,
1843
1849
  integration,
1844
- service
1850
+ service,
1851
+ global
1845
1852
  }))));
1846
1853
  const rawDevDependencies = (0, _src_core.ownDataValue)(parsed, "devDependencies");
1847
1854
  const devDependencies = (0, _orkestrel_contract.isRecord)(rawDevDependencies) ? rawDevDependencies : {};
@@ -1862,7 +1869,8 @@ function deriveBlueprint(target) {
1862
1869
  overrides: [],
1863
1870
  bin,
1864
1871
  integration,
1865
- service
1872
+ service,
1873
+ global
1866
1874
  });
1867
1875
  }
1868
1876
  /**
@@ -2517,7 +2525,8 @@ function stageHost(root, out, paths = _src_core.HOST_PATHS) {
2517
2525
  root,
2518
2526
  destination: entry.destination
2519
2527
  });
2520
- (0, node_fs.mkdirSync)((0, node_path.dirname)(resolvePhysicalPath(staging, entry.storage, "WRITE", "staging")), { recursive: true });
2528
+ const destination = resolvePhysicalPath(staging, entry.storage, "WRITE", "staging");
2529
+ (0, node_fs.mkdirSync)((0, node_path.dirname)(destination), { recursive: true });
2521
2530
  validateWriteAnchor(stagingAnchor, "host staging root");
2522
2531
  const containedDestination = resolvePhysicalPath(staging, entry.storage, "WRITE", "staging");
2523
2532
  (0, node_fs.copyFileSync)(source, containedDestination, node_fs.constants.COPYFILE_EXCL);
@@ -3229,7 +3238,8 @@ var Materializer = class {
3229
3238
  const sourceDigest = digestFile(source);
3230
3239
  const expectedHex = preview.value[file.path];
3231
3240
  if (expectedHex === void 0 || sourceDigest !== digestHex(expectedHex)) throw new _src_core.ScaffoldError("WRITE", `Prune target changed at ${file.path}`, { path: file.path });
3232
- (0, node_fs.mkdirSync)((0, node_path.dirname)(resolvePhysicalPath(transaction.backup, file.path, "WRITE", "quarantine")), { recursive: true });
3241
+ const destination = resolvePhysicalPath(transaction.backup, file.path, "WRITE", "quarantine");
3242
+ (0, node_fs.mkdirSync)((0, node_path.dirname)(destination), { recursive: true });
3233
3243
  validateWriteTarget(transaction, void 0);
3234
3244
  const containedDestination = resolvePhysicalPath(transaction.backup, file.path, "WRITE", "quarantine");
3235
3245
  (0, node_fs.renameSync)(source, containedDestination);
@@ -3345,7 +3355,8 @@ var Materializer = class {
3345
3355
  return;
3346
3356
  }
3347
3357
  if (manifest === void 0 && artifact.hex === void 0) {
3348
- const status = (0, node_fs.lstatSync)(resolvePhysicalPath(this.#host, source, "TARGET", "host"));
3358
+ const directory = resolvePhysicalPath(this.#host, source, "TARGET", "host");
3359
+ const status = (0, node_fs.lstatSync)(directory);
3349
3360
  if (!status.isDirectory() || status.isSymbolicLink()) throw new _src_core.ScaffoldError("TARGET", `Host artifact is not a physical directory at ${source}`, { source });
3350
3361
  const destination = resolvePhysicalPath(transaction.stage, artifact.path, "WRITE", "staging");
3351
3362
  (0, node_fs.mkdirSync)(destination, { recursive: true });
@@ -3688,7 +3699,8 @@ var Sync = class Sync {
3688
3699
  limit: _src_core.MAX_ARTIFACT_BYTES
3689
3700
  });
3690
3701
  validateWriteDirectories(transaction);
3691
- (0, node_fs.mkdirSync)((0, node_path.dirname)(resolvePhysicalPath(transaction.stage, guide.path, "WRITE", "staging")), { recursive: true });
3702
+ const candidate = resolvePhysicalPath(transaction.stage, guide.path, "WRITE", "staging");
3703
+ (0, node_fs.mkdirSync)((0, node_path.dirname)(candidate), { recursive: true });
3692
3704
  validateWriteDirectories(transaction);
3693
3705
  const destination = resolvePhysicalPath(transaction.stage, guide.path, "WRITE", "staging");
3694
3706
  (0, node_fs.writeFileSync)(destination, guide.content, {