@take-out/cli 0.4.3-1775691786096 → 0.4.3-1775848829010
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/cjs/cli.cjs +53 -35
- package/dist/cjs/commands/changed.cjs +133 -95
- package/dist/cjs/commands/docs.cjs +276 -203
- package/dist/cjs/commands/env-setup.cjs +45 -33
- package/dist/cjs/commands/onboard.cjs +668 -224
- package/dist/cjs/commands/run-all.cjs +54 -45
- package/dist/cjs/commands/run.cjs +80 -65
- package/dist/cjs/commands/script.cjs +263 -187
- package/dist/cjs/commands/skills.cjs +174 -118
- package/dist/cjs/commands/sync.cjs +193 -93
- package/dist/cjs/constants/ascii.cjs +14 -12
- package/dist/cjs/index.cjs +12 -10
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/utils/env-categories.cjs +53 -48
- package/dist/cjs/utils/env-setup.cjs +214 -106
- package/dist/cjs/utils/env.cjs +65 -44
- package/dist/cjs/utils/files.cjs +186 -113
- package/dist/cjs/utils/parallel-runner.cjs +125 -75
- package/dist/cjs/utils/ports.cjs +21 -21
- package/dist/cjs/utils/prerequisites.cjs +42 -34
- package/dist/cjs/utils/prompts.cjs +66 -41
- package/dist/cjs/utils/script-listing.cjs +130 -60
- package/dist/cjs/utils/script-utils.cjs +29 -19
- package/dist/cjs/utils/sync.cjs +67 -45
- package/dist/esm/cli.mjs +40 -24
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/commands/changed.mjs +104 -68
- package/dist/esm/commands/changed.mjs.map +1 -1
- package/dist/esm/commands/docs.mjs +245 -174
- package/dist/esm/commands/docs.mjs.map +1 -1
- package/dist/esm/commands/env-setup.mjs +18 -8
- package/dist/esm/commands/env-setup.mjs.map +1 -1
- package/dist/esm/commands/onboard.mjs +631 -189
- package/dist/esm/commands/onboard.mjs.map +1 -1
- package/dist/esm/commands/run-all.mjs +26 -19
- package/dist/esm/commands/run-all.mjs.map +1 -1
- package/dist/esm/commands/run.mjs +52 -39
- package/dist/esm/commands/run.mjs.map +1 -1
- package/dist/esm/commands/script.mjs +230 -156
- package/dist/esm/commands/script.mjs.map +1 -1
- package/dist/esm/commands/skills.mjs +143 -89
- package/dist/esm/commands/skills.mjs.map +1 -1
- package/dist/esm/commands/sync.mjs +160 -62
- package/dist/esm/commands/sync.mjs.map +1 -1
- package/dist/esm/constants/ascii.mjs +2 -2
- package/dist/esm/constants/ascii.mjs.map +1 -1
- package/dist/esm/utils/env-categories.mjs +29 -26
- package/dist/esm/utils/env-categories.mjs.map +1 -1
- package/dist/esm/utils/env-setup.mjs +184 -78
- package/dist/esm/utils/env-setup.mjs.map +1 -1
- package/dist/esm/utils/env.mjs +50 -31
- package/dist/esm/utils/env.mjs.map +1 -1
- package/dist/esm/utils/files.mjs +171 -100
- package/dist/esm/utils/files.mjs.map +1 -1
- package/dist/esm/utils/parallel-runner.mjs +111 -63
- package/dist/esm/utils/parallel-runner.mjs.map +1 -1
- package/dist/esm/utils/ports.mjs +9 -11
- package/dist/esm/utils/ports.mjs.map +1 -1
- package/dist/esm/utils/prerequisites.mjs +30 -24
- package/dist/esm/utils/prerequisites.mjs.map +1 -1
- package/dist/esm/utils/prompts.mjs +40 -17
- package/dist/esm/utils/prompts.mjs.map +1 -1
- package/dist/esm/utils/script-listing.mjs +101 -33
- package/dist/esm/utils/script-listing.mjs.map +1 -1
- package/dist/esm/utils/script-utils.mjs +14 -6
- package/dist/esm/utils/script-utils.mjs.map +1 -1
- package/dist/esm/utils/sync.mjs +38 -18
- package/dist/esm/utils/sync.mjs.map +1 -1
- package/package.json +5 -5
package/dist/cjs/cli.cjs
CHANGED
|
@@ -3,13 +3,15 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
7
|
-
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
13
15
|
return to;
|
|
14
16
|
};
|
|
15
17
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -19,28 +21,30 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
21
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
23
|
value: mod,
|
|
22
|
-
enumerable:
|
|
24
|
+
enumerable: true
|
|
23
25
|
}) : target, mod));
|
|
24
|
-
var import_node_child_process = require("node:child_process")
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
var import_node_child_process = require("node:child_process");
|
|
27
|
+
var import_node_fs = require("node:fs");
|
|
28
|
+
var import_node_path = require("node:path");
|
|
29
|
+
var import_citty = require("citty");
|
|
28
30
|
const import_meta = {};
|
|
29
31
|
function isScriptCategory(name) {
|
|
30
|
-
const scriptsDir = (0, import_node_path.join)(process.cwd(), "scripts")
|
|
31
|
-
|
|
32
|
+
const scriptsDir = (0, import_node_path.join)(process.cwd(), "scripts");
|
|
33
|
+
const categoryPath = (0, import_node_path.join)(scriptsDir, name);
|
|
32
34
|
try {
|
|
33
35
|
return (0, import_node_fs.existsSync)(categoryPath) && (0, import_node_fs.statSync)(categoryPath).isDirectory();
|
|
34
36
|
} catch {
|
|
35
|
-
return
|
|
37
|
+
return false;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
function findLocalScript(name) {
|
|
39
|
-
const scriptsDir = (0, import_node_path.join)(process.cwd(), "scripts")
|
|
40
|
-
|
|
41
|
+
const scriptsDir = (0, import_node_path.join)(process.cwd(), "scripts");
|
|
42
|
+
const normalizedName = name.replace(/:/g, "/");
|
|
41
43
|
for (const ext of [".ts", ".js", ""]) {
|
|
42
44
|
const scriptPath = (0, import_node_path.join)(scriptsDir, `${normalizedName}${ext}`);
|
|
43
|
-
if ((0, import_node_fs.existsSync)(scriptPath))
|
|
45
|
+
if ((0, import_node_fs.existsSync)(scriptPath)) {
|
|
46
|
+
return scriptPath;
|
|
47
|
+
}
|
|
44
48
|
}
|
|
45
49
|
return null;
|
|
46
50
|
}
|
|
@@ -49,14 +53,16 @@ function isLocalScript(name) {
|
|
|
49
53
|
}
|
|
50
54
|
function findBuiltInScript(name) {
|
|
51
55
|
try {
|
|
52
|
-
const resolved = import_meta.resolve("@take-out/scripts/package.json")
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const resolved = import_meta.resolve("@take-out/scripts/package.json");
|
|
57
|
+
const packageJsonPath = new URL(resolved).pathname;
|
|
58
|
+
const packageRoot = (0, import_node_path.join)(packageJsonPath, "..");
|
|
59
|
+
const srcPath = (0, import_node_path.join)(packageRoot, "src");
|
|
60
|
+
const normalizedName = name.replace(/:/g, "/");
|
|
57
61
|
for (const ext of [".ts", ".js", ""]) {
|
|
58
62
|
const scriptPath = (0, import_node_path.join)(srcPath, `${normalizedName}${ext}`);
|
|
59
|
-
if ((0, import_node_fs.existsSync)(scriptPath))
|
|
63
|
+
if ((0, import_node_fs.existsSync)(scriptPath)) {
|
|
64
|
+
return scriptPath;
|
|
65
|
+
}
|
|
60
66
|
}
|
|
61
67
|
} catch {}
|
|
62
68
|
return null;
|
|
@@ -64,29 +70,40 @@ function findBuiltInScript(name) {
|
|
|
64
70
|
function isBuiltInScript(name) {
|
|
65
71
|
return findBuiltInScript(name) !== null;
|
|
66
72
|
}
|
|
67
|
-
const isShorthand =
|
|
73
|
+
const isShorthand = true;
|
|
68
74
|
if (isShorthand) {
|
|
69
75
|
const firstArg = process.argv[2];
|
|
70
|
-
|
|
76
|
+
const builtInCommands = ["docs", "onboard", "run", "run-all", "script", "skills", "env:setup", "sync", "changed", "--help", "-h", "--version", "-v"];
|
|
77
|
+
if (firstArg && !builtInCommands.includes(firstArg)) {
|
|
71
78
|
let resolvedScriptName;
|
|
72
79
|
if (isScriptCategory(firstArg)) {
|
|
73
|
-
const restArgs = process.argv.slice(3)
|
|
74
|
-
|
|
80
|
+
const restArgs = process.argv.slice(3);
|
|
81
|
+
const subScriptIdx = restArgs.findIndex(a => !a.startsWith("-"));
|
|
75
82
|
if (subScriptIdx !== -1) {
|
|
76
83
|
const subScript = restArgs[subScriptIdx];
|
|
77
|
-
resolvedScriptName = `${firstArg}/${subScript}
|
|
84
|
+
resolvedScriptName = `${firstArg}/${subScript}`;
|
|
85
|
+
process.argv.splice(3 + subScriptIdx, 1);
|
|
86
|
+
process.argv[2] = resolvedScriptName;
|
|
78
87
|
}
|
|
79
88
|
process.argv.splice(2, 0, "run");
|
|
80
|
-
} else firstArg?.includes("/")
|
|
89
|
+
} else if (firstArg?.includes("/")) {
|
|
90
|
+
resolvedScriptName = firstArg;
|
|
91
|
+
process.argv.splice(2, 0, "run");
|
|
92
|
+
} else if (isLocalScript(firstArg) || isBuiltInScript(firstArg)) {
|
|
93
|
+
resolvedScriptName = firstArg;
|
|
94
|
+
process.argv.splice(2, 0, "run");
|
|
95
|
+
} else {
|
|
96
|
+
process.argv.splice(2, 0, "script");
|
|
97
|
+
}
|
|
81
98
|
const hasHelp = process.argv.includes("--help") || process.argv.includes("-h");
|
|
82
99
|
if (resolvedScriptName && hasHelp) {
|
|
83
100
|
const scriptPath = findLocalScript(resolvedScriptName) || findBuiltInScript(resolvedScriptName);
|
|
84
101
|
if (scriptPath) {
|
|
85
|
-
const flagArgs = process.argv.slice(3).filter(a => a !== resolvedScriptName)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
102
|
+
const flagArgs = process.argv.slice(3).filter(a => a !== resolvedScriptName);
|
|
103
|
+
const result = (0, import_node_child_process.spawnSync)("bun", [scriptPath, ...flagArgs], {
|
|
104
|
+
stdio: "inherit",
|
|
105
|
+
shell: false
|
|
106
|
+
});
|
|
90
107
|
process.exit(result.status || 0);
|
|
91
108
|
}
|
|
92
109
|
}
|
|
@@ -110,7 +127,8 @@ const main = (0, import_citty.defineCommand)({
|
|
|
110
127
|
changed: () => import("./commands/changed").then(m => m.changedCommand)
|
|
111
128
|
},
|
|
112
129
|
async run() {
|
|
113
|
-
|
|
130
|
+
const hasArgs = process.argv.length > 2;
|
|
131
|
+
if (!hasArgs) {
|
|
114
132
|
const {
|
|
115
133
|
listAllScripts
|
|
116
134
|
} = await import("./utils/script-listing");
|
|
@@ -2,60 +2,64 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var changed_exports = {};
|
|
33
35
|
__export(changed_exports, {
|
|
34
36
|
changedCommand: () => changedCommand
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(changed_exports);
|
|
37
|
-
var import_node_child_process = require("node:child_process")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const UPSTREAM_REPO = "tamagui/takeout2"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
var import_node_child_process = require("node:child_process");
|
|
40
|
+
var import_node_fs = require("node:fs");
|
|
41
|
+
var import_node_path = require("node:path");
|
|
42
|
+
var import_citty = require("citty");
|
|
43
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
44
|
+
const UPSTREAM_REPO = "tamagui/takeout2";
|
|
45
|
+
const UPSTREAM_REMOTE = "takeout-upstream";
|
|
46
|
+
const TAKEOUT_FILE = ".takeout";
|
|
47
|
+
const COMMIT_TYPE_ORDER = ["feat", "fix", "perf", "refactor", "docs", "chore", "test", "ci"];
|
|
46
48
|
function readTakeoutConfig() {
|
|
47
49
|
const configPath = (0, import_node_path.join)(process.cwd(), TAKEOUT_FILE);
|
|
48
|
-
if (!(0, import_node_fs.existsSync)(configPath))
|
|
50
|
+
if (!(0, import_node_fs.existsSync)(configPath)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
49
53
|
try {
|
|
50
|
-
const content = (0, import_node_fs.readFileSync)(configPath, "utf-8")
|
|
51
|
-
|
|
52
|
-
for (const line of content.split(
|
|
53
|
-
`)) {
|
|
54
|
+
const content = (0, import_node_fs.readFileSync)(configPath, "utf-8");
|
|
55
|
+
const config = {};
|
|
56
|
+
for (const line of content.split("\n")) {
|
|
54
57
|
const trimmed = line.trim();
|
|
55
58
|
if (trimmed.startsWith("#") || !trimmed) continue;
|
|
56
|
-
const [key, ...valueParts] = trimmed.split("=")
|
|
57
|
-
|
|
58
|
-
key === "sha"
|
|
59
|
+
const [key, ...valueParts] = trimmed.split("=");
|
|
60
|
+
const value = valueParts.join("=").trim();
|
|
61
|
+
if (key === "sha") config.sha = value;
|
|
62
|
+
if (key === "date") config.date = value;
|
|
59
63
|
}
|
|
60
64
|
return config;
|
|
61
65
|
} catch {
|
|
@@ -66,7 +70,9 @@ function parseConventionalCommit(message) {
|
|
|
66
70
|
const match = message.match(/^(\w+)(?:\(([^)]+)\))?(!)?: (.+)$/);
|
|
67
71
|
if (!match) return null;
|
|
68
72
|
const [, type, scope, breaking, msg] = match;
|
|
69
|
-
|
|
73
|
+
const validTypes = ["feat", "fix", "perf", "refactor", "docs", "chore", "test", "ci", "build", "style"];
|
|
74
|
+
if (!type || !validTypes.includes(type)) return null;
|
|
75
|
+
return {
|
|
70
76
|
type,
|
|
71
77
|
scope,
|
|
72
78
|
message: msg || message,
|
|
@@ -75,35 +81,43 @@ function parseConventionalCommit(message) {
|
|
|
75
81
|
}
|
|
76
82
|
function ensureUpstreamRemote() {
|
|
77
83
|
try {
|
|
78
|
-
|
|
84
|
+
const remotes = (0, import_node_child_process.execSync)("git remote", {
|
|
79
85
|
encoding: "utf-8"
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
});
|
|
87
|
+
if (!remotes.includes(UPSTREAM_REMOTE)) {
|
|
88
|
+
console.info(import_picocolors.default.dim(` adding ${UPSTREAM_REMOTE} remote...`));
|
|
89
|
+
(0, import_node_child_process.execSync)(`git remote add ${UPSTREAM_REMOTE} git@github.com:${UPSTREAM_REPO}.git`, {
|
|
90
|
+
stdio: "pipe"
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
console.info(import_picocolors.default.dim(` fetching from ${UPSTREAM_REMOTE}...`));
|
|
94
|
+
(0, import_node_child_process.execSync)(`git fetch ${UPSTREAM_REMOTE} --quiet`, {
|
|
83
95
|
stdio: "pipe"
|
|
84
|
-
})
|
|
96
|
+
});
|
|
97
|
+
return true;
|
|
85
98
|
} catch (err) {
|
|
86
|
-
|
|
99
|
+
console.error(import_picocolors.default.red(`failed to setup upstream remote: ${err}`));
|
|
100
|
+
return false;
|
|
87
101
|
}
|
|
88
102
|
}
|
|
89
103
|
function getCommitsBetween(fromSha, toRef) {
|
|
90
104
|
const commits = [];
|
|
91
105
|
try {
|
|
92
|
-
const
|
|
106
|
+
const result = (0, import_node_child_process.execSync)(`git log ${fromSha}..${toRef} --pretty=format:"%H|%ad|%s" --date=short 2>/dev/null`, {
|
|
93
107
|
encoding: "utf-8",
|
|
94
|
-
maxBuffer:
|
|
95
|
-
})
|
|
96
|
-
|
|
108
|
+
maxBuffer: 10 * 1024 * 1024
|
|
109
|
+
});
|
|
110
|
+
const lines = result.trim().split("\n").filter(Boolean);
|
|
97
111
|
for (const line of lines) {
|
|
98
|
-
const [hash = "", date = "", ...messageParts] = line.split("|")
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
const [hash = "", date = "", ...messageParts] = line.split("|");
|
|
113
|
+
const message = messageParts.join("|");
|
|
114
|
+
const parsed = parseConventionalCommit(message);
|
|
101
115
|
commits.push({
|
|
102
116
|
hash: hash.slice(0, 7),
|
|
103
117
|
type: parsed?.type || "other",
|
|
104
118
|
scope: parsed?.scope,
|
|
105
119
|
message: parsed?.message || message,
|
|
106
|
-
breaking: parsed?.breaking ||
|
|
120
|
+
breaking: parsed?.breaking || false,
|
|
107
121
|
date
|
|
108
122
|
});
|
|
109
123
|
}
|
|
@@ -118,53 +132,56 @@ function formatChangelog(commits) {
|
|
|
118
132
|
const grouped = /* @__PURE__ */new Map();
|
|
119
133
|
for (const commit of commits) {
|
|
120
134
|
const existing = grouped.get(commit.type) || [];
|
|
121
|
-
existing.push(commit)
|
|
135
|
+
existing.push(commit);
|
|
136
|
+
grouped.set(commit.type, existing);
|
|
122
137
|
}
|
|
123
138
|
const sortedTypes = Array.from(grouped.keys()).sort((a, b) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
const aIdx = COMMIT_TYPE_ORDER.indexOf(a);
|
|
140
|
+
const bIdx = COMMIT_TYPE_ORDER.indexOf(b);
|
|
141
|
+
return (aIdx === -1 ? 999 : aIdx) - (bIdx === -1 ? 999 : bIdx);
|
|
142
|
+
});
|
|
143
|
+
const breakingChanges = commits.filter(c => c.breaking);
|
|
129
144
|
if (breakingChanges.length > 0) {
|
|
130
|
-
console.info()
|
|
145
|
+
console.info();
|
|
146
|
+
console.info(import_picocolors.default.red(import_picocolors.default.bold(" BREAKING CHANGES")));
|
|
131
147
|
for (const commit of breakingChanges) {
|
|
132
148
|
const scope = commit.scope ? import_picocolors.default.cyan(`(${commit.scope})`) : "";
|
|
133
149
|
console.info(` ${import_picocolors.default.red("!")} ${scope} ${commit.message} ${import_picocolors.default.dim(`(${commit.hash})`)}`);
|
|
134
150
|
}
|
|
135
151
|
}
|
|
136
152
|
const typeLabels = {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
feat: "Features",
|
|
154
|
+
fix: "Bug Fixes",
|
|
155
|
+
perf: "Performance",
|
|
156
|
+
refactor: "Refactoring",
|
|
157
|
+
docs: "Documentation",
|
|
158
|
+
chore: "Maintenance",
|
|
159
|
+
test: "Tests",
|
|
160
|
+
ci: "CI",
|
|
161
|
+
build: "Build",
|
|
162
|
+
style: "Style",
|
|
163
|
+
other: "Other"
|
|
164
|
+
};
|
|
165
|
+
const typeColors = {
|
|
166
|
+
feat: import_picocolors.default.green,
|
|
167
|
+
fix: import_picocolors.default.yellow,
|
|
168
|
+
perf: import_picocolors.default.magenta,
|
|
169
|
+
refactor: import_picocolors.default.blue,
|
|
170
|
+
docs: import_picocolors.default.dim,
|
|
171
|
+
chore: import_picocolors.default.dim,
|
|
172
|
+
test: import_picocolors.default.dim,
|
|
173
|
+
ci: import_picocolors.default.dim,
|
|
174
|
+
build: import_picocolors.default.dim,
|
|
175
|
+
style: import_picocolors.default.dim,
|
|
176
|
+
other: import_picocolors.default.white
|
|
177
|
+
};
|
|
162
178
|
for (const type of sortedTypes) {
|
|
163
179
|
const typeCommits = grouped.get(type).filter(c => !c.breaking);
|
|
164
180
|
if (typeCommits.length === 0) continue;
|
|
165
|
-
const label = typeLabels[type] || type
|
|
166
|
-
|
|
167
|
-
console.info()
|
|
181
|
+
const label = typeLabels[type] || type;
|
|
182
|
+
const color = typeColors[type] || import_picocolors.default.white;
|
|
183
|
+
console.info();
|
|
184
|
+
console.info(color(import_picocolors.default.bold(` ${label}`)));
|
|
168
185
|
for (const commit of typeCommits) {
|
|
169
186
|
const scope = commit.scope ? import_picocolors.default.cyan(`(${commit.scope}) `) : "";
|
|
170
187
|
console.info(` ${import_picocolors.default.dim("-")} ${scope}${commit.message} ${import_picocolors.default.dim(`(${commit.hash})`)}`);
|
|
@@ -189,24 +206,45 @@ const changedCommand = (0, import_citty.defineCommand)({
|
|
|
189
206
|
async run({
|
|
190
207
|
args
|
|
191
208
|
}) {
|
|
192
|
-
console.info()
|
|
209
|
+
console.info();
|
|
210
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.cyan("Takeout Changes")));
|
|
211
|
+
console.info();
|
|
193
212
|
let fromSha = args.from;
|
|
194
213
|
const config = readTakeoutConfig();
|
|
195
214
|
if (!fromSha) {
|
|
196
215
|
if (!config?.sha) {
|
|
197
|
-
console.info(import_picocolors.default.yellow("No .takeout file found with last sync SHA."))
|
|
216
|
+
console.info(import_picocolors.default.yellow("No .takeout file found with last sync SHA."));
|
|
217
|
+
console.info();
|
|
218
|
+
console.info(import_picocolors.default.dim("Either:"));
|
|
219
|
+
console.info(import_picocolors.default.dim(" 1. Create a .takeout file with: sha=<commit-sha>"));
|
|
220
|
+
console.info(import_picocolors.default.dim(" 2. Run with --from <sha> to specify starting point"));
|
|
221
|
+
console.info(import_picocolors.default.dim(" 3. Run `tko sync` to sync and create the file"));
|
|
222
|
+
console.info();
|
|
198
223
|
return;
|
|
199
224
|
}
|
|
200
225
|
fromSha = config.sha;
|
|
201
226
|
}
|
|
202
|
-
if (!ensureUpstreamRemote())
|
|
227
|
+
if (!ensureUpstreamRemote()) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
203
230
|
const toRef = args.to || `${UPSTREAM_REMOTE}/main`;
|
|
204
|
-
console.info(import_picocolors.default.dim(` from: ${fromSha.slice(0, 7)}`))
|
|
231
|
+
console.info(import_picocolors.default.dim(` from: ${fromSha.slice(0, 7)}`));
|
|
232
|
+
console.info(import_picocolors.default.dim(` to: ${toRef}`));
|
|
233
|
+
if (config?.date) {
|
|
234
|
+
console.info(import_picocolors.default.dim(` last sync: ${config.date}`));
|
|
235
|
+
}
|
|
205
236
|
const commits = getCommitsBetween(fromSha, toRef);
|
|
206
237
|
if (commits.length === 0) {
|
|
207
|
-
console.info()
|
|
238
|
+
console.info();
|
|
239
|
+
console.info(import_picocolors.default.green("\u2713 Already up to date with upstream!"));
|
|
240
|
+
console.info();
|
|
208
241
|
return;
|
|
209
242
|
}
|
|
210
|
-
console.info()
|
|
243
|
+
console.info();
|
|
244
|
+
console.info(import_picocolors.default.bold(`${commits.length} commit${commits.length === 1 ? "" : "s"} since last sync:`));
|
|
245
|
+
formatChangelog(commits);
|
|
246
|
+
console.info();
|
|
247
|
+
console.info(import_picocolors.default.dim("Run `tko sync` to sync these changes into your fork."));
|
|
248
|
+
console.info();
|
|
211
249
|
}
|
|
212
250
|
});
|