@stacksjs/buddy 0.70.257 → 0.70.258

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.
@@ -122,10 +122,16 @@ export declare function applyPersistentStatePaths(sites: Record<string, any>, sl
122
122
  */
123
123
  export declare function applyEnvironmentToSites(sites: Record<string, any>, environment: string, config: any): Record<string, any>;
124
124
  /**
125
- * Load the ts-cloud driver used by Buddy. Published installs use the declared
126
- * package dependency. Framework and ts-cloud development can point at a built
127
- * local module with TS_CLOUD_MODULE, avoiding stale nested dependency copies
128
- * while still exercising the exact Buddy deploy path.
125
+ * Resolve the app's direct ts-cloud dependency before Buddy's own dependency.
126
+ * Package managers may retain a stale nested copy below Buddy even after the
127
+ * app explicitly updates ts-cloud; resolving from the project manifest keeps
128
+ * the deploy engine selected by the application authoritative.
129
+ */
130
+ export declare function resolveProjectTsCloudModule(projectRoot?: unknown): string | undefined;
131
+ /**
132
+ * Load the ts-cloud driver used by Buddy. An explicit TS_CLOUD_MODULE remains
133
+ * available for framework development; published apps otherwise use their
134
+ * direct dependency before falling back to Buddy's declared dependency.
129
135
  */
130
136
  export declare function loadTsCloudDeployApi(): Promise<typeof import('@stacksjs/ts-cloud')>;
131
137
  /**
@@ -1,6 +1,6 @@
1
1
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
- import { isAbsolute, join, relative, resolve } from "node:path";
3
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
4
4
  import process from "node:process";
5
5
  import { pathToFileURL } from "node:url";
6
6
  import { runAction } from "@stacksjs/actions";
@@ -629,10 +629,22 @@ async function deployToHetzner(tsCloudConfig, deployEnv, options) {
629
629
  process.exit(ExitCode.FatalError);
630
630
  }
631
631
  }
632
+ export function resolveProjectTsCloudModule(projectRoot = process.cwd()) {
633
+ const manifestPath = join(projectRoot, "node_modules", "@stacksjs", "ts-cloud", "package.json");
634
+ if (!existsSync(manifestPath))
635
+ return;
636
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8")), rootExport = manifest.exports?.["."], entry = manifest.module ?? (typeof rootExport === "string" ? rootExport : rootExport?.import);
637
+ if (!entry)
638
+ return;
639
+ const modulePath = resolve(dirname(manifestPath), entry);
640
+ return existsSync(modulePath) ? modulePath : void 0;
641
+ }
632
642
  export async function loadTsCloudDeployApi() {
633
643
  const requested = process.env.TS_CLOUD_MODULE?.trim();
634
- if (!requested)
635
- return import("@stacksjs/ts-cloud");
644
+ if (!requested) {
645
+ const projectModule = resolveProjectTsCloudModule();
646
+ return projectModule ? import(pathToFileURL(projectModule).href) : import("@stacksjs/ts-cloud");
647
+ }
636
648
  const modulePath = isAbsolute(requested) ? requested : resolve(process.cwd(), requested);
637
649
  if (!existsSync(modulePath))
638
650
  throw Error(`TS_CLOUD_MODULE points to a missing module: ${modulePath}`);
@@ -8,6 +8,39 @@ async function runStyleAction(entry, label, options) {
8
8
  process.exit(ExitCode.FatalError);
9
9
  }
10
10
  }
11
+ async function runStxChecks(startTime) {
12
+ const { runStxLint } = await import("@stacksjs/actions"), report = await runStxLint(), out = [""];
13
+ for (const r of report.results)
14
+ if (r.status === "fail") {
15
+ out.push(` FAIL ${r.label}`);
16
+ out.push(` ${r.count} found, baseline ${r.baseline}${r.why ? ` (${r.why})` : ""}`);
17
+ for (const line of r.detail.slice(0, 8))
18
+ out.push(` ${line}`);
19
+ } else if (r.status === "loosened")
20
+ out.push(` DROP ${r.label}: ${r.count} < baseline ${r.baseline} \u2014 lower it in config/lint.ts`);
21
+ else
22
+ out.push(` ok ${r.label}${r.baseline > 0 ? ` (${r.count}, held)` : ""}`);
23
+ if (report.distMissing)
24
+ out.push("", " note: no build output found \u2014 the dist checks did not run. Run `./buddy build` first.");
25
+ if (report.loosened > 0) {
26
+ out.push("", " Current counts, for config/lint.ts:");
27
+ for (const [id, count] of Object.entries(report.counts).sort(([a], [b]) => a.localeCompare(b)))
28
+ out.push(` '${id}': ${count},`);
29
+ }
30
+ console.log(out.join(`
31
+ `));
32
+ if (report.failed > 0) {
33
+ log.error(`${report.failed} stx check(s) failed.`);
34
+ await outro("stx checks failed", { startTime, useSeconds: !0 });
35
+ process.exit(ExitCode.FatalError);
36
+ }
37
+ if (report.loosened > 0) {
38
+ log.warn(`No regressions, but ${report.loosened} baseline(s) are now stale.`);
39
+ await outro("stx baselines stale", { startTime, useSeconds: !0 });
40
+ process.exit(ExitCode.FatalError);
41
+ }
42
+ await outro("All stx checks pass", { startTime, useSeconds: !0 });
43
+ }
11
44
  export function lint(buddy) {
12
45
  const descriptions = {
13
46
  lint: "Automagically lints your project codebase",
@@ -15,11 +48,16 @@ export function lint(buddy) {
15
48
  format: "Format your project codebase",
16
49
  formatCheck: "Check formatting without making changes",
17
50
  project: "Target a specific project",
51
+ stx: "Run the stx conformance checks instead of code style",
18
52
  verbose: "Enable verbose output"
19
53
  };
20
- buddy.command("lint", descriptions.lint).option("-f, --fix", descriptions.lintFix, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
54
+ buddy.command("lint", descriptions.lint).option("-f, --fix", descriptions.lintFix, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--stx", descriptions.stx, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
21
55
  log.debug("Running `buddy lint` ...", options);
22
56
  const startTime = await intro("buddy lint");
57
+ if (options.stx) {
58
+ await runStxChecks(startTime);
59
+ return;
60
+ }
23
61
  await runStyleAction(options.fix ? "lintFix" : "lintProject", "lint");
24
62
  await outro("Linted your project", { startTime, useSeconds: !0 });
25
63
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.257",
5
+ "version": "0.70.258",
6
6
  "description": "Meet Buddy. The Stacks runtime.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -88,54 +88,54 @@
88
88
  "prepublishOnly": "bun run build"
89
89
  },
90
90
  "dependencies": {
91
- "@stacksjs/actions": "^0.70.257",
92
- "@stacksjs/ai": "^0.70.257",
93
- "@stacksjs/alias": "^0.70.257",
94
- "@stacksjs/arrays": "^0.70.257",
95
- "@stacksjs/auth": "^0.70.257",
96
- "@stacksjs/build": "^0.70.257",
97
- "@stacksjs/cache": "^0.70.257",
98
- "@stacksjs/cli": "^0.70.257",
91
+ "@stacksjs/actions": "^0.70.258",
92
+ "@stacksjs/ai": "^0.70.258",
93
+ "@stacksjs/alias": "^0.70.258",
94
+ "@stacksjs/arrays": "^0.70.258",
95
+ "@stacksjs/auth": "^0.70.258",
96
+ "@stacksjs/build": "^0.70.258",
97
+ "@stacksjs/cache": "^0.70.258",
98
+ "@stacksjs/cli": "^0.70.258",
99
99
  "@stacksjs/clapp": "^0.2.12",
100
- "@stacksjs/cloud": "^0.70.257",
101
- "@stacksjs/collections": "^0.70.257",
102
- "@stacksjs/config": "^0.70.257",
103
- "@stacksjs/database": "^0.70.257",
104
- "@stacksjs/desktop-build": "^0.70.257",
105
- "@stacksjs/dns": "^0.70.257",
106
- "@stacksjs/email": "^0.70.257",
107
- "@stacksjs/enums": "^0.70.257",
108
- "@stacksjs/error-handling": "^0.70.257",
109
- "@stacksjs/events": "^0.70.257",
110
- "@stacksjs/git": "^0.70.257",
100
+ "@stacksjs/cloud": "^0.70.258",
101
+ "@stacksjs/collections": "^0.70.258",
102
+ "@stacksjs/config": "^0.70.258",
103
+ "@stacksjs/database": "^0.70.258",
104
+ "@stacksjs/desktop-build": "^0.70.258",
105
+ "@stacksjs/dns": "^0.70.258",
106
+ "@stacksjs/email": "^0.70.258",
107
+ "@stacksjs/enums": "^0.70.258",
108
+ "@stacksjs/error-handling": "^0.70.258",
109
+ "@stacksjs/events": "^0.70.258",
110
+ "@stacksjs/git": "^0.70.258",
111
111
  "@stacksjs/gitit": "^0.2.5",
112
- "@stacksjs/health": "^0.70.257",
112
+ "@stacksjs/health": "^0.70.258",
113
113
  "@stacksjs/dnsx": "^0.2.3",
114
114
  "@stacksjs/httx": "^0.1.10",
115
- "@stacksjs/image": "^0.70.257",
116
- "@stacksjs/lint": "^0.70.257",
117
- "@stacksjs/logging": "^0.70.257",
118
- "@stacksjs/notifications": "^0.70.257",
119
- "@stacksjs/objects": "^0.70.257",
120
- "@stacksjs/orm": "^0.70.257",
121
- "@stacksjs/path": "^0.70.257",
122
- "@stacksjs/skills": "^0.70.257",
123
- "@stacksjs/payments": "^0.70.257",
124
- "@stacksjs/realtime": "^0.70.257",
125
- "@stacksjs/router": "^0.70.257",
115
+ "@stacksjs/image": "^0.70.258",
116
+ "@stacksjs/lint": "^0.70.258",
117
+ "@stacksjs/logging": "^0.70.258",
118
+ "@stacksjs/notifications": "^0.70.258",
119
+ "@stacksjs/objects": "^0.70.258",
120
+ "@stacksjs/orm": "^0.70.258",
121
+ "@stacksjs/path": "^0.70.258",
122
+ "@stacksjs/skills": "^0.70.258",
123
+ "@stacksjs/payments": "^0.70.258",
124
+ "@stacksjs/realtime": "^0.70.258",
125
+ "@stacksjs/router": "^0.70.258",
126
126
  "@stacksjs/rpx": "^0.11.42",
127
- "@stacksjs/search-engine": "^0.70.257",
128
- "@stacksjs/security": "^0.70.257",
129
- "@stacksjs/server": "^0.70.257",
130
- "@stacksjs/storage": "^0.70.257",
131
- "@stacksjs/strings": "^0.70.257",
132
- "@stacksjs/testing": "^0.70.257",
133
- "@stacksjs/tunnel": "^0.70.257",
134
- "@stacksjs/types": "^0.70.257",
135
- "@stacksjs/ui": "^0.70.257",
136
- "@stacksjs/utils": "^0.70.257",
137
- "@stacksjs/validation": "^0.70.257",
138
- "@stacksjs/ts-cloud": "^0.7.92",
127
+ "@stacksjs/search-engine": "^0.70.258",
128
+ "@stacksjs/security": "^0.70.258",
129
+ "@stacksjs/server": "^0.70.258",
130
+ "@stacksjs/storage": "^0.70.258",
131
+ "@stacksjs/strings": "^0.70.258",
132
+ "@stacksjs/testing": "^0.70.258",
133
+ "@stacksjs/tunnel": "^0.70.258",
134
+ "@stacksjs/types": "^0.70.258",
135
+ "@stacksjs/ui": "^0.70.258",
136
+ "@stacksjs/utils": "^0.70.258",
137
+ "@stacksjs/validation": "^0.70.258",
138
+ "@stacksjs/ts-cloud": "^0.7.94",
139
139
  "ajv": "^8.20.0",
140
140
  "ajv-formats": "^3.0.1",
141
141
  "ts-pantry": "^0.11.0"