@panoptic-it-solutions/coolify-setup 1.1.10 → 1.1.12

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 CHANGED
@@ -56,7 +56,7 @@ function moveMigrationsToLibDb() {
56
56
  schemaTs: false,
57
57
  };
58
58
  const cwd = process.cwd();
59
- // Items to move from db/ to lib/db/
59
+ // Items to move to lib/db/
60
60
  const itemsToMove = [
61
61
  { name: 'migrations', resultKey: 'migrations', isDir: true },
62
62
  { name: 'helpers', resultKey: 'helpers', isDir: true },
@@ -64,36 +64,48 @@ function moveMigrationsToLibDb() {
64
64
  { name: 'queries.ts', resultKey: 'queriesTs', isDir: false },
65
65
  { name: 'schema.ts', resultKey: 'schemaTs', isDir: false },
66
66
  ];
67
+ // Source directories to check (in order of priority)
68
+ const sourceRoots = ['db', 'src/db'];
67
69
  for (const item of itemsToMove) {
68
- const sourcePath = join(cwd, 'db', item.name);
69
70
  const destPath = join(cwd, 'lib/db', item.name);
70
- if (existsSync(sourcePath) && !existsSync(destPath)) {
71
- // Ensure lib/db directory exists
72
- if (item.isDir) {
73
- ensureDir(join(destPath, 'dummy'));
74
- }
75
- else {
76
- ensureDir(destPath);
71
+ // Skip if destination already exists
72
+ if (existsSync(destPath)) {
73
+ continue;
74
+ }
75
+ // Try each source root
76
+ for (const sourceRoot of sourceRoots) {
77
+ const sourcePath = join(cwd, sourceRoot, item.name);
78
+ if (existsSync(sourcePath)) {
79
+ // Ensure lib/db directory exists
80
+ if (item.isDir) {
81
+ ensureDir(join(destPath, 'dummy'));
82
+ }
83
+ else {
84
+ ensureDir(destPath);
85
+ }
86
+ // Move the item
87
+ renameSync(sourcePath, destPath);
88
+ result[item.resultKey] = true;
89
+ console.log(`Moved ${sourceRoot}/${item.name} → lib/db/${item.name}`);
90
+ break; // Found and moved, no need to check other source roots
77
91
  }
78
- // Move the item
79
- renameSync(sourcePath, destPath);
80
- result[item.resultKey] = true;
81
- console.log(`Moved db/${item.name} → lib/db/${item.name}`);
82
92
  }
83
93
  }
84
- // Clean up empty db directory if it exists and is empty
85
- const dbPath = join(cwd, 'db');
86
- if (existsSync(dbPath)) {
87
- try {
88
- const contents = readdirSync(dbPath);
89
- if (contents.length === 0) {
90
- // Remove empty directory
91
- execSync(`rmdir "${dbPath}"`, { stdio: 'pipe' });
92
- console.log('Removed empty db/ directory');
94
+ // Clean up empty db directories
95
+ for (const sourceRoot of sourceRoots) {
96
+ const dbPath = join(cwd, sourceRoot);
97
+ if (existsSync(dbPath)) {
98
+ try {
99
+ const contents = readdirSync(dbPath);
100
+ if (contents.length === 0) {
101
+ // Remove empty directory
102
+ execSync(`rmdir "${dbPath}"`, { stdio: 'pipe' });
103
+ console.log(`Removed empty ${sourceRoot}/ directory`);
104
+ }
105
+ }
106
+ catch {
107
+ // Ignore errors when cleaning up
93
108
  }
94
- }
95
- catch {
96
- // Ignore errors when cleaning up
97
109
  }
98
110
  }
99
111
  return result;
package/dist/git.js CHANGED
@@ -44,10 +44,10 @@ export async function commitAndPushToDevelop(files) {
44
44
  if (!isGitRepo()) {
45
45
  run('git init');
46
46
  }
47
- // Stage all specified files
47
+ // Stage all specified files (use -A to also stage deletions)
48
48
  for (const file of files) {
49
49
  try {
50
- run(`git add "${file}"`);
50
+ run(`git add -A "${file}"`);
51
51
  }
52
52
  catch {
53
53
  // File might not exist, that's ok
package/dist/index.js CHANGED
@@ -85,11 +85,15 @@ async function main() {
85
85
  else {
86
86
  generatedFiles.push('package-lock.json');
87
87
  }
88
- // Add migrate script if postgres included
88
+ // Add migrate script and db folder if postgres included
89
89
  if (response.includePostgres) {
90
90
  if (project.type === 'nextjs') {
91
91
  generatedFiles.push('lib/db/migrate.ts');
92
+ generatedFiles.push('lib/db/'); // Include all moved db files (migrations, helpers, schema, queries)
92
93
  generatedFiles.push('tsconfig.json'); // May be modified with exclude
94
+ // Stage deletions of source db folder if files were moved
95
+ generatedFiles.push('db/');
96
+ generatedFiles.push('src/db/');
93
97
  }
94
98
  else {
95
99
  generatedFiles.push('scripts/migrate.ts');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",