@mittwald/flow-codemods 1.1.8 → 1.1.9
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/upgrade.d.ts +7 -0
- package/dist/cli/upgrade.d.ts.map +1 -1
- package/dist/cli/upgrade.js +18 -14
- package/dist/cli.js +4 -0
- package/package.json +2 -2
package/dist/cli/upgrade.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ export interface UpgradeDeps {
|
|
|
13
13
|
isDirty: (cwd: string) => boolean;
|
|
14
14
|
readInstalledVersion: (cwd: string, name: string) => string | undefined;
|
|
15
15
|
log: (message: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Emit ANSI colour in the by-hand list. Off by default so a test sees plain
|
|
18
|
+
* text.
|
|
19
|
+
*/
|
|
20
|
+
color?: boolean;
|
|
21
|
+
/** Terminal width to wrap the by-hand list's prose to. */
|
|
22
|
+
width?: number;
|
|
16
23
|
}
|
|
17
24
|
export declare const defaultUpgradeDeps: (cwd: string) => UpgradeDeps;
|
|
18
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/cli/upgrade.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAItE,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAsB,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI/C,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,2EAA2E;IAC3E,MAAM,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AM,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,QAAS,MAAM,KAAG,WAS/C,CAAC;AA2BH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,WACb,aAAa,QACf,WAAW,KAChB,OAAO,CAAC,MAAM,CAqNhB,CAAC"}
|
package/dist/cli/upgrade.js
CHANGED
|
@@ -187,26 +187,20 @@ export const runUpgrade = async (parsed, deps) => {
|
|
|
187
187
|
log(` ${entry.id}: ${result.changed} file(s) changed`);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
// Selection has no lower bound (see `selectEntries`), so this loop can run
|
|
191
|
-
// every codemod in the catalogue on a project that never crossed a version
|
|
192
|
-
// at all — "N run, 0 changed" is the confirmation that there was nothing to
|
|
193
|
-
// catch up on, not a list of new work.
|
|
194
|
-
if (ranCount > 0) {
|
|
195
|
-
log(`\n${ranCount} codemod${ranCount === 1 ? "" : "s"} run, ${changedCount} changed something.`);
|
|
196
|
-
}
|
|
197
190
|
if (byHand.length > 0) {
|
|
198
191
|
log(`\n${byHand.length} migration(s) in this range have no codemod — apply them by hand:\n`);
|
|
199
|
-
// `frame: false` — this already printed the heading above and
|
|
200
|
-
//
|
|
201
|
-
// renderList's own frame
|
|
202
|
-
//
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
// the only thing left that says so now that hiding it is gone.
|
|
192
|
+
// `frame: false` — this already printed the heading above, and the
|
|
193
|
+
// closing summaries below cover the same aggregate ("N codemods run, N
|
|
194
|
+
// changed something") renderList's own frame would otherwise repeat.
|
|
195
|
+
// `range` is still passed so each entry gets its catch-up mark — a manual
|
|
196
|
+
// entry that shipped at or before `current` may already be done, and the
|
|
197
|
+
// mark is the only thing left that says so now that hiding it is gone.
|
|
206
198
|
log(renderList({
|
|
207
199
|
entries: byHand,
|
|
208
200
|
range: { from: current, to: target },
|
|
209
201
|
json: false,
|
|
202
|
+
color: deps.color,
|
|
203
|
+
width: deps.width,
|
|
210
204
|
// The same path this run used, so a command copied out of the by-hand
|
|
211
205
|
// block works instead of falling back to a hardcoded `src`.
|
|
212
206
|
path: displaySourcePath(parsed.path, cwd),
|
|
@@ -217,6 +211,16 @@ export const runUpgrade = async (parsed, deps) => {
|
|
|
217
211
|
else {
|
|
218
212
|
log("\nNo migration in this range required a change by hand.");
|
|
219
213
|
}
|
|
214
|
+
// Both closing summaries trail everything else, not just each other: a
|
|
215
|
+
// multi-screen by-hand list would otherwise scroll them out of sight before
|
|
216
|
+
// the reader reaches the end — exactly when they want the counts. Selection
|
|
217
|
+
// has no lower bound (see `selectEntries`), so this loop can run every
|
|
218
|
+
// codemod in the catalogue on a project that never crossed a version at
|
|
219
|
+
// all — "N run, 0 changed" is the confirmation that there was nothing to
|
|
220
|
+
// catch up on, not a list of new work.
|
|
221
|
+
if (ranCount > 0) {
|
|
222
|
+
log(`\n${ranCount} codemod${ranCount === 1 ? "" : "s"} run, ${changedCount} changed something.`);
|
|
223
|
+
}
|
|
220
224
|
if (incomplete.length > 0) {
|
|
221
225
|
log(`\n${incomplete.length} codemod(s) did not complete: ${incomplete.join(", ")}`);
|
|
222
226
|
}
|
package/dist/cli.js
CHANGED
|
@@ -107,6 +107,10 @@ const main = async () => {
|
|
|
107
107
|
return runUpgrade(parsed, {
|
|
108
108
|
...defaultUpgradeDeps(process.cwd()),
|
|
109
109
|
choose,
|
|
110
|
+
// Same rule as `list`: colour only for a person at a real terminal,
|
|
111
|
+
// off under `NO_COLOR` or a pipe so the output stays greppable.
|
|
112
|
+
color: process.stdout.isTTY === true && process.env.NO_COLOR === undefined,
|
|
113
|
+
width: Math.min(Math.max(process.stdout.columns ?? 80, 60), 100),
|
|
110
114
|
});
|
|
111
115
|
}
|
|
112
116
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-codemods",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Codemods and an upgrade CLI for consumers of Flow, mittwald's design system",
|
|
6
6
|
"homepage": "https://flow.mittwald.de",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"vitest": "^4.1.11",
|
|
38
38
|
"yaml": "^2.8.1"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "304a819a825704d52f912100ed3042fcd42d7946"
|
|
41
41
|
}
|