@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.
Files changed (69) hide show
  1. package/dist/cjs/cli.cjs +53 -35
  2. package/dist/cjs/commands/changed.cjs +133 -95
  3. package/dist/cjs/commands/docs.cjs +276 -203
  4. package/dist/cjs/commands/env-setup.cjs +45 -33
  5. package/dist/cjs/commands/onboard.cjs +668 -224
  6. package/dist/cjs/commands/run-all.cjs +54 -45
  7. package/dist/cjs/commands/run.cjs +80 -65
  8. package/dist/cjs/commands/script.cjs +263 -187
  9. package/dist/cjs/commands/skills.cjs +174 -118
  10. package/dist/cjs/commands/sync.cjs +193 -93
  11. package/dist/cjs/constants/ascii.cjs +14 -12
  12. package/dist/cjs/index.cjs +12 -10
  13. package/dist/cjs/types.cjs +7 -5
  14. package/dist/cjs/utils/env-categories.cjs +53 -48
  15. package/dist/cjs/utils/env-setup.cjs +214 -106
  16. package/dist/cjs/utils/env.cjs +65 -44
  17. package/dist/cjs/utils/files.cjs +186 -113
  18. package/dist/cjs/utils/parallel-runner.cjs +125 -75
  19. package/dist/cjs/utils/ports.cjs +21 -21
  20. package/dist/cjs/utils/prerequisites.cjs +42 -34
  21. package/dist/cjs/utils/prompts.cjs +66 -41
  22. package/dist/cjs/utils/script-listing.cjs +130 -60
  23. package/dist/cjs/utils/script-utils.cjs +29 -19
  24. package/dist/cjs/utils/sync.cjs +67 -45
  25. package/dist/esm/cli.mjs +40 -24
  26. package/dist/esm/cli.mjs.map +1 -1
  27. package/dist/esm/commands/changed.mjs +104 -68
  28. package/dist/esm/commands/changed.mjs.map +1 -1
  29. package/dist/esm/commands/docs.mjs +245 -174
  30. package/dist/esm/commands/docs.mjs.map +1 -1
  31. package/dist/esm/commands/env-setup.mjs +18 -8
  32. package/dist/esm/commands/env-setup.mjs.map +1 -1
  33. package/dist/esm/commands/onboard.mjs +631 -189
  34. package/dist/esm/commands/onboard.mjs.map +1 -1
  35. package/dist/esm/commands/run-all.mjs +26 -19
  36. package/dist/esm/commands/run-all.mjs.map +1 -1
  37. package/dist/esm/commands/run.mjs +52 -39
  38. package/dist/esm/commands/run.mjs.map +1 -1
  39. package/dist/esm/commands/script.mjs +230 -156
  40. package/dist/esm/commands/script.mjs.map +1 -1
  41. package/dist/esm/commands/skills.mjs +143 -89
  42. package/dist/esm/commands/skills.mjs.map +1 -1
  43. package/dist/esm/commands/sync.mjs +160 -62
  44. package/dist/esm/commands/sync.mjs.map +1 -1
  45. package/dist/esm/constants/ascii.mjs +2 -2
  46. package/dist/esm/constants/ascii.mjs.map +1 -1
  47. package/dist/esm/utils/env-categories.mjs +29 -26
  48. package/dist/esm/utils/env-categories.mjs.map +1 -1
  49. package/dist/esm/utils/env-setup.mjs +184 -78
  50. package/dist/esm/utils/env-setup.mjs.map +1 -1
  51. package/dist/esm/utils/env.mjs +50 -31
  52. package/dist/esm/utils/env.mjs.map +1 -1
  53. package/dist/esm/utils/files.mjs +171 -100
  54. package/dist/esm/utils/files.mjs.map +1 -1
  55. package/dist/esm/utils/parallel-runner.mjs +111 -63
  56. package/dist/esm/utils/parallel-runner.mjs.map +1 -1
  57. package/dist/esm/utils/ports.mjs +9 -11
  58. package/dist/esm/utils/ports.mjs.map +1 -1
  59. package/dist/esm/utils/prerequisites.mjs +30 -24
  60. package/dist/esm/utils/prerequisites.mjs.map +1 -1
  61. package/dist/esm/utils/prompts.mjs +40 -17
  62. package/dist/esm/utils/prompts.mjs.map +1 -1
  63. package/dist/esm/utils/script-listing.mjs +101 -33
  64. package/dist/esm/utils/script-listing.mjs.map +1 -1
  65. package/dist/esm/utils/script-utils.mjs +14 -6
  66. package/dist/esm/utils/script-utils.mjs.map +1 -1
  67. package/dist/esm/utils/sync.mjs +38 -18
  68. package/dist/esm/utils/sync.mjs.map +1 -1
  69. 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
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
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
- import_node_module = require("node:module"),
39
- import_node_path = require("node:path"),
40
- import_citty = require("citty"),
41
- import_picocolors = __toESM(require("picocolors"), 1),
42
- import_sync = require("../utils/sync.cjs");
43
- const import_meta = {},
44
- require2 = (0, import_node_module.createRequire)(import_meta.url),
45
- DOCS_DIR = (0, import_node_path.dirname)(require2.resolve("@take-out/docs/package.json")),
46
- listCommand = (0, import_citty.defineCommand)({
47
- meta: {
48
- name: "list",
49
- description: "List all available documentation files"
50
- },
51
- async run() {
52
- (0, import_node_fs.existsSync)(DOCS_DIR) || (console.error(import_picocolors.default.red("\u2717 Docs directory not found")), process.exit(1));
53
- const files = (0, import_node_fs.readdirSync)(DOCS_DIR).filter(f => f.endsWith(".md")).sort();
54
- console.info(), console.info(import_picocolors.default.bold(import_picocolors.default.cyan("\u{1F4DA} Available Documentation"))), console.info();
55
- for (const file of files) {
56
- const name = file.replace(/\.md$/, ""),
57
- path = (0, import_node_path.join)(DOCS_DIR, file);
58
- let description = "";
59
- try {
60
- const match = (0, import_node_fs.readFileSync)(path, "utf-8").match(/^#\s+(.+)$/m);
61
- match?.[1] && (description = match[1]);
62
- } catch {}
63
- description ? (console.info(` ${import_picocolors.default.green(name)}`), console.info(` ${import_picocolors.default.dim(description)}`)) : console.info(` ${import_picocolors.default.green(name)}`);
64
- }
65
- console.info(), console.info(import_picocolors.default.dim("Use 'takeout docs get <name>' to view a document")), console.info();
66
- }
67
- }),
68
- getCommand = (0, import_citty.defineCommand)({
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 (errors.length > 0) {
115
- for (const {
116
- name
117
- } of errors) console.error(import_picocolors.default.red(`\u2717 Doc file not found: ${name}`));
118
- console.info(), console.info(import_picocolors.default.dim("Use 'takeout docs list' to see available docs")), results.length === 0 && process.exit(1), 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
- pathCommand = (0, import_citty.defineCommand)({
127
- meta: {
128
- name: "path",
129
- description: "Get the absolute path to a documentation file"
130
- },
131
- args: {
132
- name: {
133
- type: "positional",
134
- description: "Name of the doc file (without .md extension)",
135
- required: !1
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
- async run({
139
- args
140
- }) {
141
- if (!args.name) {
142
- console.info(DOCS_DIR);
143
- return;
116
+ if (!filePath) {
117
+ errors.push({
118
+ name,
119
+ error: "File not found"
120
+ });
121
+ continue;
144
122
  }
145
- const fileName = args.name.endsWith(".md") ? args.name : `${args.name}.md`,
146
- filePath = (0, import_node_path.join)(DOCS_DIR, fileName);
147
- (0, import_node_fs.existsSync)(filePath) || (console.error(import_picocolors.default.red(`\u2717 Doc file not found: ${args.name}`)), process.exit(1)), console.info(filePath);
148
- }
149
- }),
150
- ejectCommand = (0, import_citty.defineCommand)({
151
- meta: {
152
- name: "eject",
153
- description: "Eject Takeout documentation files into your project"
154
- },
155
- args: {
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
- async run({
163
- args
164
- }) {
165
- const cwd = process.cwd(),
166
- targetDocsDir = (0, import_node_path.join)(cwd, "docs"),
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
- const filesToSync = [],
177
- stats = {
178
- new: 0,
179
- modified: 0,
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
- if (console.info(import_picocolors.default.bold("Summary:")), console.info(` ${import_picocolors.default.green(`${stats.new} new`)}`), console.info(` ${import_picocolors.default.yellow(`${stats.modified} modified`)}`), console.info(` ${import_picocolors.default.dim(`${stats.identical} identical`)}`), console.info(), stats.new === 0 && stats.modified === 0) {
196
- console.info(import_picocolors.default.green("\u2713 All docs are already up to date!"));
197
- return;
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
- const sortOrder = {
200
- new: 0,
201
- modified: 1,
202
- identical: 2
203
- };
204
- filesToSync.sort((a, b) => sortOrder[a.status] - sortOrder[b.status]);
205
- let syncedCount = 0;
206
- for (const file of filesToSync) if (args.yes && file.status !== "identical") {
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) || (0, import_node_fs.mkdirSync)(targetDir, {
209
- recursive: !0
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), console.info(import_picocolors.default.green(` \u2713 ${file.name}`)), syncedCount++;
213
- } else (await (0, import_sync.syncFileWithConfirmation)(file)) && syncedCount++;
214
- console.info(), console.info(import_picocolors.default.bold(import_picocolors.default.green(`\u2713 Complete: ${syncedCount} file(s) ejected`))), console.info();
215
- }
216
- }),
217
- docsCommand = (0, import_citty.defineCommand)({
218
- meta: {
219
- name: "docs",
220
- description: "List and retrieve Takeout documentation"
221
- },
222
- subCommands: {
223
- list: listCommand,
224
- get: getCommand,
225
- path: pathCommand,
226
- eject: ejectCommand
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
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
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
- import_picocolors = __toESM(require("picocolors"), 1),
39
- import_env_setup = require("../utils/env-setup.cjs");
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: !1
63
+ default: false
62
64
  },
63
65
  "skip-optional": {
64
66
  type: "boolean",
65
67
  description: "Skip optional categories",
66
- default: !1
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(""), console.info(import_picocolors.default.bold("\u{1F680} Takeout Production Environment Setup")), console.info(import_picocolors.default.gray("Configure your production deployment settings")), console.info(""), (await (0, import_env_setup.setupProductionEnv)(cwd, {
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: !0
83
- })) || (console.info(import_picocolors.default.yellow(`
84
- \u26A0 Environment setup was cancelled`)), console.info(import_picocolors.default.gray("You can resume anytime with:")), console.info(import_picocolors.default.cyan(" bun takeout env:setup")), process.exit(1));
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
- \u2716 Environment setup failed:`)), console.error(error), process.exit(1);
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
  });