@reliverse/dler 1.7.125 → 1.7.127
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/bin/impl/auth/generators/auth-config.d.ts +2 -2
- package/bin/impl/auth/generators/auth-config.js +2 -2
- package/bin/impl/auth/impl/init.d.ts +2 -2
- package/bin/impl/auth/impl/migrate.js +5 -4
- package/bin/impl/build/binary-flow.js +1 -1
- package/bin/impl/build/impl.js +1 -1
- package/bin/impl/build/library-flow.js +1 -1
- package/bin/impl/build/regular-flow.js +1 -1
- package/bin/impl/config/constants.d.ts +1 -1
- package/bin/impl/config/constants.js +1 -1
- package/bin/impl/login/login-impl.js +7 -9
- package/bin/impl/merge/mod.js +1 -1
- package/bin/impl/providers/better-t-stack/helpers/database-providers/mongodb-atlas-setup.js +8 -7
- package/bin/impl/providers/better-t-stack/helpers/database-providers/neon-setup.js +9 -8
- package/bin/impl/providers/better-t-stack/helpers/database-providers/prisma-postgres-setup.js +9 -9
- package/bin/impl/providers/better-t-stack/helpers/database-providers/turso-setup.js +21 -21
- package/bin/impl/providers/better-t-stack/helpers/project-generation/install-dependencies.js +4 -4
- package/bin/impl/providers/better-t-stack/helpers/setup/db-setup.js +3 -3
- package/bin/impl/providers/better-t-stack/helpers/setup/starlight-setup.js +4 -4
- package/bin/impl/providers/better-t-stack/helpers/setup/tauri-setup.js +4 -4
- package/bin/impl/providers/better-t-stack/types.d.ts +4 -4
- package/bin/impl/providers/better-t-stack/utils/sponsors.js +4 -4
- package/bin/impl/providers/reliverse-stack/rs-impl.d.ts +2 -2
- package/bin/impl/pub/impl.js +30 -3
- package/bin/impl/pub/pub-library.js +6 -2
- package/bin/impl/pub/pub-regular.js +6 -2
- package/bin/impl/utils/downloading/downloadRepo.js +6 -6
- package/bin/mod.d.ts +0 -2
- package/bin/mod.js +0 -25
- package/package.json +7 -7
- package/bin/impl/utils/spinner.d.ts +0 -245
- package/bin/impl/utils/spinner.js +0 -370
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { SimpleSpinner } from "@reliverse/rempts";
|
|
2
2
|
import type { SupportedDatabases, SupportedPlugin } from "../impl/init";
|
|
3
3
|
type Format = (code: string) => Promise<string>;
|
|
4
4
|
interface CommonIndexConfig_Regex<AdditionalFields> {
|
|
@@ -21,7 +21,7 @@ export type CommonIndexConfig<AdditionalFields> = CommonIndexConfig_Regex<Additi
|
|
|
21
21
|
export declare function generateAuthConfig({ format, current_user_config, spinner, plugins, database, }: {
|
|
22
22
|
format: Format;
|
|
23
23
|
current_user_config: string;
|
|
24
|
-
spinner:
|
|
24
|
+
spinner: SimpleSpinner;
|
|
25
25
|
plugins: SupportedPlugin[];
|
|
26
26
|
database: SupportedDatabases | null;
|
|
27
27
|
}): Promise<{
|
|
@@ -430,7 +430,7 @@ loginPage: "/sign-in",
|
|
|
430
430
|
total_envs.push(...envs);
|
|
431
431
|
total_dependencies.push(...dependencies);
|
|
432
432
|
} catch (error) {
|
|
433
|
-
spinner.
|
|
433
|
+
spinner.fail(`Something went wrong while generating/updating your new auth config file.`);
|
|
434
434
|
logger.error(error.message);
|
|
435
435
|
process.exit(1);
|
|
436
436
|
}
|
|
@@ -445,7 +445,7 @@ loginPage: "/sign-in",
|
|
|
445
445
|
total_dependencies.push(...dependencies);
|
|
446
446
|
total_envs.push(...envs);
|
|
447
447
|
} catch (error) {
|
|
448
|
-
spinner.
|
|
448
|
+
spinner.fail(`Something went wrong while generating/updating your new auth config file.`);
|
|
449
449
|
logger.error(error.message);
|
|
450
450
|
process.exit(1);
|
|
451
451
|
}
|
|
@@ -146,8 +146,8 @@ export declare const optionsSchema: z.ZodObject<{
|
|
|
146
146
|
cwd: z.ZodString;
|
|
147
147
|
config: z.ZodOptional<z.ZodString>;
|
|
148
148
|
database: z.ZodOptional<z.ZodEnum<{
|
|
149
|
-
mysql: "mysql";
|
|
150
149
|
sqlite: "sqlite";
|
|
150
|
+
mysql: "mysql";
|
|
151
151
|
mongodb: "mongodb";
|
|
152
152
|
postgres: "postgres";
|
|
153
153
|
mssql: "mssql";
|
|
@@ -165,7 +165,7 @@ export declare const optionsSchema: z.ZodObject<{
|
|
|
165
165
|
}, z.core.$strip>;
|
|
166
166
|
export declare const outroText = "\uD83E\uDD73 All Done, Happy Hacking!";
|
|
167
167
|
export declare function getLatestNpmVersion(packageName: string): Promise<string>;
|
|
168
|
-
export declare function getPackageManager(): Promise<"bun" | "npm" | "
|
|
168
|
+
export declare function getPackageManager(): Promise<"bun" | "npm" | "pnpm" | "yarn">;
|
|
169
169
|
export declare function getEnvFiles(cwd: string): Promise<string[]>;
|
|
170
170
|
export declare function updateEnvs({ envs, files, isCommented, }: {
|
|
171
171
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { re } from "@reliverse/relico";
|
|
2
2
|
import { pathExists } from "@reliverse/relifso";
|
|
3
|
-
import { confirmPrompt,
|
|
3
|
+
import { confirmPrompt, createSpinner } from "@reliverse/rempts";
|
|
4
4
|
import { logger } from "better-auth";
|
|
5
5
|
import { getAdapter, getMigrations } from "better-auth/db";
|
|
6
6
|
import path from "path";
|
|
@@ -50,7 +50,7 @@ export async function migrateAction(opts) {
|
|
|
50
50
|
logger.error("Migrate command isn't supported for this adapter.");
|
|
51
51
|
process.exit(1);
|
|
52
52
|
}
|
|
53
|
-
const spinner =
|
|
53
|
+
const spinner = createSpinner({ text: "preparing migration..." }).start();
|
|
54
54
|
const { toBeAdded, toBeCreated, runMigrations } = await getMigrations(config);
|
|
55
55
|
if (!toBeAdded.length && !toBeCreated.length) {
|
|
56
56
|
spinner.stop();
|
|
@@ -81,9 +81,10 @@ export async function migrateAction(opts) {
|
|
|
81
81
|
logger.info("Migration cancelled.");
|
|
82
82
|
process.exit(0);
|
|
83
83
|
}
|
|
84
|
-
spinner?.start(
|
|
84
|
+
spinner?.start();
|
|
85
|
+
spinner.text = "migrating...";
|
|
85
86
|
await runMigrations();
|
|
86
|
-
spinner.
|
|
87
|
+
spinner.succeed("Migration completed!");
|
|
87
88
|
logger.info("\u{1F680} migration was completed successfully!");
|
|
88
89
|
process.exit(0);
|
|
89
90
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from "@reliverse/pathkit";
|
|
2
2
|
import { existsSync, mkdir } from "@reliverse/relifso";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
|
+
import { createMultiStepSpinner } from "@reliverse/rempts";
|
|
4
5
|
import {
|
|
5
6
|
buildForTarget,
|
|
6
7
|
cleanOutputDir,
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
parseTargets,
|
|
10
11
|
validateInputFile
|
|
11
12
|
} from "./providers/bun/single-file.js";
|
|
12
|
-
import { createMultiStepSpinner } from "../utils/spinner.js";
|
|
13
13
|
function getTargetPrefix(inputFile) {
|
|
14
14
|
const filename = inputFile.split("/").pop()?.split("\\").pop() || "";
|
|
15
15
|
const nameWithoutExt = filename.replace(/\.[^/.]+$/, "");
|
package/bin/impl/build/impl.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import fs from "@reliverse/relifso";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
|
+
import { createMultiStepSpinner } from "@reliverse/rempts";
|
|
4
5
|
import { binary_buildFlow } from "./binary-flow.js";
|
|
5
6
|
import { library_buildFlow } from "./library-flow.js";
|
|
6
7
|
import { regular_buildFlow } from "./regular-flow.js";
|
|
7
8
|
import { PROJECT_ROOT } from "../config/constants.js";
|
|
8
9
|
import { getConfigDler } from "../config/load.js";
|
|
9
|
-
import { createMultiStepSpinner } from "../utils/spinner.js";
|
|
10
10
|
import { removeDistFolders } from "../utils/utils-clean.js";
|
|
11
11
|
import { handleDlerError } from "../utils/utils-error-cwd.js";
|
|
12
12
|
import { dlerPostBuild, wrapper_CopyNonBuildFiles } from "./postbuild.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
|
+
import { createSpinnerGroup } from "@reliverse/rempts";
|
|
3
4
|
import pAll from "p-all";
|
|
4
5
|
import { library_buildLibrary } from "./build-library.js";
|
|
5
6
|
import { CONCURRENCY_DEFAULT, PROJECT_ROOT } from "../config/constants.js";
|
|
6
7
|
import { library_publishLibrary } from "../pub/pub-library.js";
|
|
7
|
-
import { createSpinnerGroup } from "../utils/spinner.js";
|
|
8
8
|
import { resumePerfTimer } from "../utils/utils-perf.js";
|
|
9
9
|
export async function library_buildFlow(timer, isDev, config) {
|
|
10
10
|
relinka("verbose", "\u2014 \u2014 \u2014 library_buildFlow \u2014 \u2014 \u2014");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
|
+
import { createSpinnerGroup } from "@reliverse/rempts";
|
|
2
3
|
import pAll from "p-all";
|
|
3
4
|
import { CONCURRENCY_DEFAULT } from "../config/constants.js";
|
|
4
|
-
import { createSpinnerGroup } from "../utils/spinner.js";
|
|
5
5
|
import { regular_pubToJsr, regular_pubToNpm } from "../pub/pub-regular.js";
|
|
6
6
|
import { regular_buildJsrDist, regular_buildNpmDist } from "./build-regular.js";
|
|
7
7
|
export async function regular_buildFlow(timer, isDev, config) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const PROJECT_ROOT: string;
|
|
2
|
-
export declare const cliVersion = "1.7.
|
|
2
|
+
export declare const cliVersion = "1.7.127";
|
|
3
3
|
export declare const cliName = "@reliverse/rse";
|
|
4
4
|
export declare const rseName = "@reliverse/rse";
|
|
5
5
|
export declare const dlerName = "@reliverse/dler";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import path from "@reliverse/pathkit";
|
|
3
3
|
export const PROJECT_ROOT = path.resolve(process.cwd());
|
|
4
|
-
const version = "1.7.
|
|
4
|
+
const version = "1.7.127";
|
|
5
5
|
export const cliVersion = version;
|
|
6
6
|
export const cliName = "@reliverse/rse";
|
|
7
7
|
export const rseName = "@reliverse/rse";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setTimeout } from "node:timers";
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
|
-
import {
|
|
4
|
+
import { createSpinner } from "@reliverse/rempts";
|
|
5
5
|
import { listen } from "async-listen";
|
|
6
6
|
import http from "http";
|
|
7
7
|
import { customAlphabet } from "nanoid";
|
|
@@ -19,7 +19,7 @@ class UserCancellationError extends Error {
|
|
|
19
19
|
const nanoid = customAlphabet("123456789QAZWSXEDCRFVTGBYHNUJMIKOLP", 5);
|
|
20
20
|
export async function auth({ isDev, useLocalhost }) {
|
|
21
21
|
relinka("info", "Let's authenticate you...");
|
|
22
|
-
const spinner =
|
|
22
|
+
const spinner = createSpinner({
|
|
23
23
|
text: "Waiting for user confirmation..."
|
|
24
24
|
}).start();
|
|
25
25
|
try {
|
|
@@ -113,9 +113,7 @@ export async function auth({ isDev, useLocalhost }) {
|
|
|
113
113
|
confirmationUrl.toString()
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
-
spinner.
|
|
117
|
-
` Please visit it and confirm there if you see the same code: ${re.bold(code)}`
|
|
118
|
-
);
|
|
116
|
+
spinner.text = ` Please visit it and confirm there if you see the same code: ${re.bold(code)}`;
|
|
119
117
|
const authTimeout = setTimeout(
|
|
120
118
|
() => {
|
|
121
119
|
relinka("error", "Authentication timed out.");
|
|
@@ -141,13 +139,13 @@ export async function auth({ isDev, useLocalhost }) {
|
|
|
141
139
|
relinka("verbose", "Wrote auth data to memory. To view it, type:", `code ${memoryPath}`);
|
|
142
140
|
relinka("verbose", "Local server closed after successful authentication.");
|
|
143
141
|
});
|
|
144
|
-
spinner.
|
|
142
|
+
spinner.succeed("Authenticated!");
|
|
145
143
|
relinka("log", cliDomainDocs);
|
|
146
144
|
return;
|
|
147
145
|
} catch (error) {
|
|
148
146
|
clearTimeout(authTimeout);
|
|
149
147
|
if (error instanceof UserCancellationError) {
|
|
150
|
-
spinner.
|
|
148
|
+
spinner.text = "Login cancelled. See you next time \u{1F44B}";
|
|
151
149
|
server.close(() => {
|
|
152
150
|
relinka("verbose", "Local server closed due to user cancellation.");
|
|
153
151
|
process.exit(0);
|
|
@@ -156,12 +154,12 @@ export async function auth({ isDev, useLocalhost }) {
|
|
|
156
154
|
server.close(() => {
|
|
157
155
|
relinka("verbose", "Local server closed due to authentication failure.");
|
|
158
156
|
});
|
|
159
|
-
spinner.
|
|
157
|
+
spinner.fail("Authentication failed");
|
|
160
158
|
throw error;
|
|
161
159
|
}
|
|
162
160
|
}
|
|
163
161
|
} catch (error) {
|
|
164
|
-
spinner.
|
|
162
|
+
spinner.fail("Authentication failed");
|
|
165
163
|
relinka("error", "Authentication failed!");
|
|
166
164
|
throw error;
|
|
167
165
|
}
|
package/bin/impl/merge/mod.js
CHANGED
|
@@ -2,6 +2,7 @@ import path from "@reliverse/pathkit";
|
|
|
2
2
|
import { glob } from "@reliverse/reglob";
|
|
3
3
|
import fs from "@reliverse/relifso";
|
|
4
4
|
import { relinka } from "@reliverse/relinka";
|
|
5
|
+
import { withEnhancedSpinner } from "@reliverse/rempts";
|
|
5
6
|
import MagicString, { Bundle } from "magic-string";
|
|
6
7
|
import pMap from "p-map";
|
|
7
8
|
import { isBinaryExt } from "../utils/binary.js";
|
|
@@ -16,7 +17,6 @@ import {
|
|
|
16
17
|
validateMergeOperation,
|
|
17
18
|
validatePath
|
|
18
19
|
} from "../utils/utils-security.js";
|
|
19
|
-
import { withEnhancedSpinner } from "../utils/spinner.js";
|
|
20
20
|
export const DEFAULT_IGNORES = ["**/.git/**", "**/node_modules/**"];
|
|
21
21
|
export const DEFAULT_SEPARATOR_RAW = "\\n\\n";
|
|
22
22
|
export const normalizeGlobPattern = (pattern) => {
|
|
@@ -2,23 +2,24 @@ import path from "node:path";
|
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import fs from "@reliverse/relifso";
|
|
4
4
|
import { relinka } from "@reliverse/relinka";
|
|
5
|
-
import { cancel, inputPrompt, isCancel
|
|
5
|
+
import { cancel, createSpinner, inputPrompt, isCancel } from "@reliverse/rempts";
|
|
6
6
|
import { execa } from "execa";
|
|
7
7
|
import {
|
|
8
8
|
addEnvVariablesToFile
|
|
9
9
|
} from "../project-generation/env-setup.js";
|
|
10
10
|
import { commandExists } from "../../utils/command-exists.js";
|
|
11
11
|
async function checkAtlasCLI() {
|
|
12
|
-
const s =
|
|
12
|
+
const s = createSpinner({
|
|
13
13
|
text: "Checking for MongoDB Atlas CLI..."
|
|
14
14
|
});
|
|
15
15
|
s.start("Checking for MongoDB Atlas CLI...");
|
|
16
16
|
try {
|
|
17
17
|
const exists = await commandExists("atlas");
|
|
18
|
-
|
|
18
|
+
if (exists) s.succeed("MongoDB Atlas CLI found");
|
|
19
|
+
else s.fail(re.yellow("MongoDB Atlas CLI not found"));
|
|
19
20
|
return exists;
|
|
20
21
|
} catch (_error) {
|
|
21
|
-
s.
|
|
22
|
+
s.fail(re.red("Error checking MongoDB Atlas CLI"));
|
|
22
23
|
return false;
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -98,14 +99,14 @@ ${re.green("MongoDB Atlas Manual Setup Instructions:")}
|
|
|
98
99
|
}
|
|
99
100
|
export async function setupMongoDBAtlas(config) {
|
|
100
101
|
const { projectDir } = config;
|
|
101
|
-
const mainSpinner =
|
|
102
|
+
const mainSpinner = createSpinner({
|
|
102
103
|
text: "Setting up MongoDB Atlas..."
|
|
103
104
|
});
|
|
104
105
|
mainSpinner.start("Setting up MongoDB Atlas...");
|
|
105
106
|
const serverDir = path.join(projectDir, "apps/server");
|
|
106
107
|
try {
|
|
107
108
|
await fs.ensureDir(serverDir);
|
|
108
|
-
mainSpinner.
|
|
109
|
+
mainSpinner.succeed("MongoDB Atlas setup ready");
|
|
109
110
|
const config2 = await initMongoDBAtlas(serverDir);
|
|
110
111
|
if (config2) {
|
|
111
112
|
await writeEnvFile(projectDir, config2);
|
|
@@ -116,7 +117,7 @@ export async function setupMongoDBAtlas(config) {
|
|
|
116
117
|
displayManualSetupInstructions();
|
|
117
118
|
}
|
|
118
119
|
} catch (error) {
|
|
119
|
-
mainSpinner.
|
|
120
|
+
mainSpinner.fail(re.red("MongoDB Atlas setup failed"));
|
|
120
121
|
relinka(
|
|
121
122
|
"error",
|
|
122
123
|
re.red(
|
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import fs from "@reliverse/relifso";
|
|
4
4
|
import { relinka } from "@reliverse/relinka";
|
|
5
|
-
import { cancel, isCancel, select,
|
|
5
|
+
import { cancel, createSpinner, isCancel, select, text } from "@reliverse/rempts";
|
|
6
6
|
import { execa } from "execa";
|
|
7
7
|
import {
|
|
8
8
|
addEnvVariablesToFile
|
|
@@ -18,17 +18,18 @@ const NEON_REGIONS = [
|
|
|
18
18
|
{ label: "Azure East US 2 region (Virginia)", value: "azure-eastus2" }
|
|
19
19
|
];
|
|
20
20
|
async function executeNeonCommand(packageManager, commandArgsString, spinnerText) {
|
|
21
|
-
const s =
|
|
21
|
+
const s = createSpinner({
|
|
22
22
|
text: spinnerText ?? `Running ${packageManager} command...`
|
|
23
23
|
});
|
|
24
24
|
try {
|
|
25
25
|
const fullCommand = getPackageExecutionCommand(packageManager, commandArgsString);
|
|
26
26
|
if (spinnerText) s.start(spinnerText);
|
|
27
27
|
const result = await execa(fullCommand, { shell: true });
|
|
28
|
-
if (spinnerText)
|
|
28
|
+
if (spinnerText)
|
|
29
|
+
s.succeed(re.green(spinnerText.replace("...", "").replace("ing ", "ed ").trim()));
|
|
29
30
|
return result;
|
|
30
31
|
} catch (error) {
|
|
31
|
-
if (s) s.
|
|
32
|
+
if (s) s.fail(re.red(`Failed: ${spinnerText || "Command execution"}`));
|
|
32
33
|
throw error;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -72,7 +73,7 @@ async function writeEnvFile(projectDir, config) {
|
|
|
72
73
|
}
|
|
73
74
|
async function setupWithNeonDb(projectDir, packageManager) {
|
|
74
75
|
try {
|
|
75
|
-
const s =
|
|
76
|
+
const s = createSpinner({
|
|
76
77
|
text: "Creating Neon database using neondb..."
|
|
77
78
|
});
|
|
78
79
|
s.start("Creating Neon database using neondb...");
|
|
@@ -83,7 +84,7 @@ async function setupWithNeonDb(projectDir, packageManager) {
|
|
|
83
84
|
shell: true,
|
|
84
85
|
cwd: serverDir
|
|
85
86
|
});
|
|
86
|
-
s.
|
|
87
|
+
s.succeed(re.green("Neon database created successfully!"));
|
|
87
88
|
return true;
|
|
88
89
|
} catch (error) {
|
|
89
90
|
relinka("error", re.red("Failed to create database with neondb"));
|
|
@@ -149,13 +150,13 @@ export async function setupNeonPostgres(config) {
|
|
|
149
150
|
if (!neonConfig) {
|
|
150
151
|
throw new Error("Failed to create project - couldn't get connection information");
|
|
151
152
|
}
|
|
152
|
-
const finalSpinner =
|
|
153
|
+
const finalSpinner = createSpinner({
|
|
153
154
|
text: "Configuring database connection"
|
|
154
155
|
});
|
|
155
156
|
finalSpinner.start("Configuring database connection");
|
|
156
157
|
await fs.ensureDir(path.join(projectDir, "apps/server"));
|
|
157
158
|
await writeEnvFile(projectDir, neonConfig);
|
|
158
|
-
finalSpinner.
|
|
159
|
+
finalSpinner.succeed("Neon database configured!");
|
|
159
160
|
}
|
|
160
161
|
} catch (error) {
|
|
161
162
|
if (error instanceof Error) {
|
package/bin/impl/providers/better-t-stack/helpers/database-providers/prisma-postgres-setup.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import fs from "@reliverse/relifso";
|
|
4
4
|
import { relinka } from "@reliverse/relinka";
|
|
5
|
-
import { cancel, isCancel, password
|
|
5
|
+
import { cancel, createSpinner, isCancel, password } from "@reliverse/rempts";
|
|
6
6
|
import { execa } from "execa";
|
|
7
7
|
import {
|
|
8
8
|
addEnvVariablesToFile
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
import { addPackageDependency } from "../../utils/add-package-deps.js";
|
|
11
11
|
import { getPackageExecutionCommand } from "../../utils/get-package-execution-command.js";
|
|
12
12
|
async function initPrismaDatabase(serverDir, packageManager) {
|
|
13
|
-
const s =
|
|
13
|
+
const s = createSpinner({
|
|
14
14
|
text: "Initializing Prisma PostgreSQL..."
|
|
15
15
|
});
|
|
16
16
|
try {
|
|
17
17
|
s.start("Initializing Prisma PostgreSQL...");
|
|
18
18
|
const prismaDir = path.join(serverDir, "prisma");
|
|
19
19
|
await fs.ensureDir(prismaDir);
|
|
20
|
-
s.
|
|
20
|
+
s.succeed("Prisma PostgreSQL initialized. Follow the prompts below:");
|
|
21
21
|
const prismaInitCommand = getPackageExecutionCommand(packageManager, "prisma init --db");
|
|
22
22
|
await execa(prismaInitCommand, {
|
|
23
23
|
cwd: serverDir,
|
|
@@ -47,7 +47,7 @@ async function initPrismaDatabase(serverDir, packageManager) {
|
|
|
47
47
|
databaseUrl
|
|
48
48
|
};
|
|
49
49
|
} catch (error) {
|
|
50
|
-
s.
|
|
50
|
+
s.fail(re.red("Prisma PostgreSQL initialization failed"));
|
|
51
51
|
if (error instanceof Error) {
|
|
52
52
|
relinka("error", error.message);
|
|
53
53
|
}
|
|
@@ -116,13 +116,13 @@ ${dbFileContent}`;
|
|
|
116
116
|
export async function setupPrismaPostgres(config) {
|
|
117
117
|
const { packageManager, projectDir } = config;
|
|
118
118
|
const serverDir = path.join(projectDir, "apps/server");
|
|
119
|
-
const s =
|
|
119
|
+
const s = createSpinner({
|
|
120
120
|
text: "Setting up Prisma PostgreSQL..."
|
|
121
121
|
});
|
|
122
122
|
s.start("Setting up Prisma PostgreSQL...");
|
|
123
123
|
try {
|
|
124
124
|
await fs.ensureDir(serverDir);
|
|
125
|
-
s.
|
|
125
|
+
s.succeed("Prisma PostgreSQL setup ready");
|
|
126
126
|
const config2 = await initPrismaDatabase(serverDir, packageManager);
|
|
127
127
|
if (config2) {
|
|
128
128
|
await writeEnvFile(projectDir, config2);
|
|
@@ -135,16 +135,16 @@ export async function setupPrismaPostgres(config) {
|
|
|
135
135
|
)
|
|
136
136
|
);
|
|
137
137
|
} else {
|
|
138
|
-
const fallbackSpinner =
|
|
138
|
+
const fallbackSpinner = createSpinner({
|
|
139
139
|
text: "Setting up fallback configuration..."
|
|
140
140
|
});
|
|
141
141
|
fallbackSpinner.start("Setting up fallback configuration...");
|
|
142
142
|
await writeEnvFile(projectDir);
|
|
143
|
-
fallbackSpinner.
|
|
143
|
+
fallbackSpinner.succeed("Fallback configuration ready");
|
|
144
144
|
displayManualSetupInstructions();
|
|
145
145
|
}
|
|
146
146
|
} catch (error) {
|
|
147
|
-
s.
|
|
147
|
+
s.fail(re.red("Prisma PostgreSQL setup failed"));
|
|
148
148
|
relinka(
|
|
149
149
|
"error",
|
|
150
150
|
re.red(
|
|
@@ -2,7 +2,7 @@ import os from "node:os";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { re } from "@reliverse/relico";
|
|
4
4
|
import { relinka } from "@reliverse/relinka";
|
|
5
|
-
import { cancel, confirm, isCancel, select,
|
|
5
|
+
import { cancel, confirm, createSpinner, isCancel, select, text } from "@reliverse/rempts";
|
|
6
6
|
import { $ } from "execa";
|
|
7
7
|
import {
|
|
8
8
|
addEnvVariablesToFile
|
|
@@ -20,20 +20,20 @@ async function isTursoLoggedIn() {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
async function loginToTurso() {
|
|
23
|
-
const s =
|
|
23
|
+
const s = createSpinner({
|
|
24
24
|
text: "Logging in to Turso..."
|
|
25
25
|
});
|
|
26
26
|
try {
|
|
27
27
|
s.start("Logging in to Turso...");
|
|
28
28
|
await $`turso auth login`;
|
|
29
|
-
s.
|
|
29
|
+
s.succeed("Logged into Turso");
|
|
30
30
|
return true;
|
|
31
31
|
} catch (_error) {
|
|
32
|
-
s.
|
|
32
|
+
s.fail(re.red("Failed to log in to Turso"));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
async function installTursoCLI(isMac) {
|
|
36
|
-
const s =
|
|
36
|
+
const s = createSpinner({
|
|
37
37
|
text: "Installing Turso CLI..."
|
|
38
38
|
});
|
|
39
39
|
try {
|
|
@@ -44,19 +44,19 @@ async function installTursoCLI(isMac) {
|
|
|
44
44
|
const { stdout: installScript } = await $`curl -sSfL https://get.tur.so/install.sh`;
|
|
45
45
|
await $`bash -c '${installScript}'`;
|
|
46
46
|
}
|
|
47
|
-
s.
|
|
47
|
+
s.succeed("Turso CLI installed");
|
|
48
48
|
return true;
|
|
49
49
|
} catch (error) {
|
|
50
50
|
if (error instanceof Error && error.message.includes("User force closed")) {
|
|
51
|
-
s.
|
|
51
|
+
s.succeed("Turso CLI installation cancelled");
|
|
52
52
|
relinka("warn", re.yellow("Turso CLI installation cancelled by user"));
|
|
53
53
|
throw new Error("Installation cancelled");
|
|
54
54
|
}
|
|
55
|
-
s.
|
|
55
|
+
s.fail(re.red("Failed to install Turso CLI"));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
async function getTursoGroups() {
|
|
59
|
-
const s =
|
|
59
|
+
const s = createSpinner({
|
|
60
60
|
text: "Fetching Turso groups..."
|
|
61
61
|
});
|
|
62
62
|
try {
|
|
@@ -64,7 +64,7 @@ async function getTursoGroups() {
|
|
|
64
64
|
const { stdout } = await $`turso group list`;
|
|
65
65
|
const lines = stdout.trim().split("\n");
|
|
66
66
|
if (lines.length <= 1) {
|
|
67
|
-
s.
|
|
67
|
+
s.succeed("No Turso groups found");
|
|
68
68
|
return [];
|
|
69
69
|
}
|
|
70
70
|
const groups = lines.slice(1).map((line) => {
|
|
@@ -72,10 +72,10 @@ async function getTursoGroups() {
|
|
|
72
72
|
if (!name || !locations || !version || !status) return null;
|
|
73
73
|
return { name, locations, version, status };
|
|
74
74
|
}).filter((group) => group !== null);
|
|
75
|
-
s.
|
|
75
|
+
s.succeed(`Found ${groups.length} Turso groups`);
|
|
76
76
|
return groups;
|
|
77
77
|
} catch (error) {
|
|
78
|
-
s.
|
|
78
|
+
s.fail(re.red("Error fetching Turso groups"));
|
|
79
79
|
console.error("Error fetching Turso groups:", error);
|
|
80
80
|
return [];
|
|
81
81
|
}
|
|
@@ -104,7 +104,7 @@ async function selectTursoGroup() {
|
|
|
104
104
|
return selectedGroup;
|
|
105
105
|
}
|
|
106
106
|
async function createTursoDatabase(dbName, groupName) {
|
|
107
|
-
const s =
|
|
107
|
+
const s = createSpinner({
|
|
108
108
|
text: "Creating Turso database..."
|
|
109
109
|
});
|
|
110
110
|
try {
|
|
@@ -114,9 +114,9 @@ async function createTursoDatabase(dbName, groupName) {
|
|
|
114
114
|
} else {
|
|
115
115
|
await $`turso db create ${dbName}`;
|
|
116
116
|
}
|
|
117
|
-
s.
|
|
117
|
+
s.succeed(`Turso database "${dbName}" created`);
|
|
118
118
|
} catch (error) {
|
|
119
|
-
s.
|
|
119
|
+
s.fail(re.red(`Failed to create database "${dbName}"`));
|
|
120
120
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
121
121
|
throw new Error("DATABASE_EXISTS");
|
|
122
122
|
}
|
|
@@ -125,13 +125,13 @@ async function createTursoDatabase(dbName, groupName) {
|
|
|
125
125
|
try {
|
|
126
126
|
const { stdout: dbUrl } = await $`turso db show ${dbName} --url`;
|
|
127
127
|
const { stdout: authToken } = await $`turso db tokens create ${dbName}`;
|
|
128
|
-
s.
|
|
128
|
+
s.succeed("Database connection details retrieved");
|
|
129
129
|
return {
|
|
130
130
|
dbUrl: dbUrl.trim(),
|
|
131
131
|
authToken: authToken.trim()
|
|
132
132
|
};
|
|
133
133
|
} catch (_error) {
|
|
134
|
-
s.
|
|
134
|
+
s.fail(re.red("Failed to retrieve database connection details"));
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
async function writeEnvFile(projectDir, config) {
|
|
@@ -164,7 +164,7 @@ DATABASE_AUTH_TOKEN=your_auth_token`
|
|
|
164
164
|
}
|
|
165
165
|
export async function setupTurso(config) {
|
|
166
166
|
const { projectDir } = config;
|
|
167
|
-
const setupSpinner =
|
|
167
|
+
const setupSpinner = createSpinner({
|
|
168
168
|
text: "Checking Turso CLI availability..."
|
|
169
169
|
});
|
|
170
170
|
setupSpinner.start("Checking Turso CLI availability...");
|
|
@@ -173,13 +173,13 @@ export async function setupTurso(config) {
|
|
|
173
173
|
const isMac = platform === "darwin";
|
|
174
174
|
const isWindows = platform === "win32";
|
|
175
175
|
if (isWindows) {
|
|
176
|
-
setupSpinner.
|
|
176
|
+
setupSpinner.succeed(re.yellow("Turso setup not supported on Windows"));
|
|
177
177
|
relinka("warn", re.yellow("Automatic Turso setup is not supported on Windows."));
|
|
178
178
|
await writeEnvFile(projectDir);
|
|
179
179
|
displayManualSetupInstructions();
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
-
setupSpinner.
|
|
182
|
+
setupSpinner.succeed("Turso CLI availability checked");
|
|
183
183
|
const isCliInstalled = await isTursoInstalled();
|
|
184
184
|
if (!isCliInstalled) {
|
|
185
185
|
const shouldInstall = await confirm({
|
|
@@ -238,7 +238,7 @@ export async function setupTurso(config) {
|
|
|
238
238
|
}
|
|
239
239
|
relinka("success", "Turso database setup completed successfully!");
|
|
240
240
|
} catch (error) {
|
|
241
|
-
setupSpinner.
|
|
241
|
+
setupSpinner.fail(re.red("Turso CLI availability check failed"));
|
|
242
242
|
relinka(
|
|
243
243
|
"error",
|
|
244
244
|
re.red(`Error during Turso setup: ${error instanceof Error ? error.message : String(error)}`)
|
package/bin/impl/providers/better-t-stack/helpers/project-generation/install-dependencies.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { re } from "@reliverse/relico";
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
|
-
import {
|
|
3
|
+
import { createSpinner } from "@reliverse/rempts";
|
|
4
4
|
import { $ } from "execa";
|
|
5
5
|
export async function installDependencies({
|
|
6
6
|
projectDir,
|
|
7
7
|
packageManager
|
|
8
8
|
}) {
|
|
9
|
-
const s =
|
|
9
|
+
const s = createSpinner({
|
|
10
10
|
text: `Running ${packageManager} install...`
|
|
11
11
|
});
|
|
12
12
|
try {
|
|
@@ -15,9 +15,9 @@ export async function installDependencies({
|
|
|
15
15
|
cwd: projectDir,
|
|
16
16
|
stderr: "inherit"
|
|
17
17
|
})`${packageManager} install`;
|
|
18
|
-
s.
|
|
18
|
+
s.succeed("Dependencies installed successfully");
|
|
19
19
|
} catch (error) {
|
|
20
|
-
s.
|
|
20
|
+
s.fail(re.red("Failed to install dependencies"));
|
|
21
21
|
if (error instanceof Error) {
|
|
22
22
|
relinka("error", re.red(`Installation error: ${error.message}`));
|
|
23
23
|
}
|
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import fs from "@reliverse/relifso";
|
|
4
4
|
import { relinka } from "@reliverse/relinka";
|
|
5
|
-
import {
|
|
5
|
+
import { createSpinner } from "@reliverse/rempts";
|
|
6
6
|
import { setupMongoDBAtlas } from "../database-providers/mongodb-atlas-setup.js";
|
|
7
7
|
import { setupNeonPostgres } from "../database-providers/neon-setup.js";
|
|
8
8
|
import { setupPrismaPostgres } from "../database-providers/prisma-postgres-setup.js";
|
|
@@ -21,7 +21,7 @@ export async function setupDatabase(config) {
|
|
|
21
21
|
}
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
const s =
|
|
24
|
+
const s = createSpinner({
|
|
25
25
|
text: "Setting up database..."
|
|
26
26
|
});
|
|
27
27
|
const serverDir = path.join(projectDir, "apps/server");
|
|
@@ -76,7 +76,7 @@ export async function setupDatabase(config) {
|
|
|
76
76
|
await setupMongoDBAtlas(config);
|
|
77
77
|
}
|
|
78
78
|
} catch (error) {
|
|
79
|
-
s.
|
|
79
|
+
s.fail(re.red("Failed to set up database"));
|
|
80
80
|
if (error instanceof Error) {
|
|
81
81
|
relinka("error", re.red(error.message));
|
|
82
82
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { re } from "@reliverse/relico";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
|
-
import {
|
|
4
|
+
import { createSpinner } from "@reliverse/rempts";
|
|
5
5
|
import { execa } from "execa";
|
|
6
6
|
import { getPackageExecutionCommand } from "../../utils/get-package-execution-command.js";
|
|
7
7
|
export async function setupStarlight(config) {
|
|
8
8
|
const { packageManager, projectDir } = config;
|
|
9
|
-
const s =
|
|
9
|
+
const s = createSpinner({
|
|
10
10
|
text: "Setting up Starlight docs..."
|
|
11
11
|
});
|
|
12
12
|
try {
|
|
@@ -31,9 +31,9 @@ export async function setupStarlight(config) {
|
|
|
31
31
|
},
|
|
32
32
|
shell: true
|
|
33
33
|
});
|
|
34
|
-
s.
|
|
34
|
+
s.succeed("Starlight docs setup successfully!");
|
|
35
35
|
} catch (error) {
|
|
36
|
-
s.
|
|
36
|
+
s.fail(re.red("Failed to set up Starlight docs"));
|
|
37
37
|
if (error instanceof Error) {
|
|
38
38
|
relinka("error", error.message);
|
|
39
39
|
}
|