@panoptic-it-solutions/coolify-setup 1.1.0 → 1.1.1
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/generator.js +11 -3
- package/package.json +1 -1
package/dist/generator.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
2
2
|
import { join, dirname } from 'path';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
3
4
|
import { generateDockerfile, generateDockerCompose, generateDockerComposeBuild, generateWorkflow, generateEntrypoint, generateMigrateScript, generateClaudeRules, } from './templates/index.js';
|
|
4
5
|
function ensureDir(filePath) {
|
|
5
6
|
const dir = dirname(filePath);
|
|
@@ -12,7 +13,7 @@ function writeFile(relativePath, content) {
|
|
|
12
13
|
ensureDir(fullPath);
|
|
13
14
|
writeFileSync(fullPath, content, 'utf-8');
|
|
14
15
|
}
|
|
15
|
-
function addEsbuildToPackageJson() {
|
|
16
|
+
function addEsbuildToPackageJson(packageManager) {
|
|
16
17
|
const packageJsonPath = join(process.cwd(), 'package.json');
|
|
17
18
|
if (!existsSync(packageJsonPath)) {
|
|
18
19
|
console.log('Warning: package.json not found, skipping esbuild addition');
|
|
@@ -28,6 +29,14 @@ function addEsbuildToPackageJson() {
|
|
|
28
29
|
if (!packageJson.devDependencies.esbuild) {
|
|
29
30
|
packageJson.devDependencies.esbuild = '^0.25.0';
|
|
30
31
|
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
|
|
32
|
+
// Update the lockfile so Docker build works with frozen-lockfile
|
|
33
|
+
const installCmd = packageManager === 'pnpm'
|
|
34
|
+
? 'pnpm install'
|
|
35
|
+
: packageManager === 'yarn'
|
|
36
|
+
? 'yarn install'
|
|
37
|
+
: 'npm install';
|
|
38
|
+
console.log(`Running ${installCmd} to update lockfile...`);
|
|
39
|
+
execSync(installCmd, { stdio: 'inherit', cwd: process.cwd() });
|
|
31
40
|
return true;
|
|
32
41
|
}
|
|
33
42
|
return false;
|
|
@@ -103,10 +112,9 @@ export async function generateFiles(options) {
|
|
|
103
112
|
const migrateScript = generateMigrateScript({ projectType });
|
|
104
113
|
// For Next.js standalone projects, we need esbuild to bundle the migration script
|
|
105
114
|
if (projectType === 'nextjs') {
|
|
106
|
-
const added = addEsbuildToPackageJson();
|
|
115
|
+
const added = addEsbuildToPackageJson(packageManager);
|
|
107
116
|
if (added) {
|
|
108
117
|
console.log('Added esbuild to devDependencies (required for migration bundling)');
|
|
109
|
-
console.log('Run your package manager install command to install it');
|
|
110
118
|
}
|
|
111
119
|
// Write migrate.ts to lib/db/ for Next.js projects (will be bundled at build time)
|
|
112
120
|
const migratePath = 'lib/db/migrate.ts';
|