@turbo/codemod 1.7.0-canary.4 → 1.7.0-canary.5
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/index.js +2 -2
- package/dist/transforms/set-default-outputs.js +21 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -26,7 +26,7 @@ var import_update_check = __toESM(require("update-check"));
|
|
26
26
|
// package.json
|
27
27
|
var package_default = {
|
28
28
|
name: "@turbo/codemod",
|
29
|
-
version: "1.7.0-canary.
|
29
|
+
version: "1.7.0-canary.5",
|
30
30
|
description: "Provides Codemod transformations to help upgrade your Turborepo codebase when a feature is deprecated.",
|
31
31
|
homepage: "https://turbo.build/repo",
|
32
32
|
license: "MPL-2.0",
|
@@ -292,7 +292,7 @@ async function notifyUpdate() {
|
|
292
292
|
}
|
293
293
|
function listTransforms() {
|
294
294
|
console.log(TRANSFORMER_INQUIRER_CHOICES.map((x) => `- ${import_chalk2.default.cyan(x.value)}`).join("\n"));
|
295
|
-
process.exit(
|
295
|
+
process.exit(0);
|
296
296
|
}
|
297
297
|
function expandFilePathsIfNeeded(filesBeforeExpansion) {
|
298
298
|
const shouldExpandFiles = filesBeforeExpansion.some((file) => file.includes("*"));
|
@@ -43,7 +43,7 @@ function ok(...args) {
|
|
43
43
|
|
44
44
|
// src/transforms/set-default-outputs.ts
|
45
45
|
var import_chalk2 = __toESM(require("chalk"));
|
46
|
-
var DEFAULT_OUTPUTS = ["dist
|
46
|
+
var DEFAULT_OUTPUTS = ["dist/**", "build/**"];
|
47
47
|
function addDefaultOutputs(files, flags) {
|
48
48
|
if (files.length !== 1) {
|
49
49
|
return;
|
@@ -68,33 +68,42 @@ function addDefaultOutputs(files, flags) {
|
|
68
68
|
const rootTurboJson = import_fs_extra.default.readJsonSync(turboConfigPath);
|
69
69
|
let skippedCount = 0;
|
70
70
|
let modifiedCount = 0;
|
71
|
-
let
|
71
|
+
let unmodifiedCount = 0;
|
72
72
|
for (const [taskName, taskDef] of Object.entries(rootTurboJson.pipeline)) {
|
73
73
|
if (!taskDef.outputs) {
|
74
74
|
ok(`Updating outputs for ${taskName}`);
|
75
|
-
|
76
|
-
|
75
|
+
if (flags.dry) {
|
76
|
+
skippedCount++;
|
77
|
+
} else {
|
78
|
+
taskDef.outputs = DEFAULT_OUTPUTS;
|
79
|
+
modifiedCount++;
|
80
|
+
}
|
77
81
|
} else if (Array.isArray(taskDef.outputs) && taskDef.outputs.length === 0) {
|
78
82
|
ok(`Removing outputs: [] from ${taskName} as that is now the default behavior`);
|
79
|
-
|
80
|
-
|
83
|
+
if (flags.dry) {
|
84
|
+
skippedCount++;
|
85
|
+
} else {
|
86
|
+
delete taskDef.outputs;
|
87
|
+
modifiedCount++;
|
88
|
+
}
|
81
89
|
} else {
|
82
|
-
|
90
|
+
unmodifiedCount++;
|
83
91
|
skip(`Skipping "${taskName}", it already has an outputs key defined`);
|
84
92
|
}
|
85
93
|
}
|
86
|
-
if (
|
94
|
+
if (flags.dry) {
|
95
|
+
console.log(JSON.stringify(rootTurboJson, null, 2));
|
96
|
+
} else {
|
87
97
|
import_fs_extra.default.writeJsonSync(turboConfigPath, rootTurboJson, {
|
88
98
|
spaces: 2
|
89
99
|
});
|
90
|
-
} else {
|
91
|
-
console.log(JSON.stringify(rootTurboJson, null, 2));
|
92
100
|
}
|
93
101
|
console.log("All done.");
|
94
102
|
console.log("Results:");
|
95
|
-
console.log(import_chalk2.default.
|
96
|
-
console.log(import_chalk2.default.red(`${deletedEmptyOutputs} unmodified`));
|
103
|
+
console.log(import_chalk2.default.red(`0 errors`));
|
97
104
|
console.log(import_chalk2.default.yellow(`${skippedCount} skipped`));
|
105
|
+
console.log(import_chalk2.default.yellow(`${unmodifiedCount} unmodified`));
|
106
|
+
console.log(import_chalk2.default.green(`${modifiedCount} modified`));
|
98
107
|
}
|
99
108
|
// Annotate the CommonJS export names for ESM import in node:
|
100
109
|
0 && (module.exports = {});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@turbo/codemod",
|
3
|
-
"version": "1.7.0-canary.
|
3
|
+
"version": "1.7.0-canary.5",
|
4
4
|
"description": "Provides Codemod transformations to help upgrade your Turborepo codebase when a feature is deprecated.",
|
5
5
|
"homepage": "https://turbo.build/repo",
|
6
6
|
"license": "MPL-2.0",
|