@stacksjs/buddy 0.70.93 → 0.70.95
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/commands/setup.d.ts +8 -0
- package/dist/commands/setup.js +10 -7
- package/package.json +1 -1
package/dist/commands/setup.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare function setup(buddy: CLI): void;
|
|
|
3
3
|
export declare function ensurePantryInstalled(): Promise<void>;
|
|
4
4
|
export declare function ensurePantryDependencies(cwd: string): Promise<void>;
|
|
5
5
|
export declare function ensureAppKey(cwd: string): Promise<void>;
|
|
6
|
+
export declare function pantryDatabasePackage(connection: string): DatabasePackage | undefined;
|
|
6
7
|
/**
|
|
7
8
|
* Reads config/deps.ts dependencies and merges in environment-detected
|
|
8
9
|
* dependencies (e.g. DB_CONNECTION), then writes deps.yaml so pantry install
|
|
@@ -10,3 +11,10 @@ export declare function ensureAppKey(cwd: string): Promise<void>;
|
|
|
10
11
|
*/
|
|
11
12
|
export declare function optimizePantryDeps(): Promise<void>;
|
|
12
13
|
export declare function ensureEnvIsSet(options: CliOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Maps DB_CONNECTION values to pantry package domains
|
|
16
|
+
*/
|
|
17
|
+
declare interface DatabasePackage {
|
|
18
|
+
name: string
|
|
19
|
+
version: string
|
|
20
|
+
}
|
package/dist/commands/setup.js
CHANGED
|
@@ -146,10 +146,13 @@ async function initializeProject(options) {
|
|
|
146
146
|
log.info("Happy coding! \uD83D\uDC99");
|
|
147
147
|
}
|
|
148
148
|
const DB_CONNECTION_PACKAGES = {
|
|
149
|
-
postgres: "postgresql.org",
|
|
150
|
-
mysql: "mysql.com",
|
|
151
|
-
sqlite: "sqlite.org"
|
|
149
|
+
postgres: { name: "postgresql.org", version: "^17.10" },
|
|
150
|
+
mysql: { name: "mysql.com", version: "*" },
|
|
151
|
+
sqlite: { name: "sqlite.org", version: "^3.47.2" }
|
|
152
152
|
};
|
|
153
|
+
export function pantryDatabasePackage(connection) {
|
|
154
|
+
return DB_CONNECTION_PACKAGES[connection];
|
|
155
|
+
}
|
|
153
156
|
function detectDbPackage(cwd) {
|
|
154
157
|
const envPath = join(cwd, ".env"), envExamplePath = join(cwd, ".env.example"), filePath = existsSync(envPath) ? envPath : existsSync(envExamplePath) ? envExamplePath : void 0;
|
|
155
158
|
if (!filePath)
|
|
@@ -158,7 +161,7 @@ function detectDbPackage(cwd) {
|
|
|
158
161
|
if (!match)
|
|
159
162
|
return;
|
|
160
163
|
const value = match[1].trim().replace(/['"]/g, "");
|
|
161
|
-
return
|
|
164
|
+
return pantryDatabasePackage(value);
|
|
162
165
|
}
|
|
163
166
|
export async function optimizePantryDeps() {
|
|
164
167
|
const cwd = p.projectPath(), depsConfigPath = join(cwd, "config", "deps.ts");
|
|
@@ -177,9 +180,9 @@ export async function optimizePantryDeps() {
|
|
|
177
180
|
}
|
|
178
181
|
const dbPackage = detectDbPackage(cwd);
|
|
179
182
|
if (dbPackage) {
|
|
180
|
-
if (!Object.keys(configDeps).some((key) => key === dbPackage || key.startsWith(`${dbPackage}/`))) {
|
|
181
|
-
log.info(`Detected DB_CONNECTION requires ${dbPackage}, adding to dependencies`);
|
|
182
|
-
configDeps[dbPackage] =
|
|
183
|
+
if (!Object.keys(configDeps).some((key) => key === dbPackage.name || key.startsWith(`${dbPackage.name}/`))) {
|
|
184
|
+
log.info(`Detected DB_CONNECTION requires ${dbPackage.name}, adding to dependencies`);
|
|
185
|
+
configDeps[dbPackage.name] = dbPackage.version;
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
const lines = [
|