@omnifyjp/ts 6.3.7 → 6.3.8
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/dist/cli.js +16 -1
- package/dist/php/pint-format.d.ts +6 -0
- package/dist/php/pint-format.js +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -322,7 +322,17 @@ program
|
|
|
322
322
|
// Laravel Pint when it's installed in the project. Same preset
|
|
323
323
|
// the project's CI already uses, so codegen output stops failing
|
|
324
324
|
// `pint --test` and devs no longer need a manual sweep after
|
|
325
|
-
// every `omnify generate`.
|
|
325
|
+
// every `omnify generate`.
|
|
326
|
+
//
|
|
327
|
+
// NOT a silent no-op when Pint is missing any more. It used to be, and that cost a
|
|
328
|
+
// consumer several investigation sessions: their CI regenerated without Pint on PATH,
|
|
329
|
+
// wrote 927 files differing from the committed (Pint-formatted) tree, and the only
|
|
330
|
+
// evidence was one ABSENT log line. It was read as a Linux/Darwin build divergence and
|
|
331
|
+
// chased as far as "pick a canonical platform" before anyone ran the two commands that
|
|
332
|
+
// settle it (godx-jp/godx-corebooks#108, reproduced exactly: hide `vendor/bin/pint`,
|
|
333
|
+
// regenerate, 927 files; restore it, 0).
|
|
334
|
+
//
|
|
335
|
+
// The opt-out (`OMNIFY_NO_PINT=1`) stays quiet — that one is a choice, not a surprise.
|
|
326
336
|
if (writtenPaths.length > 0) {
|
|
327
337
|
const pintResult = runPintFormat(writtenPaths);
|
|
328
338
|
if (pintResult.ran) {
|
|
@@ -337,6 +347,11 @@ program
|
|
|
337
347
|
}
|
|
338
348
|
}
|
|
339
349
|
}
|
|
350
|
+
else if (pintResult.skipped === 'pint-not-found') {
|
|
351
|
+
console.warn(` [omnify] Laravel Pint not found — ${writtenPaths.length} PHP file(s) written UNFORMATTED.`);
|
|
352
|
+
console.warn(' If this project commits generated PHP, the output will differ from a tree formatted by Pint.');
|
|
353
|
+
console.warn(' Run `composer install` before `omnify generate`, or set OMNIFY_NO_PINT=1 to silence this deliberately.');
|
|
354
|
+
}
|
|
340
355
|
}
|
|
341
356
|
// Orphan cleanup: when a schema is removed, renamed, flipped from
|
|
342
357
|
// kind:object → kind:pivot, or opted out via `options.service: false`,
|
|
@@ -38,6 +38,12 @@ export interface PintFormatResult {
|
|
|
38
38
|
exitStatus: number | null;
|
|
39
39
|
/** Captured stderr when pint failed (status != 0). */
|
|
40
40
|
errorMessage?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Why the run did not happen, when `ran` is false. The caller needs the three apart: only
|
|
43
|
+
* `pint-not-found` is worth telling a human about, and it is the one that silently changes what
|
|
44
|
+
* gets written to disk (godx-jp/godx-corebooks#108 — 927 files, reproduced).
|
|
45
|
+
*/
|
|
46
|
+
skipped?: 'no-php-files' | 'opted-out' | 'pint-not-found';
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
49
|
* Run Laravel Pint on the given PHP files (absolute paths). No-op if
|
package/dist/php/pint-format.js
CHANGED
|
@@ -63,21 +63,21 @@ export function findPintBinary(anyWrittenPhpPath) {
|
|
|
63
63
|
*/
|
|
64
64
|
export function runPintFormat(writtenPhpPaths) {
|
|
65
65
|
if (writtenPhpPaths.length === 0) {
|
|
66
|
-
return { ran: false, pintPath: null, formattedCount: 0, exitStatus: null };
|
|
66
|
+
return { ran: false, pintPath: null, formattedCount: 0, exitStatus: null, skipped: 'no-php-files' };
|
|
67
67
|
}
|
|
68
68
|
// Opt-out (#174). The auto-run hides what the generators actually emit: a
|
|
69
69
|
// template that Pint rewrites looks fine here and produces churn in every
|
|
70
70
|
// project where Pint is absent or does not run. `OMNIFY_NO_PINT=1` is how
|
|
71
71
|
// the repo's own fixture check measures the raw output.
|
|
72
72
|
if (process.env.OMNIFY_NO_PINT === '1') {
|
|
73
|
-
return { ran: false, pintPath: null, formattedCount: 0, exitStatus: null };
|
|
73
|
+
return { ran: false, pintPath: null, formattedCount: 0, exitStatus: null, skipped: 'opted-out' };
|
|
74
74
|
}
|
|
75
75
|
// Resolution walks up from a written file. Trying only the first one makes
|
|
76
76
|
// it depend on emission order — a single file outside the Laravel root and
|
|
77
77
|
// the whole run goes unformatted, silently. Try each until one resolves.
|
|
78
78
|
const pintPath = writtenPhpPaths.reduce((found, path) => found ?? findPintBinary(path), null);
|
|
79
79
|
if (!pintPath) {
|
|
80
|
-
return { ran: false, pintPath: null, formattedCount: 0, exitStatus: null };
|
|
80
|
+
return { ran: false, pintPath: null, formattedCount: 0, exitStatus: null, skipped: 'pint-not-found' };
|
|
81
81
|
}
|
|
82
82
|
// Pint's working dir should be the Laravel project root (where
|
|
83
83
|
// composer.json + pint.json live). The pint binary is at
|