@take-out/cli 0.0.43 → 0.0.44
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.native.js +28 -35
- package/dist/cjs/cli.native.js.map +1 -6
- package/dist/cjs/commands/changed.native.js +132 -111
- package/dist/cjs/commands/changed.native.js.map +1 -6
- package/dist/cjs/commands/docs.native.js +405 -326
- package/dist/cjs/commands/docs.native.js.map +1 -6
- package/dist/cjs/commands/env-setup.native.js +75 -64
- package/dist/cjs/commands/env-setup.native.js.map +1 -6
- package/dist/cjs/commands/onboard.native.js +206 -193
- package/dist/cjs/commands/onboard.native.js.map +1 -6
- package/dist/cjs/commands/run.native.js +139 -109
- package/dist/cjs/commands/run.native.js.map +1 -6
- package/dist/cjs/commands/script.native.js +269 -227
- package/dist/cjs/commands/script.native.js.map +1 -6
- package/dist/cjs/commands/sync.native.js +58 -58
- package/dist/cjs/commands/sync.native.js.map +1 -6
- package/dist/cjs/constants/ascii.native.js +19 -16
- package/dist/cjs/constants/ascii.native.js.map +1 -6
- package/dist/cjs/index.native.js +22 -49
- package/dist/cjs/index.native.js.map +1 -6
- package/dist/cjs/types.native.js +9 -5
- package/dist/cjs/types.native.js.map +1 -6
- package/dist/cjs/utils/env-categories.native.js +181 -210
- package/dist/cjs/utils/env-categories.native.js.map +1 -6
- package/dist/cjs/utils/env-setup.native.js +104 -87
- package/dist/cjs/utils/env-setup.native.js.map +1 -6
- package/dist/cjs/utils/env.native.js +48 -46
- package/dist/cjs/utils/env.native.js.map +1 -6
- package/dist/cjs/utils/files.native.js +123 -111
- package/dist/cjs/utils/files.native.js.map +1 -6
- package/dist/cjs/utils/parallel-runner.native.js +70 -58
- package/dist/cjs/utils/parallel-runner.native.js.map +1 -6
- package/dist/cjs/utils/ports.native.js +37 -44
- package/dist/cjs/utils/ports.native.js.map +1 -6
- package/dist/cjs/utils/prerequisites.native.js +38 -37
- package/dist/cjs/utils/prerequisites.native.js.map +1 -6
- package/dist/cjs/utils/prompts.native.js +60 -72
- package/dist/cjs/utils/prompts.native.js.map +1 -6
- package/dist/cjs/utils/script-listing.native.js +73 -56
- package/dist/cjs/utils/script-listing.native.js.map +1 -6
- package/dist/cjs/utils/sync.native.js +39 -30
- package/dist/cjs/utils/sync.native.js.map +1 -6
- package/package.json +4 -4
|
@@ -1,32 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
8
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
9
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: !0
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
__copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
16
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
23
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
24
|
// file that has been converted to a CommonJS file using a Babel-
|
|
19
25
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
26
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: !0
|
|
30
|
+
}) : target, mod)),
|
|
31
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: !0
|
|
33
|
+
}), mod);
|
|
24
34
|
var onboard_exports = {};
|
|
25
35
|
__export(onboard_exports, {
|
|
26
36
|
onboardCommand: () => onboardCommand
|
|
27
37
|
});
|
|
28
38
|
module.exports = __toCommonJS(onboard_exports);
|
|
29
|
-
var import_child_process = require("child_process"),
|
|
39
|
+
var import_child_process = require("child_process"),
|
|
40
|
+
import_crypto = require("crypto"),
|
|
41
|
+
import_fs = require("fs"),
|
|
42
|
+
import_os = require("os"),
|
|
43
|
+
import_path = require("path"),
|
|
44
|
+
import_citty = require("citty"),
|
|
45
|
+
import_picocolors = __toESM(require("picocolors"), 1),
|
|
46
|
+
import_env = require("../utils/env.native.js"),
|
|
47
|
+
import_env_setup = require("../utils/env-setup.native.js"),
|
|
48
|
+
import_files = require("../utils/files.native.js"),
|
|
49
|
+
import_ports = require("../utils/ports.native.js"),
|
|
50
|
+
import_prerequisites = require("../utils/prerequisites.native.js"),
|
|
51
|
+
import_prompts = require("../utils/prompts.native.js");
|
|
30
52
|
var onboardCommand = (0, import_citty.defineCommand)({
|
|
31
53
|
meta: {
|
|
32
54
|
name: "onboard",
|
|
@@ -45,7 +67,10 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
45
67
|
}
|
|
46
68
|
},
|
|
47
69
|
async run(param) {
|
|
48
|
-
var {
|
|
70
|
+
var {
|
|
71
|
+
args
|
|
72
|
+
} = param,
|
|
73
|
+
cwd = process.cwd();
|
|
49
74
|
if (args.skip) {
|
|
50
75
|
(0, import_prompts.showInfo)("Skipping onboarding (--skip flag)");
|
|
51
76
|
return;
|
|
@@ -53,13 +78,9 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
53
78
|
if (args.defaults) {
|
|
54
79
|
(0, import_prompts.showInfo)("Running onboarding with defaults (--defaults flag)"), console.info();
|
|
55
80
|
var hasEnv = (0, import_env.envFileExists)(cwd, ".env");
|
|
56
|
-
if (hasEnv)
|
|
57
|
-
(0, import_prompts.showInfo)(".env already exists, skipping");
|
|
58
|
-
else {
|
|
81
|
+
if (hasEnv) (0, import_prompts.showInfo)(".env already exists, skipping");else {
|
|
59
82
|
var copyResult = (0, import_env.copyEnvFile)(cwd, ".env.development", ".env");
|
|
60
|
-
if (copyResult.success)
|
|
61
|
-
(0, import_prompts.showSuccess)("Created .env from .env.development");
|
|
62
|
-
else {
|
|
83
|
+
if (copyResult.success) (0, import_prompts.showSuccess)("Created .env from .env.development");else {
|
|
63
84
|
(0, import_prompts.showError)(`Failed to create .env: ${copyResult.error}`);
|
|
64
85
|
return;
|
|
65
86
|
}
|
|
@@ -69,13 +90,13 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
69
90
|
return;
|
|
70
91
|
}
|
|
71
92
|
(0, import_prompts.displayWelcome)();
|
|
72
|
-
var savedState = loadOnboardState(cwd),
|
|
93
|
+
var savedState = loadOnboardState(cwd),
|
|
94
|
+
startStep;
|
|
73
95
|
if (savedState) {
|
|
74
96
|
console.info(), (0, import_prompts.showInfo)(`Found incomplete setup from previous session (${savedState.step})`);
|
|
75
97
|
var shouldResume = await (0, import_prompts.confirmContinue)("Resume from where you left off?", !0);
|
|
76
98
|
shouldResume ? startStep = savedState.step : (clearOnboardState(cwd), startStep = await (0, import_prompts.promptStartStep)());
|
|
77
|
-
} else
|
|
78
|
-
startStep = await (0, import_prompts.promptStartStep)();
|
|
99
|
+
} else startStep = await (0, import_prompts.promptStartStep)();
|
|
79
100
|
if (startStep === "cancel") {
|
|
80
101
|
(0, import_prompts.displayOutro)("Setup cancelled");
|
|
81
102
|
return;
|
|
@@ -84,15 +105,19 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
84
105
|
(0, import_prompts.showStep)("Monorepo Ejection"), console.info(), console.info(import_picocolors.default.gray("We've included a variety of packages we found useful building apps with this stack:")), console.info(import_picocolors.default.gray(" \u2022 @take-out/cli - CLI tools and onboarding")), console.info(import_picocolors.default.gray(" \u2022 @take-out/helpers - Utility functions")), console.info(import_picocolors.default.gray(" \u2022 @take-out/hooks - React hooks")), console.info(import_picocolors.default.gray(" \u2022 @take-out/postgres - Database utilities")), console.info(import_picocolors.default.gray(" \u2022 @take-out/scripts - Build and dev scripts")), console.info(import_picocolors.default.gray(" \u2022 @take-out/better-auth-utils - Auth helpers")), console.info();
|
|
85
106
|
var shouldEject = await (0, import_prompts.confirmContinue)("Eject from monorepo setup? (removes ./packages, uses published versions)", !0);
|
|
86
107
|
if (shouldEject) {
|
|
87
|
-
var _dryResult_packages,
|
|
88
|
-
|
|
89
|
-
|
|
108
|
+
var _dryResult_packages,
|
|
109
|
+
_dryResult_warnings,
|
|
110
|
+
dryResult = await (0, import_files.ejectFromMonorepo)(cwd, {
|
|
111
|
+
dryRun: !0
|
|
112
|
+
});
|
|
90
113
|
if (!dryResult.success) {
|
|
91
114
|
(0, import_prompts.showError)(`Cannot eject: ${dryResult.error}`), clearOnboardState(cwd);
|
|
92
115
|
return;
|
|
93
116
|
}
|
|
94
117
|
console.info(), (0, import_prompts.showInfo)(`Found ${(_dryResult_packages = dryResult.packages) === null || _dryResult_packages === void 0 ? void 0 : _dryResult_packages.length} packages to convert:`);
|
|
95
|
-
var _iteratorNormalCompletion = !0,
|
|
118
|
+
var _iteratorNormalCompletion = !0,
|
|
119
|
+
_didIteratorError = !1,
|
|
120
|
+
_iteratorError = void 0;
|
|
96
121
|
try {
|
|
97
122
|
for (var _iterator = (dryResult.packages || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
98
123
|
var pkg = _step.value;
|
|
@@ -104,12 +129,13 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
104
129
|
try {
|
|
105
130
|
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
106
131
|
} finally {
|
|
107
|
-
if (_didIteratorError)
|
|
108
|
-
throw _iteratorError;
|
|
132
|
+
if (_didIteratorError) throw _iteratorError;
|
|
109
133
|
}
|
|
110
134
|
}
|
|
111
135
|
if (!((_dryResult_warnings = dryResult.warnings) === null || _dryResult_warnings === void 0) && _dryResult_warnings.length) {
|
|
112
|
-
var _iteratorNormalCompletion1 = !0,
|
|
136
|
+
var _iteratorNormalCompletion1 = !0,
|
|
137
|
+
_didIteratorError1 = !1,
|
|
138
|
+
_iteratorError1 = void 0;
|
|
113
139
|
try {
|
|
114
140
|
for (var _iterator1 = dryResult.warnings[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) {
|
|
115
141
|
var warn = _step1.value;
|
|
@@ -121,8 +147,7 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
121
147
|
try {
|
|
122
148
|
!_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
|
|
123
149
|
} finally {
|
|
124
|
-
if (_didIteratorError1)
|
|
125
|
-
throw _iteratorError1;
|
|
150
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
126
151
|
}
|
|
127
152
|
}
|
|
128
153
|
}
|
|
@@ -132,7 +157,8 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
132
157
|
(0, import_prompts.showInfo)("Eject cancelled"), clearOnboardState(cwd), (0, import_prompts.displayOutro)("Done!");
|
|
133
158
|
return;
|
|
134
159
|
}
|
|
135
|
-
var spinner = (0, import_prompts.showSpinner)("Ejecting from monorepo..."),
|
|
160
|
+
var spinner = (0, import_prompts.showSpinner)("Ejecting from monorepo..."),
|
|
161
|
+
result = await (0, import_files.ejectFromMonorepo)(cwd);
|
|
136
162
|
if (result.success) {
|
|
137
163
|
spinner.stop("Ejected from monorepo"), (0, import_prompts.showSuccess)("\u2713 Removed ./packages directory"), (0, import_prompts.showSuccess)("\u2713 Updated package.json to use published versions"), (0, import_prompts.showSuccess)("\u2713 Installed published packages");
|
|
138
164
|
try {
|
|
@@ -148,8 +174,7 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
148
174
|
var _result_error;
|
|
149
175
|
spinner.stop("Ejection failed"), (0, import_prompts.showError)(`Failed to eject: ${result.error}`), !((_result_error = result.error) === null || _result_error === void 0) && _result_error.includes("install failed") && ((0, import_prompts.showInfo)('You may be able to fix this by running "bun install" manually'), (0, import_prompts.showInfo)('Or restore the repo from git with "git checkout ."'));
|
|
150
176
|
}
|
|
151
|
-
} else
|
|
152
|
-
(0, import_prompts.showInfo)("Eject cancelled");
|
|
177
|
+
} else (0, import_prompts.showInfo)("Eject cancelled");
|
|
153
178
|
clearOnboardState(cwd), (0, import_prompts.displayOutro)("Done!");
|
|
154
179
|
return;
|
|
155
180
|
}
|
|
@@ -188,10 +213,10 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
188
213
|
if (shouldCustomizePort) {
|
|
189
214
|
var newPort = await (0, import_prompts.promptText)("Web server port:", "8081", "3000, 8080, 8081, etc.");
|
|
190
215
|
newPort && newPort !== "8081" && (await replacePortInProject(cwd, "8081", newPort), (0, import_prompts.showSuccess)(`\u2713 Updated web server port to ${newPort}`));
|
|
191
|
-
} else
|
|
192
|
-
(0, import_prompts.showInfo)("Keeping default port 8081");
|
|
216
|
+
} else (0, import_prompts.showInfo)("Keeping default port 8081");
|
|
193
217
|
console.info(), (0, import_prompts.showStep)("Checking service ports..."), console.info();
|
|
194
|
-
var portChecks = (0, import_ports.checkAllPorts)(),
|
|
218
|
+
var portChecks = (0, import_ports.checkAllPorts)(),
|
|
219
|
+
conflicts = (0, import_ports.getConflictingPorts)(portChecks);
|
|
195
220
|
conflicts.length > 0 && ((0, import_prompts.displayPortConflicts)(conflicts), (0, import_prompts.showWarning)("Some ports are already in use. You may need to stop other services.")), console.info();
|
|
196
221
|
}
|
|
197
222
|
if (startStep === "prerequisites" || startStep === "identity" || startStep === "ports" || startStep === "full") {
|
|
@@ -209,12 +234,12 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
209
234
|
var dryResult1 = await (0, import_files.ejectFromMonorepo)(cwd, {
|
|
210
235
|
dryRun: !0
|
|
211
236
|
});
|
|
212
|
-
if (!dryResult1.success)
|
|
213
|
-
(0, import_prompts.showError)(`Cannot eject: ${dryResult1.error}`);
|
|
214
|
-
else {
|
|
237
|
+
if (!dryResult1.success) (0, import_prompts.showError)(`Cannot eject: ${dryResult1.error}`);else {
|
|
215
238
|
var _dryResult_packages1, _dryResult_warnings1;
|
|
216
239
|
console.info(), (0, import_prompts.showInfo)(`Found ${(_dryResult_packages1 = dryResult1.packages) === null || _dryResult_packages1 === void 0 ? void 0 : _dryResult_packages1.length} packages to convert:`);
|
|
217
|
-
var _iteratorNormalCompletion2 = !0,
|
|
240
|
+
var _iteratorNormalCompletion2 = !0,
|
|
241
|
+
_didIteratorError2 = !1,
|
|
242
|
+
_iteratorError2 = void 0;
|
|
218
243
|
try {
|
|
219
244
|
for (var _iterator2 = (dryResult1.packages || [])[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
|
|
220
245
|
var pkg1 = _step2.value;
|
|
@@ -226,12 +251,13 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
226
251
|
try {
|
|
227
252
|
!_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
|
|
228
253
|
} finally {
|
|
229
|
-
if (_didIteratorError2)
|
|
230
|
-
throw _iteratorError2;
|
|
254
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
231
255
|
}
|
|
232
256
|
}
|
|
233
257
|
if (!((_dryResult_warnings1 = dryResult1.warnings) === null || _dryResult_warnings1 === void 0) && _dryResult_warnings1.length) {
|
|
234
|
-
var _iteratorNormalCompletion3 = !0,
|
|
258
|
+
var _iteratorNormalCompletion3 = !0,
|
|
259
|
+
_didIteratorError3 = !1,
|
|
260
|
+
_iteratorError3 = void 0;
|
|
235
261
|
try {
|
|
236
262
|
for (var _iterator3 = dryResult1.warnings[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = !0) {
|
|
237
263
|
var warn1 = _step3.value;
|
|
@@ -243,15 +269,15 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
243
269
|
try {
|
|
244
270
|
!_iteratorNormalCompletion3 && _iterator3.return != null && _iterator3.return();
|
|
245
271
|
} finally {
|
|
246
|
-
if (_didIteratorError3)
|
|
247
|
-
throw _iteratorError3;
|
|
272
|
+
if (_didIteratorError3) throw _iteratorError3;
|
|
248
273
|
}
|
|
249
274
|
}
|
|
250
275
|
}
|
|
251
276
|
console.info();
|
|
252
277
|
var confirmEject1 = await (0, import_prompts.confirmContinue)("Proceed with ejection?", !0);
|
|
253
278
|
if (confirmEject1) {
|
|
254
|
-
var spinner1 = (0, import_prompts.showSpinner)("Ejecting from monorepo..."),
|
|
279
|
+
var spinner1 = (0, import_prompts.showSpinner)("Ejecting from monorepo..."),
|
|
280
|
+
result1 = await (0, import_files.ejectFromMonorepo)(cwd);
|
|
255
281
|
if (result1.success) {
|
|
256
282
|
spinner1.stop("Ejected from monorepo"), (0, import_prompts.showSuccess)("\u2713 Removed ./packages directory"), (0, import_prompts.showSuccess)("\u2713 Updated package.json to use published versions"), (0, import_prompts.showSuccess)("\u2713 Installed published packages");
|
|
257
283
|
try {
|
|
@@ -267,11 +293,9 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
267
293
|
var _result_error1;
|
|
268
294
|
spinner1.stop("Ejection failed"), (0, import_prompts.showError)(`Failed to eject: ${result1.error}`), !((_result_error1 = result1.error) === null || _result_error1 === void 0) && _result_error1.includes("install failed") && ((0, import_prompts.showInfo)('You may be able to fix this by running "bun install" manually'), (0, import_prompts.showInfo)('Or restore the repo from git with "git checkout ."'));
|
|
269
295
|
}
|
|
270
|
-
} else
|
|
271
|
-
(0, import_prompts.showInfo)("Keeping monorepo setup - you can customize packages locally"), (0, import_prompts.showInfo)('Run "bun tko sync" to sync with upstream Takeout updates later');
|
|
296
|
+
} else (0, import_prompts.showInfo)("Keeping monorepo setup - you can customize packages locally"), (0, import_prompts.showInfo)('Run "bun tko sync" to sync with upstream Takeout updates later');
|
|
272
297
|
}
|
|
273
|
-
} else
|
|
274
|
-
(0, import_prompts.showInfo)("Keeping monorepo setup - you can customize packages locally"), (0, import_prompts.showInfo)('Run "bun tko sync" to sync with upstream Takeout updates later');
|
|
298
|
+
} else (0, import_prompts.showInfo)("Keeping monorepo setup - you can customize packages locally"), (0, import_prompts.showInfo)('Run "bun tko sync" to sync with upstream Takeout updates later');
|
|
275
299
|
console.info();
|
|
276
300
|
}
|
|
277
301
|
if (startStep === "full" || startStep === "production") {
|
|
@@ -286,10 +310,14 @@ var onboardCommand = (0, import_citty.defineCommand)({
|
|
|
286
310
|
}
|
|
287
311
|
});
|
|
288
312
|
async function customizeProject(cwd) {
|
|
289
|
-
var projectName = await (0, import_prompts.promptText)("Project name:", "takeout", "my-awesome-app"),
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
313
|
+
var projectName = await (0, import_prompts.promptText)("Project name:", "takeout", "my-awesome-app"),
|
|
314
|
+
slug = await (0, import_prompts.promptText)("Project slug (URL-friendly):", projectName.toLowerCase().replace(/\s+/g, "-"), "my-awesome-app"),
|
|
315
|
+
bundleId = await (0, import_prompts.promptText)("Bundle identifier:", `com.${slug}.app`, "com.example.app"),
|
|
316
|
+
domain = await (0, import_prompts.promptText)("Development domain:", "localhost:8081", "localhost:8081"),
|
|
317
|
+
pkgResult = (0, import_files.updatePackageJson)(cwd, {
|
|
318
|
+
name: projectName,
|
|
319
|
+
description: `${projectName} - Built with Takeout starter kit`
|
|
320
|
+
});
|
|
293
321
|
pkgResult.success ? (0, import_prompts.showSuccess)("Updated package.json") : (0, import_prompts.showError)(`Failed to update package.json: ${pkgResult.error}`);
|
|
294
322
|
var configResult = (0, import_files.updateAppConfig)(cwd, {
|
|
295
323
|
name: projectName,
|
|
@@ -301,18 +329,15 @@ async function customizeProject(cwd) {
|
|
|
301
329
|
(0, import_env.updateEnvVariable)(cwd, "BETTER_AUTH_URL", serverUrl), (0, import_env.updateEnvVariable)(cwd, "ONE_SERVER_URL", serverUrl), (0, import_prompts.showSuccess)("Updated environment URLs");
|
|
302
330
|
}
|
|
303
331
|
async function setupProductionDeployment(cwd) {
|
|
304
|
-
var platform = await (0, import_prompts.promptSelect)("Choose deployment platform:", [
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
hint: "Proven and reliable (~1 hour setup)"
|
|
314
|
-
}
|
|
315
|
-
]);
|
|
332
|
+
var platform = await (0, import_prompts.promptSelect)("Choose deployment platform:", [{
|
|
333
|
+
value: "uncloud",
|
|
334
|
+
label: "Uncloud",
|
|
335
|
+
hint: "Simpler and quicker (~10 minutes setup)"
|
|
336
|
+
}, {
|
|
337
|
+
value: "sst",
|
|
338
|
+
label: "AWS SST",
|
|
339
|
+
hint: "Proven and reliable (~1 hour setup)"
|
|
340
|
+
}]);
|
|
316
341
|
if (platform === "cancel") {
|
|
317
342
|
(0, import_prompts.showInfo)("Skipping production setup");
|
|
318
343
|
return;
|
|
@@ -325,42 +350,49 @@ async function setupUncloudDeployment(cwd) {
|
|
|
325
350
|
\u2022 Free subdomain (your-app.uncld.dev)
|
|
326
351
|
\u2022 Automatic SSL certificates
|
|
327
352
|
\u2022 Easy scaling`)), console.info(), console.info(), (0, import_prompts.showInfo)("Server Architecture"), console.info(import_picocolors.default.gray("Docker images must match your server CPU architecture")), console.info();
|
|
328
|
-
var architecture = await (0, import_prompts.promptSelect)("What CPU architecture is your deployment server?", [
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
hint: "Hetzner ARM, Oracle ARM, Bare metal ARM servers"
|
|
338
|
-
}
|
|
339
|
-
]);
|
|
353
|
+
var architecture = await (0, import_prompts.promptSelect)("What CPU architecture is your deployment server?", [{
|
|
354
|
+
value: "amd64",
|
|
355
|
+
label: "AMD64/x86_64 (Intel/AMD)",
|
|
356
|
+
hint: "Most VPS providers (DigitalOcean, Linode, Vultr)"
|
|
357
|
+
}, {
|
|
358
|
+
value: "arm64",
|
|
359
|
+
label: "ARM64 (Apple Silicon)",
|
|
360
|
+
hint: "Hetzner ARM, Oracle ARM, Bare metal ARM servers"
|
|
361
|
+
}]);
|
|
340
362
|
if (architecture === "cancel") {
|
|
341
363
|
(0, import_prompts.showInfo)("Skipping production setup");
|
|
342
364
|
return;
|
|
343
365
|
}
|
|
344
366
|
var deploymentArch = architecture === "arm64" ? "linux/arm64" : "linux/amd64";
|
|
345
367
|
console.info(), (0, import_prompts.showInfo)(`Will build Docker images for: ${deploymentArch}`), console.info();
|
|
346
|
-
var appConstantsPath = (0, import_path.resolve)(cwd, "src/constants/app.ts"),
|
|
368
|
+
var appConstantsPath = (0, import_path.resolve)(cwd, "src/constants/app.ts"),
|
|
369
|
+
defaultAppName = "my-app";
|
|
347
370
|
try {
|
|
348
|
-
var appConstants = (0, import_fs.readFileSync)(appConstantsPath, "utf-8"),
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
var useFreeSubdomain = await (0, import_prompts.confirmContinue)("Use free Uncloud subdomain?", !0),
|
|
371
|
+
var appConstants = (0, import_fs.readFileSync)(appConstantsPath, "utf-8"),
|
|
372
|
+
appNameMatch = appConstants.match(/APP_NAME_LOWERCASE\s*=\s*['"](.+?)['"]/);
|
|
373
|
+
appNameMatch?.[1] && (defaultAppName = appNameMatch[1]);
|
|
374
|
+
} catch {}
|
|
375
|
+
var useFreeSubdomain = await (0, import_prompts.confirmContinue)("Use free Uncloud subdomain?", !0),
|
|
376
|
+
domain,
|
|
377
|
+
zeroUrl;
|
|
353
378
|
if (useFreeSubdomain) {
|
|
354
379
|
var appName = await (0, import_prompts.promptText)("App name for subdomain:", defaultAppName, defaultAppName);
|
|
355
380
|
domain = `https://${appName}.uncld.dev`, zeroUrl = `https://zero-${appName}.uncld.dev`;
|
|
356
|
-
} else
|
|
357
|
-
domain = await (0, import_prompts.promptText)("Enter your custom domain:", void 0, "https://yourapp.com"), zeroUrl = await (0, import_prompts.promptText)("Enter your Zero sync domain:", void 0, "https://zero.yourapp.com"), console.info(), (0, import_prompts.showWarning)("Custom domain setup requires DNS configuration after deployment"), console.info(import_picocolors.default.gray("See: https://uncloud.run/docs/domains"));
|
|
381
|
+
} else domain = await (0, import_prompts.promptText)("Enter your custom domain:", void 0, "https://yourapp.com"), zeroUrl = await (0, import_prompts.promptText)("Enter your Zero sync domain:", void 0, "https://zero.yourapp.com"), console.info(), (0, import_prompts.showWarning)("Custom domain setup requires DNS configuration after deployment"), console.info(import_picocolors.default.gray("See: https://uncloud.run/docs/domains"));
|
|
358
382
|
console.info(), (0, import_prompts.showInfo)("Database Configuration"), console.info(), console.info(import_picocolors.default.gray("PostgreSQL database with logical replication enabled")), console.info(import_picocolors.default.gray("Zero sync requires 3 databases on the same host:")), console.info(import_picocolors.default.gray(" \u2022 Main database (your app data)")), console.info(import_picocolors.default.gray(" \u2022 Two Zero databases (for sync infrastructure)")), console.info(), console.info(import_picocolors.default.gray("Use a managed database (DigitalOcean, Render, Supabase, etc.)")), console.info(import_picocolors.default.gray("The deployment will automatically create the Zero databases")), console.info();
|
|
359
|
-
var dbUser = await (0, import_prompts.promptText)("Database username:", void 0, "postgres"),
|
|
383
|
+
var dbUser = await (0, import_prompts.promptText)("Database username:", void 0, "postgres"),
|
|
384
|
+
dbPassword = await (0, import_prompts.promptText)("Database password:", void 0, ""),
|
|
385
|
+
dbHost = await (0, import_prompts.promptText)("Database host (e.g., db-xxx.ondigitalocean.com):", void 0, "localhost"),
|
|
386
|
+
dbPort = await (0, import_prompts.promptText)("Database port:", "5432", "5432"),
|
|
387
|
+
dbName = await (0, import_prompts.promptText)("Main database name (will derive Zero databases from this):", "postgres", "postgres"),
|
|
388
|
+
dbUrl = `postgresql://${dbUser}:${dbPassword}@${dbHost}:${dbPort}/${dbName}`;
|
|
360
389
|
console.info();
|
|
361
|
-
var authSecret = (0, import_crypto.randomBytes)(32).toString("hex"),
|
|
390
|
+
var authSecret = (0, import_crypto.randomBytes)(32).toString("hex"),
|
|
391
|
+
envFile = ".env.production";
|
|
362
392
|
(0, import_env.updateEnvVariable)(cwd, "DEPLOYMENT_PLATFORM", "uncloud", envFile), (0, import_env.updateEnvVariable)(cwd, "DEPLOYMENT_ARCH", deploymentArch, envFile), (0, import_env.updateEnvVariable)(cwd, "DEPLOY_DB", dbUrl, envFile), (0, import_env.updateEnvVariable)(cwd, "BETTER_AUTH_SECRET", authSecret, envFile), (0, import_env.updateEnvVariable)(cwd, "BETTER_AUTH_URL", domain, envFile), (0, import_env.updateEnvVariable)(cwd, "ONE_SERVER_URL", domain, envFile), (0, import_env.updateEnvVariable)(cwd, "VITE_PUBLIC_ZERO_SERVER", zeroUrl, envFile);
|
|
363
|
-
var dbBase = dbUrl.split("/").slice(0, -1).join("/"),
|
|
393
|
+
var dbBase = dbUrl.split("/").slice(0, -1).join("/"),
|
|
394
|
+
zeroCvrDb = `${dbBase}/zero_cvr`,
|
|
395
|
+
zeroChangeDb = `${dbBase}/zero_cdb`;
|
|
364
396
|
(0, import_env.updateEnvVariable)(cwd, "ZERO_UPSTREAM_DB", dbUrl, envFile), (0, import_env.updateEnvVariable)(cwd, "ZERO_CVR_DB", zeroCvrDb, envFile), (0, import_env.updateEnvVariable)(cwd, "ZERO_CHANGE_DB", zeroChangeDb, envFile), (0, import_env.updateEnvVariable)(cwd, "ZERO_UPSTREAM_DB", dbUrl, ".env"), (0, import_env.updateEnvVariable)(cwd, "ZERO_CVR_DB", zeroCvrDb, ".env"), (0, import_env.updateEnvVariable)(cwd, "ZERO_CHANGE_DB", zeroChangeDb, ".env");
|
|
365
397
|
var deployHost = new URL(domain).hostname;
|
|
366
398
|
(0, import_env.updateEnvVariable)(cwd, "DEPLOY_HOST", deployHost, envFile), (0, import_env.updateEnvVariable)(cwd, "DEPLOY_USER", "root", envFile), console.info(), (0, import_prompts.showInfo)("SSH Key Configuration"), console.info(import_picocolors.default.gray("Deployment requires SSH access to your server")), console.info();
|
|
@@ -372,13 +404,15 @@ async function setupUncloudDeployment(cwd) {
|
|
|
372
404
|
var clusterSubdomain = await (0, import_prompts.promptText)("Enter your cluster subdomain from uc dns show:", "", "");
|
|
373
405
|
if (clusterSubdomain) {
|
|
374
406
|
console.info(), (0, import_prompts.showInfo)("DNS Setup Instructions:"), console.info(import_picocolors.default.gray("Add these CNAME records in your DNS provider (e.g., Cloudflare):")), console.info();
|
|
375
|
-
var webDomain = await (0, import_prompts.promptText)("Custom domain for web app (e.g., app.yourdomain.com):", "", ""),
|
|
407
|
+
var webDomain = await (0, import_prompts.promptText)("Custom domain for web app (e.g., app.yourdomain.com):", "", ""),
|
|
408
|
+
zeroDomain = await (0, import_prompts.promptText)("Custom domain for zero sync (e.g., zero.yourdomain.com):", "", "");
|
|
376
409
|
if (webDomain) {
|
|
377
410
|
console.info(), console.info(import_picocolors.default.cyan(` CNAME: ${webDomain} \u2192 ${clusterSubdomain}`)), zeroDomain && console.info(import_picocolors.default.cyan(` CNAME: ${zeroDomain} \u2192 ${clusterSubdomain}`)), console.info(), console.info(import_picocolors.default.yellow('\u26A0\uFE0F Set DNS to "DNS only" mode (gray cloud), not proxied')), console.info(), (0, import_env.updateEnvVariable)(cwd, "WEB_DOMAIN", webDomain, envFile), (0, import_env.updateEnvVariable)(cwd, "BETTER_AUTH_URL", `https://${webDomain}`, envFile), (0, import_env.updateEnvVariable)(cwd, "ONE_SERVER_URL", `https://${webDomain}`, envFile), zeroDomain && ((0, import_env.updateEnvVariable)(cwd, "ZERO_DOMAIN", zeroDomain, envFile), (0, import_env.updateEnvVariable)(cwd, "VITE_PUBLIC_ZERO_SERVER", `https://${zeroDomain}`, envFile)), (0, import_prompts.showSuccess)("\u2713 Custom domains configured"), console.info(), (0, import_prompts.showInfo)(import_picocolors.default.gray("DNS propagation typically takes 5-30 minutes")), console.info(), (0, import_prompts.showInfo)("SSL Certificate Options"), console.info(import_picocolors.default.gray("By default, Caddy will use Let's Encrypt for SSL certificates.")), console.info(import_picocolors.default.gray("If using Cloudflare, you can use Origin CA instead to:")), console.info(import_picocolors.default.gray(" \u2022 Bypass Let's Encrypt rate limits")), console.info(import_picocolors.default.gray(" \u2022 Enable Cloudflare proxy (DDoS protection, caching)")), console.info();
|
|
378
411
|
var useOriginCA = await (0, import_prompts.confirmContinue)("Use Cloudflare Origin CA? (requires Cloudflare account)", !1);
|
|
379
412
|
if (useOriginCA) {
|
|
380
413
|
console.info(), (0, import_prompts.showInfo)("Cloudflare Origin CA Setup"), console.info(import_picocolors.default.gray("1. Go to Cloudflare Dashboard \u2192 SSL/TLS \u2192 Origin Server")), console.info(import_picocolors.default.gray('2. Click "Create Certificate"')), console.info(import_picocolors.default.gray(`3. Add hostnames: ${webDomain}${zeroDomain ? `, ${zeroDomain}` : ""}`)), console.info(import_picocolors.default.gray("4. Choose 15 year validity")), console.info(import_picocolors.default.gray("5. Save certificate to: certs/origin.pem")), console.info(import_picocolors.default.gray("6. Save private key to: certs/origin.key")), console.info();
|
|
381
|
-
var certPath = await (0, import_prompts.promptText)("Path to Origin CA certificate:", "certs/origin.pem", "certs/origin.pem"),
|
|
414
|
+
var certPath = await (0, import_prompts.promptText)("Path to Origin CA certificate:", "certs/origin.pem", "certs/origin.pem"),
|
|
415
|
+
keyPath = await (0, import_prompts.promptText)("Path to Origin CA private key:", "certs/origin.key", "certs/origin.key");
|
|
382
416
|
certPath && keyPath && ((0, import_env.updateEnvVariable)(cwd, "ORIGIN_CA_CERT", certPath, envFile), (0, import_env.updateEnvVariable)(cwd, "ORIGIN_CA_KEY", keyPath, envFile), (0, import_prompts.showSuccess)("\u2713 Origin CA configured"), console.info(import_picocolors.default.gray(" Caddyfile will be auto-generated during deploy")), console.info(), console.info(import_picocolors.default.yellow("Important: In Cloudflare Dashboard:")), console.info(import_picocolors.default.yellow(" 1. Enable proxy (orange cloud) for your domains")), console.info(import_picocolors.default.yellow(' 2. Set SSL mode to "Full (strict)"')));
|
|
383
417
|
}
|
|
384
418
|
}
|
|
@@ -397,17 +431,14 @@ async function setupUncloudDeployment(cwd) {
|
|
|
397
431
|
}
|
|
398
432
|
console.info();
|
|
399
433
|
var syncToGitHub = await (0, import_prompts.confirmContinue)("Sync environment to GitHub secrets for CI/CD?", !0);
|
|
400
|
-
if (syncToGitHub)
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
else
|
|
410
|
-
(0, import_prompts.showInfo)("You can sync later with: bun scripts/env/sync-to-github.ts");
|
|
434
|
+
if (syncToGitHub) try {
|
|
435
|
+
(0, import_child_process.execSync)("bun scripts/env/sync-to-github.ts --yes", {
|
|
436
|
+
cwd,
|
|
437
|
+
stdio: "inherit"
|
|
438
|
+
});
|
|
439
|
+
} catch {
|
|
440
|
+
(0, import_prompts.showWarning)("Failed to sync to GitHub (you can do this later)"), (0, import_prompts.showInfo)("Run manually: bun scripts/env/sync-to-github.ts");
|
|
441
|
+
} else (0, import_prompts.showInfo)("You can sync later with: bun scripts/env/sync-to-github.ts");
|
|
411
442
|
console.info(), (0, import_prompts.showStep)("Ready to deploy!"), console.info(), console.info(import_picocolors.default.bold("Next steps:")), console.info(), console.info(import_picocolors.default.cyan("1. Install Uncloud CLI (if not already installed):")), console.info(import_picocolors.default.gray(" npm install -g uncloud-cli")), console.info(), console.info(import_picocolors.default.cyan("2. Login to Uncloud:")), console.info(import_picocolors.default.gray(" uncloud login")), console.info(), console.info(import_picocolors.default.cyan("3. Deploy your app:")), console.info(import_picocolors.default.gray(" bun tko uncloud deploy-prod")), console.info(), console.info(import_picocolors.default.cyan("Or push to main branch for automatic CI/CD deployment:")), console.info(import_picocolors.default.gray(" git push origin main")), console.info(), console.info(import_picocolors.default.bold("scaling to multiple machines:")), console.info(import_picocolors.default.gray(" uc machine add --name server-2 root@IP")), console.info(import_picocolors.default.gray(" uc scale web 3 # run 3 instances")), console.info(), console.info(import_picocolors.default.gray("view detailed guide: bun tko docs read deployment-uncloud")), console.info(import_picocolors.default.gray("or see: docs/deployment-uncloud.md"));
|
|
412
443
|
}
|
|
413
444
|
async function setupSSTDeployment(cwd) {
|
|
@@ -416,18 +447,15 @@ async function setupSSTDeployment(cwd) {
|
|
|
416
447
|
\u2022 Auto-scaling
|
|
417
448
|
\u2022 Full control over resources
|
|
418
449
|
\u2022 Higher setup complexity`)), console.info(), console.info(), (0, import_prompts.showInfo)("AWS ECS Architecture"), console.info(import_picocolors.default.gray("AWS Graviton (ARM64) is ~40% cheaper than x86_64")), console.info(import_picocolors.default.gray("Both have excellent performance, ARM recommended for cost savings")), console.info();
|
|
419
|
-
var architecture = await (0, import_prompts.promptSelect)("What CPU architecture for AWS ECS?", [
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
hint: "Standard option if you need specific x86 dependencies"
|
|
429
|
-
}
|
|
430
|
-
]);
|
|
450
|
+
var architecture = await (0, import_prompts.promptSelect)("What CPU architecture for AWS ECS?", [{
|
|
451
|
+
value: "arm64",
|
|
452
|
+
label: "ARM64 (Graviton) - Recommended",
|
|
453
|
+
hint: "Significantly cheaper, excellent performance"
|
|
454
|
+
}, {
|
|
455
|
+
value: "amd64",
|
|
456
|
+
label: "AMD64/x86_64 (Intel/AMD)",
|
|
457
|
+
hint: "Standard option if you need specific x86 dependencies"
|
|
458
|
+
}]);
|
|
431
459
|
if (architecture === "cancel") {
|
|
432
460
|
(0, import_prompts.showInfo)("Skipping AWS setup");
|
|
433
461
|
return;
|
|
@@ -447,7 +475,9 @@ async function setupSSTDeployment(cwd) {
|
|
|
447
475
|
var envFile = ".env.production";
|
|
448
476
|
(0, import_env.updateEnvVariable)(cwd, "DEPLOYMENT_PLATFORM", "sst", envFile), (0, import_env.updateEnvVariable)(cwd, "DEPLOYMENT_ARCH", deploymentArch, envFile), console.info(), (0, import_prompts.showInfo)("Updating sst.config.ts architecture...");
|
|
449
477
|
try {
|
|
450
|
-
var sstConfigPath = (0, import_path.resolve)(cwd, "sst.config.ts"),
|
|
478
|
+
var sstConfigPath = (0, import_path.resolve)(cwd, "sst.config.ts"),
|
|
479
|
+
sstConfig = (0, import_fs.readFileSync)(sstConfigPath, "utf-8"),
|
|
480
|
+
archValue = architecture === "arm64" ? "arm64" : "x86_64";
|
|
451
481
|
sstConfig = sstConfig.replace(/architecture:\s*['"]arm64['"]/g, `architecture: '${archValue}'`), sstConfig = sstConfig.replace(/architecture:\s*['"]x86_64['"]/g, `architecture: '${archValue}'`), (0, import_fs.writeFileSync)(sstConfigPath, sstConfig), (0, import_prompts.showSuccess)(`\u2713 Updated sst.config.ts to use ${archValue}`);
|
|
452
482
|
} catch {
|
|
453
483
|
(0, import_prompts.showWarning)("Could not update sst.config.ts (you can update manually)");
|
|
@@ -465,86 +495,77 @@ async function setupSSTDeployment(cwd) {
|
|
|
465
495
|
}
|
|
466
496
|
console.info();
|
|
467
497
|
var syncToGitHub = await (0, import_prompts.confirmContinue)("Sync environment to GitHub secrets for CI/CD?", !0);
|
|
468
|
-
if (syncToGitHub)
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
else
|
|
478
|
-
(0, import_prompts.showInfo)("You can sync later with: bun scripts/env/sync-to-github.ts");
|
|
498
|
+
if (syncToGitHub) try {
|
|
499
|
+
(0, import_child_process.execSync)("bun scripts/env/sync-to-github.ts --yes", {
|
|
500
|
+
cwd,
|
|
501
|
+
stdio: "inherit"
|
|
502
|
+
});
|
|
503
|
+
} catch {
|
|
504
|
+
(0, import_prompts.showWarning)("Failed to sync to GitHub (you can do this later)"), (0, import_prompts.showInfo)("Run manually: bun scripts/env/sync-to-github.ts");
|
|
505
|
+
} else (0, import_prompts.showInfo)("You can sync later with: bun scripts/env/sync-to-github.ts");
|
|
479
506
|
console.info(), (0, import_prompts.showInfo)("For complete AWS deployment guide, see: https://docs.yourapp.com/deployment/sst");
|
|
480
507
|
}
|
|
481
508
|
async function configureCIRunners(cwd) {
|
|
482
509
|
(0, import_prompts.showInfo)("GitHub Actions CI/CD Runner Configuration"), console.info(), console.info(import_picocolors.default.gray(`Your project uses ARM64 (Apple Silicon) architecture for Docker builds.
|
|
483
510
|
GitHub Actions requires compatible runners for CI/CD to work properly.`)), console.info();
|
|
484
|
-
var runnerChoice = await (0, import_prompts.promptSelect)("Choose your CI runner configuration:", [
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
value: "skip",
|
|
502
|
-
label: "Configure Later",
|
|
503
|
-
hint: "Skip for now (CI will fail until configured)"
|
|
504
|
-
}
|
|
505
|
-
]);
|
|
511
|
+
var runnerChoice = await (0, import_prompts.promptSelect)("Choose your CI runner configuration:", [{
|
|
512
|
+
value: "warp",
|
|
513
|
+
label: "Warp Runners (Recommended)",
|
|
514
|
+
hint: "Fast ARM64 runners, cheaper than GitHub ($0.005/min)"
|
|
515
|
+
}, {
|
|
516
|
+
value: "github-arm",
|
|
517
|
+
label: "GitHub ARM Runners",
|
|
518
|
+
hint: "Native ARM64, requires GitHub Teams/Enterprise ($0.16/min)"
|
|
519
|
+
}, {
|
|
520
|
+
value: "github-x64",
|
|
521
|
+
label: "GitHub x64 Runners (Free)",
|
|
522
|
+
hint: "Requires changing Docker builds to x64 architecture"
|
|
523
|
+
}, {
|
|
524
|
+
value: "skip",
|
|
525
|
+
label: "Configure Later",
|
|
526
|
+
hint: "Skip for now (CI will fail until configured)"
|
|
527
|
+
}]);
|
|
506
528
|
if (runnerChoice === "cancel" || runnerChoice === "skip") {
|
|
507
529
|
(0, import_prompts.showInfo)("Skipping CI runner configuration"), (0, import_prompts.showWarning)("CI/CD will fail until you configure runners. Update .github/workflows/ci.yml");
|
|
508
530
|
return;
|
|
509
531
|
}
|
|
510
|
-
var ciConfigPath = (0, import_path.resolve)(cwd, ".github/workflows/ci.yml"),
|
|
532
|
+
var ciConfigPath = (0, import_path.resolve)(cwd, ".github/workflows/ci.yml"),
|
|
533
|
+
dockerBuildPath = (0, import_path.resolve)(cwd, "scripts/web/build-docker.ts");
|
|
511
534
|
try {
|
|
512
|
-
var ciContent = (0, import_fs.readFileSync)(ciConfigPath, "utf-8"),
|
|
535
|
+
var ciContent = (0, import_fs.readFileSync)(ciConfigPath, "utf-8"),
|
|
536
|
+
dockerContent = (0, import_fs.readFileSync)(dockerBuildPath, "utf-8");
|
|
513
537
|
runnerChoice === "warp" ? (console.info(), (0, import_prompts.showStep)("Setting up Warp runners"), console.info(), console.info(import_picocolors.default.cyan("1. Sign up for Warp Build (if not already):")), console.info(import_picocolors.default.gray(" https://www.warpbuild.com")), console.info(), console.info(import_picocolors.default.cyan("2. Install Warp GitHub App:")), console.info(import_picocolors.default.gray(" https://github.com/apps/warp-build")), console.info(), console.info(import_picocolors.default.cyan("3. Grant access to your repository")), console.info(), (0, import_prompts.showSuccess)("\u2713 CI configuration already set for Warp runners"), (0, import_prompts.showInfo)("Warp uses ARM64 runners matching your local architecture")) : runnerChoice === "github-arm" ? (ciContent = ciContent.replace(/runs-on:.*warp-ubuntu-latest-arm64.*/, "runs-on: ubuntu-24.04-arm"), (0, import_fs.writeFileSync)(ciConfigPath, ciContent), console.info(), (0, import_prompts.showSuccess)("\u2713 Updated CI to use GitHub ARM runners"), (0, import_prompts.showWarning)("Note: GitHub ARM runners require Teams or Enterprise plan"), (0, import_prompts.showInfo)("Pricing: $0.16/minute for ARM runners")) : runnerChoice === "github-x64" && (ciContent = ciContent.replace(/runs-on:.*warp-ubuntu-latest-arm64.*/, "runs-on: ubuntu-latest"), (0, import_fs.writeFileSync)(ciConfigPath, ciContent), dockerContent = dockerContent.replace("linux/arm64", "linux/amd64"), (0, import_fs.writeFileSync)(dockerBuildPath, dockerContent), console.info(), (0, import_prompts.showSuccess)("\u2713 Updated CI to use free GitHub x64 runners"), (0, import_prompts.showSuccess)("\u2713 Updated Docker builds to x64 architecture"), (0, import_prompts.showWarning)("Note: Docker images built on x64 won't run on ARM64 machines without emulation")), console.info(), (0, import_prompts.showInfo)("CI runner configuration complete");
|
|
514
538
|
} catch {
|
|
515
539
|
(0, import_prompts.showError)("Failed to update CI configuration"), (0, import_prompts.showInfo)("Please manually update .github/workflows/ci.yml and scripts/web/build-docker.ts");
|
|
516
540
|
}
|
|
517
541
|
}
|
|
518
542
|
async function replacePortInProject(cwd, oldPort, newPort) {
|
|
519
|
-
var spinner = (0, import_prompts.showSpinner)(`Replacing port ${oldPort} with ${newPort} throughout project...`),
|
|
520
|
-
"node_modules",
|
|
521
|
-
".
|
|
522
|
-
"dist",
|
|
523
|
-
"build",
|
|
524
|
-
".next",
|
|
525
|
-
".turbo",
|
|
526
|
-
"types"
|
|
527
|
-
]), includeExts = /* @__PURE__ */ new Set([
|
|
528
|
-
".ts",
|
|
529
|
-
".tsx",
|
|
530
|
-
".js",
|
|
531
|
-
".jsx",
|
|
532
|
-
".json",
|
|
533
|
-
".md",
|
|
534
|
-
".yml",
|
|
535
|
-
".yaml"
|
|
536
|
-
]);
|
|
543
|
+
var spinner = (0, import_prompts.showSpinner)(`Replacing port ${oldPort} with ${newPort} throughout project...`),
|
|
544
|
+
excludeDirs = /* @__PURE__ */new Set(["node_modules", ".git", "dist", "build", ".next", ".turbo", "types"]),
|
|
545
|
+
includeExts = /* @__PURE__ */new Set([".ts", ".tsx", ".js", ".jsx", ".json", ".md", ".yml", ".yaml"]);
|
|
537
546
|
async function processDir(dir) {
|
|
538
|
-
var {
|
|
547
|
+
var {
|
|
548
|
+
readdirSync,
|
|
549
|
+
statSync
|
|
550
|
+
} = await import("fs"),
|
|
551
|
+
{
|
|
552
|
+
join,
|
|
553
|
+
extname,
|
|
554
|
+
basename
|
|
555
|
+
} = await import("path"),
|
|
556
|
+
entries = readdirSync(dir),
|
|
557
|
+
_iteratorNormalCompletion = !0,
|
|
558
|
+
_didIteratorError = !1,
|
|
559
|
+
_iteratorError = void 0;
|
|
539
560
|
try {
|
|
540
561
|
for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
541
|
-
var entry = _step.value,
|
|
562
|
+
var entry = _step.value,
|
|
563
|
+
fullPath = join(dir, entry);
|
|
542
564
|
try {
|
|
543
565
|
var stat = statSync(fullPath);
|
|
544
|
-
if (stat.isDirectory())
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
var ext = extname(entry), name = basename(entry);
|
|
566
|
+
if (stat.isDirectory()) excludeDirs.has(entry) || (await processDir(fullPath));else if (stat.isFile()) {
|
|
567
|
+
var ext = extname(entry),
|
|
568
|
+
name = basename(entry);
|
|
548
569
|
if (includeExts.has(ext) || name.startsWith(".env")) {
|
|
549
570
|
var content = (0, import_fs.readFileSync)(fullPath, "utf-8");
|
|
550
571
|
if (content.includes(oldPort)) {
|
|
@@ -553,8 +574,7 @@ async function replacePortInProject(cwd, oldPort, newPort) {
|
|
|
553
574
|
}
|
|
554
575
|
}
|
|
555
576
|
}
|
|
556
|
-
} catch {
|
|
557
|
-
}
|
|
577
|
+
} catch {}
|
|
558
578
|
}
|
|
559
579
|
} catch (err) {
|
|
560
580
|
_didIteratorError = !0, _iteratorError = err;
|
|
@@ -562,8 +582,7 @@ async function replacePortInProject(cwd, oldPort, newPort) {
|
|
|
562
582
|
try {
|
|
563
583
|
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
564
584
|
} finally {
|
|
565
|
-
if (_didIteratorError)
|
|
566
|
-
throw _iteratorError;
|
|
585
|
+
if (_didIteratorError) throw _iteratorError;
|
|
567
586
|
}
|
|
568
587
|
}
|
|
569
588
|
}
|
|
@@ -577,15 +596,15 @@ function getStatePath(cwd) {
|
|
|
577
596
|
return (0, import_path.resolve)(cwd, "node_modules/.takeout/onboard-state.json");
|
|
578
597
|
}
|
|
579
598
|
function saveOnboardState(cwd, state) {
|
|
580
|
-
var statePath = getStatePath(cwd),
|
|
599
|
+
var statePath = getStatePath(cwd),
|
|
600
|
+
stateDir = (0, import_path.resolve)(cwd, "node_modules/.takeout");
|
|
581
601
|
(0, import_fs.existsSync)(stateDir) || (0, import_fs.mkdirSync)(stateDir, {
|
|
582
602
|
recursive: !0
|
|
583
603
|
}), (0, import_fs.writeFileSync)(statePath, JSON.stringify(state, null, 2));
|
|
584
604
|
}
|
|
585
605
|
function loadOnboardState(cwd) {
|
|
586
606
|
var statePath = getStatePath(cwd);
|
|
587
|
-
if (!(0, import_fs.existsSync)(statePath))
|
|
588
|
-
return null;
|
|
607
|
+
if (!(0, import_fs.existsSync)(statePath)) return null;
|
|
589
608
|
try {
|
|
590
609
|
var content = (0, import_fs.readFileSync)(statePath, "utf-8");
|
|
591
610
|
return JSON.parse(content);
|
|
@@ -595,14 +614,8 @@ function loadOnboardState(cwd) {
|
|
|
595
614
|
}
|
|
596
615
|
function clearOnboardState(cwd) {
|
|
597
616
|
var statePath = getStatePath(cwd);
|
|
598
|
-
if ((0, import_fs.existsSync)(statePath))
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
} catch {
|
|
602
|
-
}
|
|
617
|
+
if ((0, import_fs.existsSync)(statePath)) try {
|
|
618
|
+
(0, import_fs.unlinkSync)(statePath);
|
|
619
|
+
} catch {}
|
|
603
620
|
}
|
|
604
|
-
|
|
605
|
-
0 && (module.exports = {
|
|
606
|
-
onboardCommand
|
|
607
|
-
});
|
|
608
|
-
//# sourceMappingURL=onboard.js.map
|
|
621
|
+
//# sourceMappingURL=onboard.native.js.map
|