@take-out/cli 0.4.3 → 0.4.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/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
|
@@ -2,227 +2,300 @@ 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 docs_exports = {};
|
|
33
35
|
__export(docs_exports, {
|
|
34
36
|
docsCommand: () => docsCommand
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(docs_exports);
|
|
37
|
-
var import_node_fs = require("node:fs")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const import_meta = {}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
meta: {
|
|
70
|
-
name: "get",
|
|
71
|
-
description: "Get the content of one or more documentation files"
|
|
72
|
-
},
|
|
73
|
-
args: {
|
|
74
|
-
name: {
|
|
75
|
-
type: "positional",
|
|
76
|
-
description: "Name(s) of the doc files (without .md extension)",
|
|
77
|
-
required: !0,
|
|
78
|
-
valueHint: "name..."
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
async run({
|
|
82
|
-
args
|
|
83
|
-
}) {
|
|
84
|
-
const names = args._.length > 0 ? args._ : [args.name],
|
|
85
|
-
results = [],
|
|
86
|
-
errors = [],
|
|
87
|
-
cwd = process.cwd(),
|
|
88
|
-
localDocsDir = (0, import_node_path.join)(cwd, "docs");
|
|
89
|
-
for (const name of names) {
|
|
90
|
-
const fileName = name.endsWith(".md") ? name : `${name}.md`,
|
|
91
|
-
localFilePath = (0, import_node_path.join)(localDocsDir, fileName),
|
|
92
|
-
packageFilePath = (0, import_node_path.join)(DOCS_DIR, fileName);
|
|
93
|
-
let filePath = null;
|
|
94
|
-
if ((0, import_node_fs.existsSync)(localFilePath) ? filePath = localFilePath : (0, import_node_fs.existsSync)(packageFilePath) && (filePath = packageFilePath), !filePath) {
|
|
95
|
-
errors.push({
|
|
96
|
-
name,
|
|
97
|
-
error: "File not found"
|
|
98
|
-
});
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const content = (0, import_node_fs.readFileSync)(filePath, "utf-8");
|
|
103
|
-
results.push({
|
|
104
|
-
name,
|
|
105
|
-
content
|
|
106
|
-
});
|
|
107
|
-
} catch (err) {
|
|
108
|
-
errors.push({
|
|
109
|
-
name,
|
|
110
|
-
error: String(err)
|
|
111
|
-
});
|
|
39
|
+
var import_node_fs = require("node:fs");
|
|
40
|
+
var import_node_module = require("node:module");
|
|
41
|
+
var import_node_path = require("node:path");
|
|
42
|
+
var import_citty = require("citty");
|
|
43
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
44
|
+
var import_sync = require("../utils/sync.cjs");
|
|
45
|
+
const import_meta = {};
|
|
46
|
+
const require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
47
|
+
const DOCS_DIR = (0, import_node_path.dirname)(require2.resolve("@take-out/docs/package.json"));
|
|
48
|
+
const listCommand = (0, import_citty.defineCommand)({
|
|
49
|
+
meta: {
|
|
50
|
+
name: "list",
|
|
51
|
+
description: "List all available documentation files"
|
|
52
|
+
},
|
|
53
|
+
async run() {
|
|
54
|
+
if (!(0, import_node_fs.existsSync)(DOCS_DIR)) {
|
|
55
|
+
console.error(import_picocolors.default.red("\u2717 Docs directory not found"));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
const files = (0, import_node_fs.readdirSync)(DOCS_DIR).filter(f => f.endsWith(".md")).sort();
|
|
59
|
+
console.info();
|
|
60
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.cyan("\u{1F4DA} Available Documentation")));
|
|
61
|
+
console.info();
|
|
62
|
+
for (const file of files) {
|
|
63
|
+
const name = file.replace(/\.md$/, "");
|
|
64
|
+
const path = (0, import_node_path.join)(DOCS_DIR, file);
|
|
65
|
+
let description = "";
|
|
66
|
+
try {
|
|
67
|
+
const content = (0, import_node_fs.readFileSync)(path, "utf-8");
|
|
68
|
+
const match = content.match(/^#\s+(.+)$/m);
|
|
69
|
+
if (match?.[1]) {
|
|
70
|
+
description = match[1];
|
|
112
71
|
}
|
|
113
|
-
}
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
console.info(
|
|
119
|
-
}
|
|
120
|
-
for (let i = 0; i < results.length; i++) {
|
|
121
|
-
const result = results[i];
|
|
122
|
-
result && (console.info(`# ${result.name}`), console.info(), console.info(result.content), i < results.length - 1 && (console.info(), console.info("---"), console.info()));
|
|
72
|
+
} catch {}
|
|
73
|
+
if (description) {
|
|
74
|
+
console.info(` ${import_picocolors.default.green(name)}`);
|
|
75
|
+
console.info(` ${import_picocolors.default.dim(description)}`);
|
|
76
|
+
} else {
|
|
77
|
+
console.info(` ${import_picocolors.default.green(name)}`);
|
|
123
78
|
}
|
|
124
79
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
80
|
+
console.info();
|
|
81
|
+
console.info(import_picocolors.default.dim(`Use 'takeout docs get <name>' to view a document`));
|
|
82
|
+
console.info();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const getCommand = (0, import_citty.defineCommand)({
|
|
86
|
+
meta: {
|
|
87
|
+
name: "get",
|
|
88
|
+
description: "Get the content of one or more documentation files"
|
|
89
|
+
},
|
|
90
|
+
args: {
|
|
91
|
+
name: {
|
|
92
|
+
type: "positional",
|
|
93
|
+
description: "Name(s) of the doc files (without .md extension)",
|
|
94
|
+
required: true,
|
|
95
|
+
valueHint: "name..."
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
async run({
|
|
99
|
+
args
|
|
100
|
+
}) {
|
|
101
|
+
const names = args._.length > 0 ? args._ : [args.name];
|
|
102
|
+
const results = [];
|
|
103
|
+
const errors = [];
|
|
104
|
+
const cwd = process.cwd();
|
|
105
|
+
const localDocsDir = (0, import_node_path.join)(cwd, "docs");
|
|
106
|
+
for (const name of names) {
|
|
107
|
+
const fileName = name.endsWith(".md") ? name : `${name}.md`;
|
|
108
|
+
const localFilePath = (0, import_node_path.join)(localDocsDir, fileName);
|
|
109
|
+
const packageFilePath = (0, import_node_path.join)(DOCS_DIR, fileName);
|
|
110
|
+
let filePath = null;
|
|
111
|
+
if ((0, import_node_fs.existsSync)(localFilePath)) {
|
|
112
|
+
filePath = localFilePath;
|
|
113
|
+
} else if ((0, import_node_fs.existsSync)(packageFilePath)) {
|
|
114
|
+
filePath = packageFilePath;
|
|
136
115
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return;
|
|
116
|
+
if (!filePath) {
|
|
117
|
+
errors.push({
|
|
118
|
+
name,
|
|
119
|
+
error: "File not found"
|
|
120
|
+
});
|
|
121
|
+
continue;
|
|
144
122
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
yes: {
|
|
157
|
-
type: "boolean",
|
|
158
|
-
description: "Skip confirmations and eject all files",
|
|
159
|
-
default: !1
|
|
123
|
+
try {
|
|
124
|
+
const content = (0, import_node_fs.readFileSync)(filePath, "utf-8");
|
|
125
|
+
results.push({
|
|
126
|
+
name,
|
|
127
|
+
content
|
|
128
|
+
});
|
|
129
|
+
} catch (err) {
|
|
130
|
+
errors.push({
|
|
131
|
+
name,
|
|
132
|
+
error: String(err)
|
|
133
|
+
});
|
|
160
134
|
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
sourceDocsDir = DOCS_DIR;
|
|
168
|
-
console.info(), console.info(import_picocolors.default.bold(import_picocolors.default.cyan("\u{1F4DA} Eject Docs"))), console.info(), console.info(import_picocolors.default.dim(`Source: ${sourceDocsDir}`)), console.info(import_picocolors.default.dim(`Target: ${targetDocsDir}`)), console.info(), (0, import_node_fs.existsSync)(sourceDocsDir) || (console.error(import_picocolors.default.red("\u2717 Source docs directory not found in Takeout package")), process.exit(1)), (0, import_node_fs.existsSync)(targetDocsDir) || (console.info(import_picocolors.default.yellow("\u26A0 Target docs directory does not exist, will create it")), (0, import_node_fs.mkdirSync)(targetDocsDir, {
|
|
169
|
-
recursive: !0
|
|
170
|
-
}));
|
|
171
|
-
const sourceFiles = (0, import_node_fs.readdirSync)(sourceDocsDir).filter(f => f.endsWith(".md"));
|
|
172
|
-
if (sourceFiles.length === 0) {
|
|
173
|
-
console.info(import_picocolors.default.yellow("No markdown files found in Takeout docs"));
|
|
174
|
-
return;
|
|
135
|
+
}
|
|
136
|
+
if (errors.length > 0) {
|
|
137
|
+
for (const {
|
|
138
|
+
name
|
|
139
|
+
} of errors) {
|
|
140
|
+
console.error(import_picocolors.default.red(`\u2717 Doc file not found: ${name}`));
|
|
175
141
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
identical: 0
|
|
181
|
-
};
|
|
182
|
-
for (const file of sourceFiles) {
|
|
183
|
-
const sourcePath = (0, import_node_path.join)(sourceDocsDir, file),
|
|
184
|
-
targetPath = (0, import_node_path.join)(targetDocsDir, file),
|
|
185
|
-
status = (0, import_sync.compareFiles)(sourcePath, targetPath);
|
|
186
|
-
stats[status]++, filesToSync.push({
|
|
187
|
-
name: file,
|
|
188
|
-
sourcePath,
|
|
189
|
-
targetPath,
|
|
190
|
-
status,
|
|
191
|
-
sourceSize: (0, import_sync.getFileSize)(sourcePath),
|
|
192
|
-
targetSize: (0, import_sync.getFileSize)(targetPath)
|
|
193
|
-
});
|
|
142
|
+
console.info();
|
|
143
|
+
console.info(import_picocolors.default.dim(`Use 'takeout docs list' to see available docs`));
|
|
144
|
+
if (results.length === 0) {
|
|
145
|
+
process.exit(1);
|
|
194
146
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
147
|
+
console.info();
|
|
148
|
+
}
|
|
149
|
+
for (let i = 0; i < results.length; i++) {
|
|
150
|
+
const result = results[i];
|
|
151
|
+
if (!result) continue;
|
|
152
|
+
console.info(`# ${result.name}`);
|
|
153
|
+
console.info();
|
|
154
|
+
console.info(result.content);
|
|
155
|
+
if (i < results.length - 1) {
|
|
156
|
+
console.info();
|
|
157
|
+
console.info("---");
|
|
158
|
+
console.info();
|
|
198
159
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
const pathCommand = (0, import_citty.defineCommand)({
|
|
164
|
+
meta: {
|
|
165
|
+
name: "path",
|
|
166
|
+
description: "Get the absolute path to a documentation file"
|
|
167
|
+
},
|
|
168
|
+
args: {
|
|
169
|
+
name: {
|
|
170
|
+
type: "positional",
|
|
171
|
+
description: "Name of the doc file (without .md extension)",
|
|
172
|
+
required: false
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
async run({
|
|
176
|
+
args
|
|
177
|
+
}) {
|
|
178
|
+
if (!args.name) {
|
|
179
|
+
console.info(DOCS_DIR);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const fileName = args.name.endsWith(".md") ? args.name : `${args.name}.md`;
|
|
183
|
+
const filePath = (0, import_node_path.join)(DOCS_DIR, fileName);
|
|
184
|
+
if (!(0, import_node_fs.existsSync)(filePath)) {
|
|
185
|
+
console.error(import_picocolors.default.red(`\u2717 Doc file not found: ${args.name}`));
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
console.info(filePath);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const ejectCommand = (0, import_citty.defineCommand)({
|
|
192
|
+
meta: {
|
|
193
|
+
name: "eject",
|
|
194
|
+
description: "Eject Takeout documentation files into your project"
|
|
195
|
+
},
|
|
196
|
+
args: {
|
|
197
|
+
yes: {
|
|
198
|
+
type: "boolean",
|
|
199
|
+
description: "Skip confirmations and eject all files",
|
|
200
|
+
default: false
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
async run({
|
|
204
|
+
args
|
|
205
|
+
}) {
|
|
206
|
+
const cwd = process.cwd();
|
|
207
|
+
const targetDocsDir = (0, import_node_path.join)(cwd, "docs");
|
|
208
|
+
const sourceDocsDir = DOCS_DIR;
|
|
209
|
+
console.info();
|
|
210
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.cyan("\u{1F4DA} Eject Docs")));
|
|
211
|
+
console.info();
|
|
212
|
+
console.info(import_picocolors.default.dim(`Source: ${sourceDocsDir}`));
|
|
213
|
+
console.info(import_picocolors.default.dim(`Target: ${targetDocsDir}`));
|
|
214
|
+
console.info();
|
|
215
|
+
if (!(0, import_node_fs.existsSync)(sourceDocsDir)) {
|
|
216
|
+
console.error(import_picocolors.default.red("\u2717 Source docs directory not found in Takeout package"));
|
|
217
|
+
process.exit(1);
|
|
218
|
+
}
|
|
219
|
+
if (!(0, import_node_fs.existsSync)(targetDocsDir)) {
|
|
220
|
+
console.info(import_picocolors.default.yellow("\u26A0 Target docs directory does not exist, will create it"));
|
|
221
|
+
(0, import_node_fs.mkdirSync)(targetDocsDir, {
|
|
222
|
+
recursive: true
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
const sourceFiles = (0, import_node_fs.readdirSync)(sourceDocsDir).filter(f => f.endsWith(".md"));
|
|
226
|
+
if (sourceFiles.length === 0) {
|
|
227
|
+
console.info(import_picocolors.default.yellow("No markdown files found in Takeout docs"));
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const filesToSync = [];
|
|
231
|
+
const stats = {
|
|
232
|
+
new: 0,
|
|
233
|
+
modified: 0,
|
|
234
|
+
identical: 0
|
|
235
|
+
};
|
|
236
|
+
for (const file of sourceFiles) {
|
|
237
|
+
const sourcePath = (0, import_node_path.join)(sourceDocsDir, file);
|
|
238
|
+
const targetPath = (0, import_node_path.join)(targetDocsDir, file);
|
|
239
|
+
const status = (0, import_sync.compareFiles)(sourcePath, targetPath);
|
|
240
|
+
stats[status]++;
|
|
241
|
+
filesToSync.push({
|
|
242
|
+
name: file,
|
|
243
|
+
sourcePath,
|
|
244
|
+
targetPath,
|
|
245
|
+
status,
|
|
246
|
+
sourceSize: (0, import_sync.getFileSize)(sourcePath),
|
|
247
|
+
targetSize: (0, import_sync.getFileSize)(targetPath)
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
console.info(import_picocolors.default.bold("Summary:"));
|
|
251
|
+
console.info(` ${import_picocolors.default.green(`${stats.new} new`)}`);
|
|
252
|
+
console.info(` ${import_picocolors.default.yellow(`${stats.modified} modified`)}`);
|
|
253
|
+
console.info(` ${import_picocolors.default.dim(`${stats.identical} identical`)}`);
|
|
254
|
+
console.info();
|
|
255
|
+
if (stats.new === 0 && stats.modified === 0) {
|
|
256
|
+
console.info(import_picocolors.default.green("\u2713 All docs are already up to date!"));
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const sortOrder = {
|
|
260
|
+
new: 0,
|
|
261
|
+
modified: 1,
|
|
262
|
+
identical: 2
|
|
263
|
+
};
|
|
264
|
+
filesToSync.sort((a, b) => sortOrder[a.status] - sortOrder[b.status]);
|
|
265
|
+
let syncedCount = 0;
|
|
266
|
+
for (const file of filesToSync) {
|
|
267
|
+
if (args.yes && file.status !== "identical") {
|
|
207
268
|
const targetDir = (0, import_node_path.join)(targetDocsDir);
|
|
208
|
-
(0, import_node_fs.existsSync)(targetDir)
|
|
209
|
-
|
|
210
|
-
|
|
269
|
+
if (!(0, import_node_fs.existsSync)(targetDir)) {
|
|
270
|
+
(0, import_node_fs.mkdirSync)(targetDir, {
|
|
271
|
+
recursive: true
|
|
272
|
+
});
|
|
273
|
+
}
|
|
211
274
|
const content = (0, import_node_fs.readFileSync)(file.sourcePath);
|
|
212
|
-
(0, import_node_fs.writeFileSync)(file.targetPath, content)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
275
|
+
(0, import_node_fs.writeFileSync)(file.targetPath, content);
|
|
276
|
+
console.info(import_picocolors.default.green(` \u2713 ${file.name}`));
|
|
277
|
+
syncedCount++;
|
|
278
|
+
} else {
|
|
279
|
+
const wasSynced = await (0, import_sync.syncFileWithConfirmation)(file);
|
|
280
|
+
if (wasSynced) {
|
|
281
|
+
syncedCount++;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
console.info();
|
|
286
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.green(`\u2713 Complete: ${syncedCount} file(s) ejected`)));
|
|
287
|
+
console.info();
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
const docsCommand = (0, import_citty.defineCommand)({
|
|
291
|
+
meta: {
|
|
292
|
+
name: "docs",
|
|
293
|
+
description: "List and retrieve Takeout documentation"
|
|
294
|
+
},
|
|
295
|
+
subCommands: {
|
|
296
|
+
list: listCommand,
|
|
297
|
+
get: getCommand,
|
|
298
|
+
path: pathCommand,
|
|
299
|
+
eject: ejectCommand
|
|
300
|
+
}
|
|
301
|
+
});
|
|
@@ -2,41 +2,43 @@ 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 env_setup_exports = {};
|
|
33
35
|
__export(env_setup_exports, {
|
|
34
36
|
envSetupCommand: () => envSetupCommand
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(env_setup_exports);
|
|
37
|
-
var import_citty = require("citty")
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
var import_citty = require("citty");
|
|
40
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
41
|
+
var import_env_setup = require("../utils/env-setup.cjs");
|
|
40
42
|
const envSetupCommand = (0, import_citty.defineCommand)({
|
|
41
43
|
meta: {
|
|
42
44
|
name: "env:setup",
|
|
@@ -58,12 +60,12 @@ const envSetupCommand = (0, import_citty.defineCommand)({
|
|
|
58
60
|
type: "boolean",
|
|
59
61
|
description: "List all available categories",
|
|
60
62
|
alias: "l",
|
|
61
|
-
default:
|
|
63
|
+
default: false
|
|
62
64
|
},
|
|
63
65
|
"skip-optional": {
|
|
64
66
|
type: "boolean",
|
|
65
67
|
description: "Skip optional categories",
|
|
66
|
-
default:
|
|
68
|
+
default: false
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
71
|
async run({
|
|
@@ -75,16 +77,26 @@ const envSetupCommand = (0, import_citty.defineCommand)({
|
|
|
75
77
|
(0, import_env_setup.listCategories)();
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
|
-
console.info("")
|
|
80
|
+
console.info("");
|
|
81
|
+
console.info(import_picocolors.default.bold("\u{1F680} Takeout Production Environment Setup"));
|
|
82
|
+
console.info(import_picocolors.default.gray("Configure your production deployment settings"));
|
|
83
|
+
console.info("");
|
|
84
|
+
const success = await (0, import_env_setup.setupProductionEnv)(cwd, {
|
|
79
85
|
skipOptional: args["skip-optional"],
|
|
80
86
|
envFile: args.file,
|
|
81
87
|
onlyCategory: args.category,
|
|
82
|
-
interactive:
|
|
83
|
-
})
|
|
84
|
-
|
|
88
|
+
interactive: true
|
|
89
|
+
});
|
|
90
|
+
if (!success) {
|
|
91
|
+
console.info(import_picocolors.default.yellow("\n\u26A0 Environment setup was cancelled"));
|
|
92
|
+
console.info(import_picocolors.default.gray("You can resume anytime with:"));
|
|
93
|
+
console.info(import_picocolors.default.cyan(" bun takeout env:setup"));
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
85
96
|
} catch (error) {
|
|
86
|
-
console.error(import_picocolors.default.red(
|
|
87
|
-
|
|
97
|
+
console.error(import_picocolors.default.red("\n\u2716 Environment setup failed:"));
|
|
98
|
+
console.error(error);
|
|
99
|
+
process.exit(1);
|
|
88
100
|
}
|
|
89
101
|
}
|
|
90
102
|
});
|