@panoptic-it-solutions/coolify-setup 1.1.0 → 1.1.2

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 (2) hide show
  1. package/dist/generator.js +18 -3
  2. 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,21 @@ 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() });
40
+ // Remind user to commit the lockfile
41
+ const lockfileName = packageManager === 'pnpm'
42
+ ? 'pnpm-lock.yaml'
43
+ : packageManager === 'yarn'
44
+ ? 'yarn.lock'
45
+ : 'package-lock.json';
46
+ console.log(`\n⚠️ IMPORTANT: Commit ${lockfileName} before pushing to avoid CI build failures!\n`);
31
47
  return true;
32
48
  }
33
49
  return false;
@@ -103,10 +119,9 @@ export async function generateFiles(options) {
103
119
  const migrateScript = generateMigrateScript({ projectType });
104
120
  // For Next.js standalone projects, we need esbuild to bundle the migration script
105
121
  if (projectType === 'nextjs') {
106
- const added = addEsbuildToPackageJson();
122
+ const added = addEsbuildToPackageJson(packageManager);
107
123
  if (added) {
108
124
  console.log('Added esbuild to devDependencies (required for migration bundling)');
109
- console.log('Run your package manager install command to install it');
110
125
  }
111
126
  // Write migrate.ts to lib/db/ for Next.js projects (will be bundled at build time)
112
127
  const migratePath = 'lib/db/migrate.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",