@simpleapps-com/augur-config 2.2.11 → 2.2.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.
@@ -14,7 +14,7 @@
14
14
  */
15
15
 
16
16
  import { readFileSync, existsSync } from "node:fs";
17
- import { resolve, basename } from "node:path";
17
+ import { resolve, basename, dirname } from "node:path";
18
18
 
19
19
  // ── CLI ──────────────────────────────────────────────────────────────────────
20
20
 
@@ -79,6 +79,37 @@ function fileContains(relPath, pattern) {
79
79
  return pattern.test(content);
80
80
  }
81
81
 
82
+ /**
83
+ * Walk up from siteDir looking for a file, stopping at a .git boundary.
84
+ * Returns the relative-to-siteDir path if found, or null.
85
+ */
86
+ function findFileUpward(...filenames) {
87
+ let dir = siteDir;
88
+ const root = resolve("/");
89
+ while (dir !== root) {
90
+ for (const name of filenames) {
91
+ const candidate = resolve(dir, name);
92
+ if (existsSync(candidate)) return candidate;
93
+ }
94
+ // Stop at git repo root
95
+ if (existsSync(resolve(dir, ".git"))) break;
96
+ dir = dirname(dir);
97
+ }
98
+ return null;
99
+ }
100
+
101
+ /** Files where proxy pattern wiring commonly lives across different site layouts. */
102
+ const proxyDetectionFiles = [
103
+ "lib/augur-query.ts", "src/lib/augur-query.ts",
104
+ "lib/augur.ts", "src/lib/augur.ts",
105
+ "lib/augur-options.ts", "src/lib/augur-options.ts",
106
+ "app/providers.tsx", "src/app/providers.tsx",
107
+ "app/context/ReactQueryProvider.tsx", "src/app/context/ReactQueryProvider.tsx",
108
+ ];
109
+
110
+ /** Regex matching proxy pattern imports/usage. */
111
+ const proxyPatternRegex = /createServerQueryProxy|queryAction|createAugurOptions|registerQueryAction/;
112
+
82
113
  // ── Results ──────────────────────────────────────────────────────────────────
83
114
 
84
115
  const results = [];
@@ -165,11 +196,8 @@ if (actionsFile && fileContains(actionsFile, /site\.actions|actions\./)) {
165
196
  );
166
197
  } else {
167
198
  // Migrated sites using createServerQueryProxy don't need augur-actions.ts
168
- const usesProxyPattern = [
169
- "lib/augur-query.ts", "src/lib/augur-query.ts",
170
- "lib/augur.ts", "src/lib/augur.ts",
171
- "app/providers.tsx", "src/app/providers.tsx",
172
- ].some((f) => fileExists(f) && fileContains(f, /createServerQueryProxy|queryAction/));
199
+ const usesProxyPattern = proxyDetectionFiles
200
+ .some((f) => fileExists(f) && fileContains(f, proxyPatternRegex));
173
201
 
174
202
  if (usesProxyPattern) {
175
203
  pass("actions", "Using proxy pattern (augur-actions.ts not needed)", "");
@@ -650,10 +678,17 @@ if (pkg) {
650
678
  }
651
679
 
652
680
  // 19. Pre-commit hooks (lefthook + lint-staged)
653
- const lefthookFile = findFile("lefthook.yml", ".lefthook.yml");
681
+ // Check site dir first, then walk up for monorepo layouts
682
+ const lefthookFile = findFile("lefthook.yml", ".lefthook.yml")
683
+ || findFileUpward("lefthook.yml", ".lefthook.yml");
654
684
  const hasLefthookDep = !!(pkg?.devDependencies?.lefthook || pkg?.dependencies?.lefthook);
655
685
  if (lefthookFile || hasLefthookDep) {
656
- const lefthookContent = readFile(lefthookFile);
686
+ // lefthookFile may be a relative path (from findFile) or absolute (from findFileUpward)
687
+ const lefthookContent = lefthookFile
688
+ ? (existsSync(resolve(siteDir, lefthookFile))
689
+ ? readFile(lefthookFile)
690
+ : (existsSync(lefthookFile) ? readFileSync(lefthookFile, "utf-8") : null))
691
+ : null;
657
692
  const hasPreCommit = lefthookContent && lefthookContent.includes("pre-commit");
658
693
  const lintStagedConfig =
659
694
  pkg?.["lint-staged"] ||
@@ -737,19 +772,11 @@ if (localHooksFile) {
737
772
  }
738
773
 
739
774
  // 21. createServerQueryProxy usage
740
- const allSrcFiles = [
741
- "lib/augur-query.ts",
742
- "src/lib/augur-query.ts",
743
- "lib/augur.ts",
744
- "src/lib/augur.ts",
745
- "app/providers.tsx",
746
- "src/app/providers.tsx",
747
- ];
748
- const usesServerProxy = allSrcFiles.some(
749
- (f) => fileExists(f) && fileContains(f, "createServerQueryProxy")
775
+ const usesServerProxy = proxyDetectionFiles.some(
776
+ (f) => fileExists(f) && fileContains(f, /createServerQueryProxy|createAugurOptions/)
750
777
  );
751
- const usesAugurOptions = allSrcFiles.some(
752
- (f) => fileExists(f) && fileContains(f, "useAugurOptions")
778
+ const usesAugurOptions = proxyDetectionFiles.some(
779
+ (f) => fileExists(f) && fileContains(f, /useAugurOptions|registerQueryAction/)
753
780
  );
754
781
  if (usesServerProxy) {
755
782
  pass("proxy-server-query", "Uses createServerQueryProxy for data fetching", "");
@@ -776,7 +803,7 @@ if (pkg) {
776
803
  const isTypedProxy =
777
804
  year > 2026 ||
778
805
  (year === 2026 && minor > 3) ||
779
- (year === 2026 && minor === 3 && patch >= 4);
806
+ (year === 2026 && minor === 3 && patch >= 7);
780
807
 
781
808
  if (isTypedProxy) {
782
809
  pass("api-version", "augur-api SDK version supports typed proxies", apiVersion);
@@ -784,7 +811,7 @@ if (pkg) {
784
811
  warn(
785
812
  "api-version",
786
813
  "augur-api SDK may lack typed proxy support",
787
- `${apiVersion} -- upgrade to >= 2026.3.4 for typed responses`
814
+ `${apiVersion} -- upgrade to >= 2026.3.7 for typed responses`
788
815
  );
789
816
  }
790
817
  } else if (apiVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleapps-com/augur-config",
3
- "version": "2.2.11",
3
+ "version": "2.2.12",
4
4
  "description": "Shared tooling configuration presets for Augur ecommerce sites",
5
5
  "license": "MIT",
6
6
  "repository": {