@se-studio/site-check 2.9.9 → 2.10.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/CHANGELOG.md +18 -0
- package/check-no-context-workarounds.mjs +235 -0
- package/dist/smoke-test/analytics-context-bundle.d.ts.map +1 -1
- package/dist/smoke-test/analytics-context-bundle.js +10 -12
- package/dist/smoke-test/analytics-context-bundle.js.map +1 -1
- package/docs/llms.md +17 -1
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add `check-no-context-workarounds` CLI that fails CI when webpack aliases, pnpm overrides, or public-hoist hacks are used for @se-studio/core-ui dual-install workarounds. Escape hatch: ALLOW_CONTEXT_WORKAROUNDS=1 (feature branches only).
|
|
8
|
+
|
|
9
|
+
## 2.9.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Match minified webpack `r.d`/`n.d` when detecting AnalyticsProvider context modules.
|
|
14
|
+
|
|
15
|
+
## 2.9.10
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Do not count AnalyticsProvider re-export barrels as duplicate context modules in the post-build smoke scan.
|
|
20
|
+
|
|
3
21
|
## 2.9.9
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Fail CI/validate if a repo uses dodgy dual-package workarounds for React
|
|
4
|
+
* context libraries (especially @se-studio/core-ui).
|
|
5
|
+
*
|
|
6
|
+
* Allowed on feature branches only via ALLOW_CONTEXT_WORKAROUNDS=1.
|
|
7
|
+
* Never allowed on develop / production integration branches.
|
|
8
|
+
*
|
|
9
|
+
* Usage (repo root):
|
|
10
|
+
* check-no-context-workarounds
|
|
11
|
+
* node node_modules/@se-studio/site-check/check-no-context-workarounds.mjs
|
|
12
|
+
*
|
|
13
|
+
* Proper monorepo pattern (allowed):
|
|
14
|
+
* - peerDependencies for @se-studio/core-ui (etc.) on shared packages
|
|
15
|
+
* - dependenciesMeta.injected on the app → shared package
|
|
16
|
+
* - @se-studio/core-ui singleton (package itself)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import fs from 'node:fs';
|
|
20
|
+
import path from 'node:path';
|
|
21
|
+
|
|
22
|
+
const root = process.cwd();
|
|
23
|
+
|
|
24
|
+
/** Packages that must never be force-aliased / override-pinned for dual-instance hacks. */
|
|
25
|
+
const CONTEXT_PACKAGES = ['@se-studio/core-ui', '@se-studio/ab-testing'];
|
|
26
|
+
|
|
27
|
+
const findings = [];
|
|
28
|
+
|
|
29
|
+
function rel(filePath) {
|
|
30
|
+
return path.relative(root, filePath) || filePath;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function addFinding(file, rule, detail) {
|
|
34
|
+
findings.push({ file: rel(file), rule, detail });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function walkFiles(dir, predicate, out = []) {
|
|
38
|
+
if (!fs.existsSync(dir)) return out;
|
|
39
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
40
|
+
if (entry.name === 'node_modules' || entry.name === '.git' || entry.name === '.next') {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const full = path.join(dir, entry.name);
|
|
44
|
+
if (entry.isDirectory()) {
|
|
45
|
+
walkFiles(full, predicate, out);
|
|
46
|
+
} else if (entry.isFile() && predicate(full)) {
|
|
47
|
+
out.push(full);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function read(filePath) {
|
|
54
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function scanNextConfigs() {
|
|
58
|
+
const files = walkFiles(root, (f) => /next\.config\.(js|mjs|cjs|ts|mts|cts)$/.test(f));
|
|
59
|
+
for (const file of files) {
|
|
60
|
+
const content = read(file);
|
|
61
|
+
for (const pkg of CONTEXT_PACKAGES) {
|
|
62
|
+
// webpack resolve.alias targeting the package (including $ exact and subpaths)
|
|
63
|
+
const aliasPatterns = [
|
|
64
|
+
new RegExp(`['"\`]${escapeRegExp(pkg)}(?:\\$|/)[^'"\`]*['"\`]\\s*:`),
|
|
65
|
+
new RegExp(`['"\`]${escapeRegExp(pkg)}['"\`]\\s*:`),
|
|
66
|
+
new RegExp(`alias[^\\n]*${escapeRegExp(pkg)}`),
|
|
67
|
+
new RegExp(`resolve\\.alias[^}]*${escapeRegExp(pkg)}`, 's'),
|
|
68
|
+
];
|
|
69
|
+
for (const re of aliasPatterns) {
|
|
70
|
+
if (re.test(content) && content.includes('alias')) {
|
|
71
|
+
addFinding(
|
|
72
|
+
file,
|
|
73
|
+
'webpack-alias',
|
|
74
|
+
`webpack/resolve alias for ${pkg} is banned on integration branches. ` +
|
|
75
|
+
'Use peerDependencies + dependenciesMeta.injected on the shared package instead.',
|
|
76
|
+
);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function scanYamlOverrides(file, content) {
|
|
85
|
+
const lines = content.split('\n');
|
|
86
|
+
let inOverrides = false;
|
|
87
|
+
for (const line of lines) {
|
|
88
|
+
if (/^overrides:\s*$/.test(line.trimEnd()) || /^overrides:\s*$/.test(line)) {
|
|
89
|
+
inOverrides = true;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (inOverrides) {
|
|
93
|
+
// Top-level key ends the overrides block (no leading whitespace)
|
|
94
|
+
if (line.length > 0 && !/^[ \t]/.test(line) && !line.trimStart().startsWith('#')) {
|
|
95
|
+
inOverrides = false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (!inOverrides) continue;
|
|
99
|
+
for (const pkg of CONTEXT_PACKAGES) {
|
|
100
|
+
if (line.includes(pkg)) {
|
|
101
|
+
addFinding(
|
|
102
|
+
file,
|
|
103
|
+
'pnpm-override',
|
|
104
|
+
`pnpm override for ${pkg} is banned. Use peerDependencies + dependenciesMeta.injected, not overrides.`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function scanPnpmWorkspaceAndPackageJson() {
|
|
112
|
+
const candidates = [
|
|
113
|
+
path.join(root, 'pnpm-workspace.yaml'),
|
|
114
|
+
path.join(root, 'package.json'),
|
|
115
|
+
...walkFiles(
|
|
116
|
+
root,
|
|
117
|
+
(f) => f.endsWith('package.json') && !f.includes(`${path.sep}node_modules${path.sep}`),
|
|
118
|
+
),
|
|
119
|
+
];
|
|
120
|
+
const seen = new Set();
|
|
121
|
+
for (const file of candidates) {
|
|
122
|
+
if (!fs.existsSync(file) || seen.has(file)) continue;
|
|
123
|
+
seen.add(file);
|
|
124
|
+
const content = read(file);
|
|
125
|
+
|
|
126
|
+
if (file.endsWith('.yaml') || file.endsWith('.yml')) {
|
|
127
|
+
scanYamlOverrides(file, content);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (file.endsWith('package.json')) {
|
|
132
|
+
try {
|
|
133
|
+
const json = JSON.parse(content);
|
|
134
|
+
const overrides = json.pnpm?.overrides ?? json.overrides;
|
|
135
|
+
if (overrides && typeof overrides === 'object') {
|
|
136
|
+
for (const pkg of CONTEXT_PACKAGES) {
|
|
137
|
+
if (pkg in overrides) {
|
|
138
|
+
addFinding(
|
|
139
|
+
file,
|
|
140
|
+
'pnpm-override',
|
|
141
|
+
`package.json overrides for ${pkg} is banned (${overrides[pkg]}).`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} catch {
|
|
147
|
+
// ignore invalid json
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function scanNpmrc() {
|
|
154
|
+
const file = path.join(root, '.npmrc');
|
|
155
|
+
if (!fs.existsSync(file)) return;
|
|
156
|
+
const content = read(file);
|
|
157
|
+
const lines = content.split('\n');
|
|
158
|
+
for (const line of lines) {
|
|
159
|
+
const trimmed = line.trim();
|
|
160
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
161
|
+
if (trimmed.startsWith('public-hoist-pattern')) {
|
|
162
|
+
for (const pkg of CONTEXT_PACKAGES) {
|
|
163
|
+
const short = pkg.replace('@se-studio/', '');
|
|
164
|
+
if (trimmed.includes(pkg) || trimmed.includes(short) || trimmed.includes('core-ui')) {
|
|
165
|
+
addFinding(
|
|
166
|
+
file,
|
|
167
|
+
'public-hoist',
|
|
168
|
+
`public-hoist-pattern for context packages is banned (${trimmed}). Prefer peerDependencies + injected shared packages.`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// Broad hoist of all react is also a smell when used to fix dual core-ui
|
|
174
|
+
if (
|
|
175
|
+
trimmed.startsWith('public-hoist-pattern') &&
|
|
176
|
+
(trimmed.includes('*react*') || trimmed.includes('react-dom'))
|
|
177
|
+
) {
|
|
178
|
+
addFinding(
|
|
179
|
+
file,
|
|
180
|
+
'public-hoist',
|
|
181
|
+
`public-hoist-pattern for react is banned as a dual-package workaround (${trimmed}).`,
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function escapeRegExp(value) {
|
|
188
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function main() {
|
|
192
|
+
if (
|
|
193
|
+
(process.env.ALLOW_CONTEXT_WORKAROUNDS ?? '').toLowerCase() === '1' ||
|
|
194
|
+
(process.env.ALLOW_CONTEXT_WORKAROUNDS ?? '').toLowerCase() === 'true'
|
|
195
|
+
) {
|
|
196
|
+
console.warn(
|
|
197
|
+
'check-no-context-workarounds: SKIPPED (ALLOW_CONTEXT_WORKAROUNDS is set). ' +
|
|
198
|
+
'Do not merge this to develop/main without removing the workarounds.',
|
|
199
|
+
);
|
|
200
|
+
process.exit(0);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
scanNextConfigs();
|
|
204
|
+
scanPnpmWorkspaceAndPackageJson();
|
|
205
|
+
scanNpmrc();
|
|
206
|
+
|
|
207
|
+
if (findings.length === 0) {
|
|
208
|
+
console.log('check-no-context-workarounds: ok');
|
|
209
|
+
process.exit(0);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
console.error('check-no-context-workarounds: FAILED');
|
|
213
|
+
console.error('');
|
|
214
|
+
console.error(
|
|
215
|
+
'Banned dual-package workarounds for React context libraries (@se-studio/core-ui, etc.).',
|
|
216
|
+
);
|
|
217
|
+
console.error('These must never land on develop or production.');
|
|
218
|
+
console.error('');
|
|
219
|
+
for (const f of findings) {
|
|
220
|
+
console.error(` [${f.rule}] ${f.file}`);
|
|
221
|
+
console.error(` ${f.detail}`);
|
|
222
|
+
}
|
|
223
|
+
console.error('');
|
|
224
|
+
console.error('Allowed:');
|
|
225
|
+
console.error(' - peerDependencies on shared packages for @se-studio/core-ui (etc.)');
|
|
226
|
+
console.error(' - dependenciesMeta.<shared-pkg>.injected: true on apps');
|
|
227
|
+
console.error(' - @se-studio/core-ui singleton (package release)');
|
|
228
|
+
console.error('');
|
|
229
|
+
console.error(
|
|
230
|
+
'Feature-branch escape hatch only: ALLOW_CONTEXT_WORKAROUNDS=1 (never on develop/main).',
|
|
231
|
+
);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
main();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-context-bundle.d.ts","sourceRoot":"","sources":["../../src/smoke-test/analytics-context-bundle.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,yBAAyB,EAAE,CAAC;IACrC,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,MAAM,EAAE,OAAO,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"analytics-context-bundle.d.ts","sourceRoot":"","sources":["../../src/smoke-test/analytics-context-bundle.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,yBAAyB,EAAE,CAAC;IACrC,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,MAAM,EAAE,OAAO,CAAC;CACjB;AA8CD;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,4BAA4B,CAkE3F;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,GAAG,IAAI,CASf;AAED,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,4BAA4B,GAAG,MAAM,CAyB/F;AAED,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,4BAA4B,GAAG,MAAM,CAE9F"}
|
|
@@ -4,12 +4,15 @@ const CHUNK_FILE_RE = /\.js$/;
|
|
|
4
4
|
/** Classic throw string from published core-ui (still present in older builds). */
|
|
5
5
|
const LEGACY_THROW = 'useAnalyticsContext must be used within an AnalyticsProvider';
|
|
6
6
|
/**
|
|
7
|
-
* Match webpack modules that
|
|
7
|
+
* Match webpack modules that **define** AnalyticsProvider (minified Next client chunks).
|
|
8
|
+
* Require the export key to be exactly `AnalyticsProvider:` so re-export barrels like
|
|
9
|
+
* `n.d(t,{yP:()=>n.AnalyticsProvider})` are not counted as a second context module.
|
|
8
10
|
* Examples:
|
|
9
11
|
* 78550:(e,t,n)=>{n.d(t,{AnalyticsProvider:()=>l,useAnalyticsContext:()=>s})...
|
|
10
12
|
* 41199:(e,t,n)=>{n.d(t,{AnalyticsProvider:()=>l,useAnalyticsContext:()=>s})...
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
// Minifiers rename the webpack require param (`n.d` / `r.d` / …).
|
|
15
|
+
const ANALYTICS_PROVIDER_MODULE_RE = /(\d+):\([^)]*\)\s*=>\s*\{[^}]*?\w\.d\(t,\{AnalyticsProvider:/g;
|
|
13
16
|
/**
|
|
14
17
|
* Broader fallback: body contains AnalyticsProvider + useAnalyticsContext + createContext null.
|
|
15
18
|
* Used when module-id regex fails (different bundler shape).
|
|
@@ -77,18 +80,13 @@ export function scanAnalyticsContextModules(chunksDir) {
|
|
|
77
80
|
match = ANALYTICS_PROVIDER_MODULE_RE.exec(body);
|
|
78
81
|
}
|
|
79
82
|
// Fallback when regex missed but file clearly embeds the analytics context factory.
|
|
83
|
+
// Only count createContext(null) factories when this file also defines the export key
|
|
84
|
+
// `AnalyticsProvider:` (not re-export barrels that merely reference the name).
|
|
80
85
|
if (!matchedModule && bodyLooksLikeAnalyticsContextModule(body)) {
|
|
81
|
-
|
|
86
|
+
const definesProviderExport = /\w\.d\(t,\{AnalyticsProvider:/.test(body);
|
|
82
87
|
const factoryHits = body.match(/createContext\)\(null\)|createContext\(null\)/g) ?? [];
|
|
83
|
-
if (factoryHits.length > 0
|
|
84
|
-
|
|
85
|
-
// Prefer counting distinct "AnalyticsProvider:()=>" export defs.
|
|
86
|
-
const exportDefs = body.match(/AnalyticsProvider:?\(\)=>|AnalyticsProvider:\(\)=>/g) ?? [];
|
|
87
|
-
const count = Math.max(exportDefs.length, body.includes(LEGACY_THROW) ? 1 : 0);
|
|
88
|
-
for (let i = 0; i < Math.max(count, factoryHits.length > 1 ? 2 : 1); i++) {
|
|
89
|
-
// Only add extra keys when we clearly see multiple factories + provider defs.
|
|
90
|
-
if (i > 0 && factoryHits.length < 2)
|
|
91
|
-
break;
|
|
88
|
+
if (definesProviderExport && factoryHits.length > 0) {
|
|
89
|
+
for (let i = 0; i < factoryHits.length; i++) {
|
|
92
90
|
const key = `${rel}#${i}`;
|
|
93
91
|
if (!seen.has(key)) {
|
|
94
92
|
seen.set(key, { moduleId: key, file: rel });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-context-bundle.js","sourceRoot":"","sources":["../../src/smoke-test/analytics-context-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAwB7B,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B,mFAAmF;AACnF,MAAM,YAAY,GAAG,8DAA8D,CAAC;AAEpF
|
|
1
|
+
{"version":3,"file":"analytics-context-bundle.js","sourceRoot":"","sources":["../../src/smoke-test/analytics-context-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAwB7B,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B,mFAAmF;AACnF,MAAM,YAAY,GAAG,8DAA8D,CAAC;AAEpF;;;;;;;GAOG;AACH,kEAAkE;AAClE,MAAM,4BAA4B,GAChC,+DAA+D,CAAC;AAElE;;;GAGG;AACH,SAAS,mCAAmC,CAAC,IAAY;IACvD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,KAAK,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,MAAoC;IACpF,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
package/docs/llms.md
CHANGED
|
@@ -104,7 +104,23 @@ import { runArticleLinkIntegrityFromSmokeConfig } from '@se-studio/site-check/cm
|
|
|
104
104
|
|
|
105
105
|
### Analytics context bundle check
|
|
106
106
|
|
|
107
|
-
After a production build (or when `.next` already exists for `smoke-test:deploy-check`), `smoke-test-one` scans `.next/static/chunks` for multiple webpack modules that define `AnalyticsProvider` + React context. **More than one module fails the smoke run** — usually duplicate `@se-studio/core-ui` from pnpm peer isolation in monorepos (provider in a workspace package, consumers in the app).
|
|
107
|
+
After a production build (or when `.next` already exists for `smoke-test:deploy-check`), `smoke-test-one` scans `.next/static/chunks` for multiple webpack modules that define `AnalyticsProvider` + React context. **More than one module fails the smoke run** — usually duplicate `@se-studio/core-ui` from pnpm peer isolation in monorepos (provider in a workspace package, consumers in the app).
|
|
108
|
+
|
|
109
|
+
**Proper fix (allowed):** shared package `peerDependencies` for `@se-studio/core-ui` + app `dependenciesMeta.<shared>.injected: true`.
|
|
110
|
+
**Banned on develop/main:** webpack `resolve.alias` for `@se-studio/core-ui`, pnpm `overrides` for it, `public-hoist-pattern` hacks — run `check-no-context-workarounds`.
|
|
111
|
+
|
|
112
|
+
### check-no-context-workarounds
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# repo root — wire into root "validate" / CI on develop
|
|
116
|
+
pnpm exec check-no-context-workarounds
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
| Env | Purpose |
|
|
120
|
+
|-----|---------|
|
|
121
|
+
| `ALLOW_CONTEXT_WORKAROUNDS=1` | Feature-branch only escape hatch — **never** set on develop/main |
|
|
122
|
+
|
|
123
|
+
Fails on: Next webpack aliases for `@se-studio/core-ui` / `@se-studio/ab-testing`, pnpm overrides for those packages, `.npmrc` public-hoist-pattern workarounds.
|
|
108
124
|
|
|
109
125
|
## Vercel build cache (not smoke)
|
|
110
126
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/site-check",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Validate SE marketing sites (sitemap, llms.txt) and download markdown files preserving structure",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"validate-build-routes": "./validate-build-routes.mjs",
|
|
50
50
|
"revalidation-matrix-test": "./revalidation-matrix-test.mjs",
|
|
51
51
|
"develop-sites-timing": "./develop-sites-timing.mjs",
|
|
52
|
-
"markdown-accuracy-audit": "./markdown-accuracy-audit.mjs"
|
|
52
|
+
"markdown-accuracy-audit": "./markdown-accuracy-audit.mjs",
|
|
53
|
+
"check-no-context-workarounds": "./check-no-context-workarounds.mjs"
|
|
53
54
|
},
|
|
54
55
|
"files": [
|
|
55
56
|
"dist",
|
|
@@ -63,7 +64,8 @@
|
|
|
63
64
|
"validate-build-routes.mjs",
|
|
64
65
|
"revalidation-matrix-test.mjs",
|
|
65
66
|
"develop-sites-timing.mjs",
|
|
66
|
-
"markdown-accuracy-audit.mjs"
|
|
67
|
+
"markdown-accuracy-audit.mjs",
|
|
68
|
+
"check-no-context-workarounds.mjs"
|
|
67
69
|
],
|
|
68
70
|
"keywords": [
|
|
69
71
|
"sitemap",
|
|
@@ -95,6 +97,6 @@
|
|
|
95
97
|
"type-check": "tsc --noEmit",
|
|
96
98
|
"lint": "biome lint .",
|
|
97
99
|
"clean": "rm -rf dist .turbo *.tsbuildinfo",
|
|
98
|
-
"test": "pnpm build && node --test scripts/screaming-frog-audit.test.mjs scripts/production-audit.test.mjs scripts/discovery.test.mjs scripts/smoke-test.test.mjs scripts/analytics-context-bundle.test.mjs scripts/revalidation-matrix.test.mjs scripts/develop-sites-timing.test.mjs scripts/markdown-accuracy-audit.test.mjs"
|
|
100
|
+
"test": "pnpm build && node --test scripts/screaming-frog-audit.test.mjs scripts/production-audit.test.mjs scripts/discovery.test.mjs scripts/smoke-test.test.mjs scripts/analytics-context-bundle.test.mjs scripts/check-no-context-workarounds.test.mjs scripts/revalidation-matrix.test.mjs scripts/develop-sites-timing.test.mjs scripts/markdown-accuracy-audit.test.mjs"
|
|
99
101
|
}
|
|
100
102
|
}
|