tsdown 0.14.0 → 0.14.2
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/README.md +17 -1
- package/dist/{config-77IY7Jdj.d.mts → config-DwMASPo6.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{migrate-BCQUL2Gs.mjs → migrate-DQpxfr1J.mjs} +10 -16
- package/dist/package-DOwY1eta.mjs +5 -0
- package/dist/plugins.d.mts +1 -1
- package/dist/plugins.mjs +1 -1
- package/dist/run.d.mts +1 -1
- package/dist/run.mjs +8 -7
- package/dist/{src-D_PDH4ZS.mjs → src-BhIGOkxO.mjs} +50 -43
- package/dist/{types-BMMC0pbr.d.mts → types-cXo_SNGd.d.mts} +13 -13
- package/package.json +20 -28
- package/dist/cli-BwOoKKTM.mjs +0 -46
- package/dist/cli.d.mts +0 -4
- package/dist/cli.mjs +0 -5
- package/dist/config-DsBEbB6I.mjs +0 -7
- package/dist/logger-YArsxPto.mjs +0 -144
- package/dist/migrate-Cl62m5IG.mjs +0 -126
- package/dist/migrate.d.mts +0 -10
- package/dist/migrate.mjs +0 -126
- package/dist/package-DOiAuQ-5.mjs +0 -5
- package/dist/package-DwljelGW.mjs +0 -5
- package/dist/package-TDRl9aMv.mjs +0 -5
- package/dist/src-D6AiyRka.mjs +0 -1329
- package/dist/src-lmHdfLhi.mjs +0 -1335
package/dist/cli.d.mts
DELETED
package/dist/cli.mjs
DELETED
package/dist/config-DsBEbB6I.mjs
DELETED
package/dist/logger-YArsxPto.mjs
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { bgRed, bgYellow, blue, green, rgb, yellow } from "ansis";
|
|
2
|
-
|
|
3
|
-
//#region src/utils/general.ts
|
|
4
|
-
function toArray(val, defaultValue) {
|
|
5
|
-
if (Array.isArray(val)) return val;
|
|
6
|
-
else if (val == null) {
|
|
7
|
-
if (defaultValue) return [defaultValue];
|
|
8
|
-
return [];
|
|
9
|
-
} else return [val];
|
|
10
|
-
}
|
|
11
|
-
function resolveComma(arr) {
|
|
12
|
-
return arr.flatMap((format$1) => format$1.split(","));
|
|
13
|
-
}
|
|
14
|
-
function resolveRegex(str) {
|
|
15
|
-
if (typeof str === "string" && str.length > 2 && str[0] === "/" && str.at(-1) === "/") return new RegExp(str.slice(1, -1));
|
|
16
|
-
return str;
|
|
17
|
-
}
|
|
18
|
-
function debounce(fn, wait) {
|
|
19
|
-
let timeout;
|
|
20
|
-
return function(...args) {
|
|
21
|
-
if (timeout) clearTimeout(timeout);
|
|
22
|
-
timeout = setTimeout(() => {
|
|
23
|
-
timeout = void 0;
|
|
24
|
-
fn.apply(this, args);
|
|
25
|
-
}, wait);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function slash(string) {
|
|
29
|
-
return string.replaceAll("\\", "/");
|
|
30
|
-
}
|
|
31
|
-
const noop = (v) => v;
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/utils/logger.ts
|
|
35
|
-
const LogLevels = {
|
|
36
|
-
silent: 0,
|
|
37
|
-
error: 1,
|
|
38
|
-
warn: 2,
|
|
39
|
-
info: 3
|
|
40
|
-
};
|
|
41
|
-
function format(msgs) {
|
|
42
|
-
return msgs.filter((arg) => arg !== void 0 && arg !== false).join(" ");
|
|
43
|
-
}
|
|
44
|
-
const warnedMessages = /* @__PURE__ */ new Set();
|
|
45
|
-
function createLogger(level = "info", { customLogger, console = globalThis.console, failOnWarn = false } = {}) {
|
|
46
|
-
if (customLogger) return customLogger;
|
|
47
|
-
function output(type, msg) {
|
|
48
|
-
const thresh = LogLevels[logger.level];
|
|
49
|
-
if (thresh < LogLevels[type]) return;
|
|
50
|
-
const method = type === "info" ? "log" : type;
|
|
51
|
-
console[method](msg);
|
|
52
|
-
}
|
|
53
|
-
const logger = {
|
|
54
|
-
level,
|
|
55
|
-
info(...msgs) {
|
|
56
|
-
output("info", `${blue`ℹ`} ${format(msgs)}`);
|
|
57
|
-
},
|
|
58
|
-
warn(...msgs) {
|
|
59
|
-
const message = format(msgs);
|
|
60
|
-
if (failOnWarn) throw new Error(message);
|
|
61
|
-
warnedMessages.add(message);
|
|
62
|
-
output("warn", `\n${bgYellow` WARN `} ${message}\n`);
|
|
63
|
-
},
|
|
64
|
-
warnOnce(...msgs) {
|
|
65
|
-
const message = format(msgs);
|
|
66
|
-
if (warnedMessages.has(message)) return;
|
|
67
|
-
if (failOnWarn) throw new Error(message);
|
|
68
|
-
warnedMessages.add(message);
|
|
69
|
-
output("warn", `\n${bgYellow` WARN `} ${message}\n`);
|
|
70
|
-
},
|
|
71
|
-
error(...msgs) {
|
|
72
|
-
output("error", `\n${bgRed` ERROR `} ${format(msgs)}\n`);
|
|
73
|
-
},
|
|
74
|
-
success(...msgs) {
|
|
75
|
-
output("info", `${green`✔`} ${format(msgs)}`);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
return logger;
|
|
79
|
-
}
|
|
80
|
-
const globalLogger = createLogger();
|
|
81
|
-
function prettyName(name) {
|
|
82
|
-
if (!name) return void 0;
|
|
83
|
-
return generateColor(name)(`[${name}]`);
|
|
84
|
-
}
|
|
85
|
-
function prettyFormat(format$1) {
|
|
86
|
-
const formatColor = format$1 === "es" ? blue : format$1 === "cjs" ? yellow : noop;
|
|
87
|
-
let formatText;
|
|
88
|
-
switch (format$1) {
|
|
89
|
-
case "es":
|
|
90
|
-
formatText = "ESM";
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
formatText = format$1.toUpperCase();
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
return formatColor(`[${formatText}]`);
|
|
97
|
-
}
|
|
98
|
-
const colors = /* @__PURE__ */ new Map();
|
|
99
|
-
function generateColor(name = "default") {
|
|
100
|
-
if (colors.has(name)) return colors.get(name);
|
|
101
|
-
let color;
|
|
102
|
-
if (name === "default") color = blue;
|
|
103
|
-
else {
|
|
104
|
-
let hash = 0;
|
|
105
|
-
for (let i = 0; i < name.length; i++) hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
106
|
-
const hue = hash % 360;
|
|
107
|
-
const saturation = 35;
|
|
108
|
-
const lightness = 55;
|
|
109
|
-
color = rgb(...hslToRgb(hue, saturation, lightness));
|
|
110
|
-
}
|
|
111
|
-
colors.set(name, color);
|
|
112
|
-
return color;
|
|
113
|
-
}
|
|
114
|
-
function hslToRgb(h, s, l) {
|
|
115
|
-
h = h % 360;
|
|
116
|
-
h /= 360;
|
|
117
|
-
s /= 100;
|
|
118
|
-
l /= 100;
|
|
119
|
-
let r, g, b;
|
|
120
|
-
if (s === 0) r = g = b = l;
|
|
121
|
-
else {
|
|
122
|
-
const q = l < .5 ? l * (1 + s) : l + s - l * s;
|
|
123
|
-
const p = 2 * l - q;
|
|
124
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
125
|
-
g = hue2rgb(p, q, h);
|
|
126
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
127
|
-
}
|
|
128
|
-
return [
|
|
129
|
-
Math.max(0, Math.round(r * 255)),
|
|
130
|
-
Math.max(0, Math.round(g * 255)),
|
|
131
|
-
Math.max(0, Math.round(b * 255))
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
function hue2rgb(p, q, t) {
|
|
135
|
-
if (t < 0) t += 1;
|
|
136
|
-
if (t > 1) t -= 1;
|
|
137
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
138
|
-
if (t < 1 / 2) return q;
|
|
139
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
140
|
-
return p;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
//#endregion
|
|
144
|
-
export { LogLevels, createLogger, debounce, generateColor, globalLogger, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { globalLogger } from "./logger-CGMSjTLn.mjs";
|
|
2
|
-
import { version } from "./package-DOiAuQ-5.mjs";
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
import { bold, green, underline } from "ansis";
|
|
5
|
-
import { readFile, unlink, writeFile } from "node:fs/promises";
|
|
6
|
-
import { existsSync } from "node:fs";
|
|
7
|
-
import { createInterface } from "node:readline/promises";
|
|
8
|
-
|
|
9
|
-
//#region src/migrate.ts
|
|
10
|
-
async function migrate({ cwd, dryRun }) {
|
|
11
|
-
if (dryRun) globalLogger.info("Dry run enabled. No changes were made.");
|
|
12
|
-
else {
|
|
13
|
-
const rl = createInterface({
|
|
14
|
-
input: process.stdin,
|
|
15
|
-
output: process.stdout
|
|
16
|
-
});
|
|
17
|
-
globalLogger.warn(`\n\nBefore proceeding, review the migration guide at ${underline`https://tsdown.dev/guide/migrate-from-tsup`}, as this process will modify your files.\nUncommitted changes will be lost. Use the ${green`--dry-run`} flag to preview changes without applying them.`);
|
|
18
|
-
const input = await rl.question(bold`Continue? (Y/n) `);
|
|
19
|
-
rl.close();
|
|
20
|
-
const confirm = input.toLowerCase() === "y" || input === "";
|
|
21
|
-
if (!confirm) {
|
|
22
|
-
globalLogger.error("Migration cancelled.");
|
|
23
|
-
process.exitCode = 1;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (cwd) process.chdir(cwd);
|
|
28
|
-
let migrated = await migratePackageJson(dryRun);
|
|
29
|
-
if (await migrateTsupConfig(dryRun)) migrated = true;
|
|
30
|
-
if (migrated) globalLogger.success("Migration completed. Remember to run install command with your package manager.");
|
|
31
|
-
else {
|
|
32
|
-
globalLogger.error("No migration performed.");
|
|
33
|
-
process.exitCode = 1;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async function migratePackageJson(dryRun) {
|
|
37
|
-
if (!existsSync("package.json")) {
|
|
38
|
-
globalLogger.error("No package.json found");
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
const pkgRaw = await readFile("package.json", "utf-8");
|
|
42
|
-
let pkg = JSON.parse(pkgRaw);
|
|
43
|
-
const semver = `^${version}`;
|
|
44
|
-
let found = false;
|
|
45
|
-
if (pkg.dependencies?.tsup) {
|
|
46
|
-
globalLogger.info("Migrating `dependencies` to tsdown.");
|
|
47
|
-
found = true;
|
|
48
|
-
pkg.dependencies = renameKey(pkg.dependencies, "tsup", "tsdown", semver);
|
|
49
|
-
}
|
|
50
|
-
if (pkg.devDependencies?.tsup) {
|
|
51
|
-
globalLogger.info("Migrating `devDependencies` to tsdown.");
|
|
52
|
-
found = true;
|
|
53
|
-
pkg.devDependencies = renameKey(pkg.devDependencies, "tsup", "tsdown", semver);
|
|
54
|
-
}
|
|
55
|
-
if (pkg.peerDependencies?.tsup) {
|
|
56
|
-
globalLogger.info("Migrating `peerDependencies` to tsdown.");
|
|
57
|
-
found = true;
|
|
58
|
-
pkg.peerDependencies = renameKey(pkg.peerDependencies, "tsup", "tsdown", "*");
|
|
59
|
-
}
|
|
60
|
-
if (pkg.scripts) {
|
|
61
|
-
for (const key of Object.keys(pkg.scripts)) if (pkg.scripts[key].includes("tsup")) {
|
|
62
|
-
globalLogger.info(`Migrating \`${key}\` script to tsdown`);
|
|
63
|
-
found = true;
|
|
64
|
-
pkg.scripts[key] = pkg.scripts[key].replaceAll(/tsup(?:-node)?/g, "tsdown");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (pkg.tsup) {
|
|
68
|
-
globalLogger.info("Migrating `tsup` field in package.json to `tsdown`.");
|
|
69
|
-
found = true;
|
|
70
|
-
pkg = renameKey(pkg, "tsup", "tsdown");
|
|
71
|
-
}
|
|
72
|
-
if (!found) {
|
|
73
|
-
globalLogger.warn("No tsup-related fields found in package.json");
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
const pkgStr = `${JSON.stringify(pkg, null, 2)}\n`;
|
|
77
|
-
if (dryRun) {
|
|
78
|
-
const { createPatch } = await import("diff");
|
|
79
|
-
globalLogger.info("[dry-run] package.json:");
|
|
80
|
-
console.info(createPatch("package.json", pkgRaw, pkgStr));
|
|
81
|
-
} else {
|
|
82
|
-
await writeFile("package.json", pkgStr);
|
|
83
|
-
globalLogger.success("Migrated `package.json`");
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
const TSUP_FILES = [
|
|
88
|
-
"tsup.config.ts",
|
|
89
|
-
"tsup.config.cts",
|
|
90
|
-
"tsup.config.mts",
|
|
91
|
-
"tsup.config.js",
|
|
92
|
-
"tsup.config.cjs",
|
|
93
|
-
"tsup.config.mjs",
|
|
94
|
-
"tsup.config.json"
|
|
95
|
-
];
|
|
96
|
-
async function migrateTsupConfig(dryRun) {
|
|
97
|
-
let found = false;
|
|
98
|
-
for (const file of TSUP_FILES) {
|
|
99
|
-
if (!existsSync(file)) continue;
|
|
100
|
-
globalLogger.info(`Found \`${file}\``);
|
|
101
|
-
found = true;
|
|
102
|
-
const tsupConfigRaw = await readFile(file, "utf-8");
|
|
103
|
-
const tsupConfig = tsupConfigRaw.replaceAll(/\btsup\b/g, "tsdown").replaceAll(/\bTSUP\b/g, "TSDOWN");
|
|
104
|
-
const renamed = file.replaceAll("tsup", "tsdown");
|
|
105
|
-
if (dryRun) {
|
|
106
|
-
const { createTwoFilesPatch } = await import("diff");
|
|
107
|
-
globalLogger.info(`[dry-run] ${file} -> ${renamed}:`);
|
|
108
|
-
console.info(createTwoFilesPatch(file, renamed, tsupConfigRaw, tsupConfig));
|
|
109
|
-
} else {
|
|
110
|
-
await writeFile(renamed, tsupConfig, "utf8");
|
|
111
|
-
await unlink(file);
|
|
112
|
-
globalLogger.success(`Migrated \`${file}\` to \`${renamed}\``);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (!found) globalLogger.warn("No tsup config found");
|
|
116
|
-
return found;
|
|
117
|
-
}
|
|
118
|
-
function renameKey(obj, oldKey, newKey, newValue) {
|
|
119
|
-
const newObj = {};
|
|
120
|
-
for (const key of Object.keys(obj)) if (key === oldKey) newObj[newKey] = newValue || obj[oldKey];
|
|
121
|
-
else newObj[key] = obj[key];
|
|
122
|
-
return newObj;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
//#endregion
|
|
126
|
-
export { migrate };
|
package/dist/migrate.d.mts
DELETED
package/dist/migrate.mjs
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { version } from "./package-DwljelGW.mjs";
|
|
2
|
-
import { globalLogger } from "./logger-YArsxPto.mjs";
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
import { bold, green, underline } from "ansis";
|
|
5
|
-
import { readFile, unlink, writeFile } from "node:fs/promises";
|
|
6
|
-
import { existsSync } from "node:fs";
|
|
7
|
-
import { createInterface } from "node:readline/promises";
|
|
8
|
-
|
|
9
|
-
//#region src/migrate.ts
|
|
10
|
-
async function migrate({ cwd, dryRun }) {
|
|
11
|
-
if (dryRun) globalLogger.info("Dry run enabled. No changes were made.");
|
|
12
|
-
else {
|
|
13
|
-
const rl = createInterface({
|
|
14
|
-
input: process.stdin,
|
|
15
|
-
output: process.stdout
|
|
16
|
-
});
|
|
17
|
-
globalLogger.warn(`\n\nBefore proceeding, review the migration guide at ${underline`https://tsdown.dev/guide/migrate-from-tsup`}, as this process will modify your files.\nUncommitted changes will be lost. Use the ${green`--dry-run`} flag to preview changes without applying them.`);
|
|
18
|
-
const input = await rl.question(bold`Continue? (Y/n) `);
|
|
19
|
-
rl.close();
|
|
20
|
-
const confirm = input.toLowerCase() === "y" || input === "";
|
|
21
|
-
if (!confirm) {
|
|
22
|
-
globalLogger.error("Migration cancelled.");
|
|
23
|
-
process.exitCode = 1;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (cwd) process.chdir(cwd);
|
|
28
|
-
let migrated = await migratePackageJson(dryRun);
|
|
29
|
-
if (await migrateTsupConfig(dryRun)) migrated = true;
|
|
30
|
-
if (migrated) globalLogger.success("Migration completed. Remember to run install command with your package manager.");
|
|
31
|
-
else {
|
|
32
|
-
globalLogger.error("No migration performed.");
|
|
33
|
-
process.exitCode = 1;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async function migratePackageJson(dryRun) {
|
|
37
|
-
if (!existsSync("package.json")) {
|
|
38
|
-
globalLogger.error("No package.json found");
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
const pkgRaw = await readFile("package.json", "utf-8");
|
|
42
|
-
let pkg = JSON.parse(pkgRaw);
|
|
43
|
-
const semver = `^${version}`;
|
|
44
|
-
let found = false;
|
|
45
|
-
if (pkg.dependencies?.tsup) {
|
|
46
|
-
globalLogger.info("Migrating `dependencies` to tsdown.");
|
|
47
|
-
found = true;
|
|
48
|
-
pkg.dependencies = renameKey(pkg.dependencies, "tsup", "tsdown", semver);
|
|
49
|
-
}
|
|
50
|
-
if (pkg.devDependencies?.tsup) {
|
|
51
|
-
globalLogger.info("Migrating `devDependencies` to tsdown.");
|
|
52
|
-
found = true;
|
|
53
|
-
pkg.devDependencies = renameKey(pkg.devDependencies, "tsup", "tsdown", semver);
|
|
54
|
-
}
|
|
55
|
-
if (pkg.peerDependencies?.tsup) {
|
|
56
|
-
globalLogger.info("Migrating `peerDependencies` to tsdown.");
|
|
57
|
-
found = true;
|
|
58
|
-
pkg.peerDependencies = renameKey(pkg.peerDependencies, "tsup", "tsdown", "*");
|
|
59
|
-
}
|
|
60
|
-
if (pkg.scripts) {
|
|
61
|
-
for (const key of Object.keys(pkg.scripts)) if (pkg.scripts[key].includes("tsup")) {
|
|
62
|
-
globalLogger.info(`Migrating \`${key}\` script to tsdown`);
|
|
63
|
-
found = true;
|
|
64
|
-
pkg.scripts[key] = pkg.scripts[key].replaceAll(/tsup(?:-node)?/g, "tsdown");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (pkg.tsup) {
|
|
68
|
-
globalLogger.info("Migrating `tsup` field in package.json to `tsdown`.");
|
|
69
|
-
found = true;
|
|
70
|
-
pkg = renameKey(pkg, "tsup", "tsdown");
|
|
71
|
-
}
|
|
72
|
-
if (!found) {
|
|
73
|
-
globalLogger.warn("No tsup-related fields found in package.json");
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
const pkgStr = `${JSON.stringify(pkg, null, 2)}\n`;
|
|
77
|
-
if (dryRun) {
|
|
78
|
-
const { createPatch } = await import("diff");
|
|
79
|
-
globalLogger.info("[dry-run] package.json:");
|
|
80
|
-
console.info(createPatch("package.json", pkgRaw, pkgStr));
|
|
81
|
-
} else {
|
|
82
|
-
await writeFile("package.json", pkgStr);
|
|
83
|
-
globalLogger.success("Migrated `package.json`");
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
const TSUP_FILES = [
|
|
88
|
-
"tsup.config.ts",
|
|
89
|
-
"tsup.config.cts",
|
|
90
|
-
"tsup.config.mts",
|
|
91
|
-
"tsup.config.js",
|
|
92
|
-
"tsup.config.cjs",
|
|
93
|
-
"tsup.config.mjs",
|
|
94
|
-
"tsup.config.json"
|
|
95
|
-
];
|
|
96
|
-
async function migrateTsupConfig(dryRun) {
|
|
97
|
-
let found = false;
|
|
98
|
-
for (const file of TSUP_FILES) {
|
|
99
|
-
if (!existsSync(file)) continue;
|
|
100
|
-
globalLogger.info(`Found \`${file}\``);
|
|
101
|
-
found = true;
|
|
102
|
-
const tsupConfigRaw = await readFile(file, "utf-8");
|
|
103
|
-
const tsupConfig = tsupConfigRaw.replaceAll(/\btsup\b/g, "tsdown").replaceAll(/\bTSUP\b/g, "TSDOWN");
|
|
104
|
-
const renamed = file.replaceAll("tsup", "tsdown");
|
|
105
|
-
if (dryRun) {
|
|
106
|
-
const { createTwoFilesPatch } = await import("diff");
|
|
107
|
-
globalLogger.info(`[dry-run] ${file} -> ${renamed}:`);
|
|
108
|
-
console.info(createTwoFilesPatch(file, renamed, tsupConfigRaw, tsupConfig));
|
|
109
|
-
} else {
|
|
110
|
-
await writeFile(renamed, tsupConfig, "utf8");
|
|
111
|
-
await unlink(file);
|
|
112
|
-
globalLogger.success(`Migrated \`${file}\` to \`${renamed}\``);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (!found) globalLogger.warn("No tsup config found");
|
|
116
|
-
return found;
|
|
117
|
-
}
|
|
118
|
-
function renameKey(obj, oldKey, newKey, newValue) {
|
|
119
|
-
const newObj = {};
|
|
120
|
-
for (const key of Object.keys(obj)) if (key === oldKey) newObj[newKey] = newValue || obj[oldKey];
|
|
121
|
-
else newObj[key] = obj[key];
|
|
122
|
-
return newObj;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
//#endregion
|
|
126
|
-
export { migrate };
|