appwrite-utils-cli 1.0.3 → 1.0.5
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/README.md +2 -0
- package/dist/config/yamlConfig.js +10 -1
- package/dist/interactiveCLI.js +1 -0
- package/dist/utils/configMigration.js +1 -1
- package/dist/utils/loadConfigs.js +1 -1
- package/package.json +1 -1
- package/src/config/yamlConfig.ts +10 -1
- package/src/interactiveCLI.ts +1 -0
- package/src/utils/configMigration.ts +1 -1
- package/src/utils/loadConfigs.ts +1 -1
package/README.md
CHANGED
@@ -377,6 +377,8 @@ This updated CLI ensures that developers have robust tools at their fingertips t
|
|
377
377
|
|
378
378
|
### Changelog
|
379
379
|
|
380
|
+
- 1.0.5: Fixed `.` directories being ignored. Normally a good thing
|
381
|
+
- 1.0.4: Fixed `appwriteConfig.yaml` being the name for the converted config, instead of `config.yaml`
|
380
382
|
- 1.0.3: Fixed appwriteConfig detection for `--it` so it detects when you can migrate your config
|
381
383
|
- 1.0.2: Fixed migrations, sorry about that!
|
382
384
|
|
@@ -243,13 +243,17 @@ export const findYamlConfig = (startDir) => {
|
|
243
243
|
path.join(startDir, "appwrite.yaml"),
|
244
244
|
path.join(startDir, "appwrite.yml"),
|
245
245
|
];
|
246
|
+
console.log(`DEBUG: Checking YAML paths in ${startDir}:`);
|
246
247
|
for (const configPath of possiblePaths) {
|
248
|
+
console.log(` - ${configPath}: ${fs.existsSync(configPath)}`);
|
247
249
|
if (fs.existsSync(configPath)) {
|
248
250
|
return configPath;
|
249
251
|
}
|
250
252
|
}
|
251
253
|
// Recursively search subdirectories for .appwrite folders
|
254
|
+
console.log(`DEBUG: Starting recursive search from ${startDir}`);
|
252
255
|
const yamlConfigInSubdirs = findYamlConfigRecursive(startDir);
|
256
|
+
console.log(`DEBUG: Recursive search result: ${yamlConfigInSubdirs}`);
|
253
257
|
if (yamlConfigInSubdirs) {
|
254
258
|
return yamlConfigInSubdirs;
|
255
259
|
}
|
@@ -307,23 +311,28 @@ const shouldIgnoreDirectory = (dirName) => {
|
|
307
311
|
return ignoredDirs.includes(dirName) ||
|
308
312
|
dirName.startsWith('.git') ||
|
309
313
|
dirName.startsWith('node_modules') ||
|
310
|
-
dirName.startsWith('.');
|
314
|
+
(dirName.startsWith('.') && dirName !== '.appwrite');
|
311
315
|
};
|
312
316
|
const findYamlConfigRecursive = (dir, depth = 0) => {
|
313
317
|
// Limit search depth to prevent infinite recursion
|
314
318
|
if (depth > 5) {
|
319
|
+
console.log(`DEBUG: Stopping search at depth ${depth} in ${dir}`);
|
315
320
|
return null;
|
316
321
|
}
|
317
322
|
if (shouldIgnoreDirectory(path.basename(dir))) {
|
323
|
+
console.log(`DEBUG: Ignoring directory ${dir}`);
|
318
324
|
return null;
|
319
325
|
}
|
320
326
|
try {
|
321
327
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
328
|
+
console.log(`DEBUG: Searching directory ${dir} at depth ${depth}, found ${entries.length} entries`);
|
322
329
|
for (const entry of entries) {
|
323
330
|
if (entry.isDirectory() && !shouldIgnoreDirectory(entry.name)) {
|
324
331
|
const fullPath = path.join(dir, entry.name);
|
332
|
+
console.log(`DEBUG: Checking subdirectory: ${fullPath}`);
|
325
333
|
// Check if this is an .appwrite directory
|
326
334
|
if (entry.name === ".appwrite") {
|
335
|
+
console.log(`DEBUG: Found .appwrite directory at ${fullPath}`);
|
327
336
|
const configPaths = [
|
328
337
|
path.join(fullPath, "appwriteConfig.yaml"),
|
329
338
|
path.join(fullPath, "appwriteConfig.yml"),
|
package/dist/interactiveCLI.js
CHANGED
@@ -1386,6 +1386,7 @@ export class InteractiveCLI {
|
|
1386
1386
|
try {
|
1387
1387
|
// Check for YAML config first
|
1388
1388
|
const yamlConfigPath = findYamlConfig(this.currentDir);
|
1389
|
+
console.log(`DEBUG: YAML config search from ${this.currentDir}, found: ${yamlConfigPath}`);
|
1389
1390
|
if (yamlConfigPath) {
|
1390
1391
|
this.isUsingTypeScriptConfig = false;
|
1391
1392
|
MessageFormatter.info("Using YAML configuration", { prefix: "Config" });
|
@@ -68,7 +68,7 @@ async function migrateConfigFile(configFilePath, workingDir) {
|
|
68
68
|
lineWidth: 120,
|
69
69
|
noRefs: true
|
70
70
|
});
|
71
|
-
await fs.writeFile(path.join(appwriteDir, '
|
71
|
+
await fs.writeFile(path.join(appwriteDir, 'config.yaml'), yamlContent);
|
72
72
|
// Copy all directories except collections and schemas (we handle collections separately, skip schemas entirely)
|
73
73
|
const entries = await fs.readdir(configDir, { withFileTypes: true });
|
74
74
|
for (const entry of entries) {
|
@@ -64,7 +64,7 @@ const shouldIgnoreDirectory = (dirName) => {
|
|
64
64
|
return ignoredDirs.includes(dirName) ||
|
65
65
|
dirName.startsWith('.git') ||
|
66
66
|
dirName.startsWith('node_modules') ||
|
67
|
-
dirName.startsWith('.');
|
67
|
+
(dirName.startsWith('.') && dirName !== '.appwrite');
|
68
68
|
};
|
69
69
|
const findAppwriteConfigTS = (dir, depth = 0) => {
|
70
70
|
// Limit search depth to prevent infinite recursion
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "appwrite-utils-cli",
|
3
3
|
"description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.5",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
package/src/config/yamlConfig.ts
CHANGED
@@ -256,14 +256,18 @@ export const findYamlConfig = (startDir: string): string | null => {
|
|
256
256
|
path.join(startDir, "appwrite.yml"),
|
257
257
|
];
|
258
258
|
|
259
|
+
console.log(`DEBUG: Checking YAML paths in ${startDir}:`);
|
259
260
|
for (const configPath of possiblePaths) {
|
261
|
+
console.log(` - ${configPath}: ${fs.existsSync(configPath)}`);
|
260
262
|
if (fs.existsSync(configPath)) {
|
261
263
|
return configPath;
|
262
264
|
}
|
263
265
|
}
|
264
266
|
|
265
267
|
// Recursively search subdirectories for .appwrite folders
|
268
|
+
console.log(`DEBUG: Starting recursive search from ${startDir}`);
|
266
269
|
const yamlConfigInSubdirs = findYamlConfigRecursive(startDir);
|
270
|
+
console.log(`DEBUG: Recursive search result: ${yamlConfigInSubdirs}`);
|
267
271
|
if (yamlConfigInSubdirs) {
|
268
272
|
return yamlConfigInSubdirs;
|
269
273
|
}
|
@@ -326,28 +330,33 @@ const shouldIgnoreDirectory = (dirName: string): boolean => {
|
|
326
330
|
return ignoredDirs.includes(dirName) ||
|
327
331
|
dirName.startsWith('.git') ||
|
328
332
|
dirName.startsWith('node_modules') ||
|
329
|
-
dirName.startsWith('.');
|
333
|
+
(dirName.startsWith('.') && dirName !== '.appwrite');
|
330
334
|
};
|
331
335
|
|
332
336
|
const findYamlConfigRecursive = (dir: string, depth: number = 0): string | null => {
|
333
337
|
// Limit search depth to prevent infinite recursion
|
334
338
|
if (depth > 5) {
|
339
|
+
console.log(`DEBUG: Stopping search at depth ${depth} in ${dir}`);
|
335
340
|
return null;
|
336
341
|
}
|
337
342
|
|
338
343
|
if (shouldIgnoreDirectory(path.basename(dir))) {
|
344
|
+
console.log(`DEBUG: Ignoring directory ${dir}`);
|
339
345
|
return null;
|
340
346
|
}
|
341
347
|
|
342
348
|
try {
|
343
349
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
350
|
+
console.log(`DEBUG: Searching directory ${dir} at depth ${depth}, found ${entries.length} entries`);
|
344
351
|
|
345
352
|
for (const entry of entries) {
|
346
353
|
if (entry.isDirectory() && !shouldIgnoreDirectory(entry.name)) {
|
347
354
|
const fullPath = path.join(dir, entry.name);
|
355
|
+
console.log(`DEBUG: Checking subdirectory: ${fullPath}`);
|
348
356
|
|
349
357
|
// Check if this is an .appwrite directory
|
350
358
|
if (entry.name === ".appwrite") {
|
359
|
+
console.log(`DEBUG: Found .appwrite directory at ${fullPath}`);
|
351
360
|
const configPaths = [
|
352
361
|
path.join(fullPath, "appwriteConfig.yaml"),
|
353
362
|
path.join(fullPath, "appwriteConfig.yml"),
|
package/src/interactiveCLI.ts
CHANGED
@@ -1906,6 +1906,7 @@ export class InteractiveCLI {
|
|
1906
1906
|
try {
|
1907
1907
|
// Check for YAML config first
|
1908
1908
|
const yamlConfigPath = findYamlConfig(this.currentDir);
|
1909
|
+
console.log(`DEBUG: YAML config search from ${this.currentDir}, found: ${yamlConfigPath}`);
|
1909
1910
|
if (yamlConfigPath) {
|
1910
1911
|
this.isUsingTypeScriptConfig = false;
|
1911
1912
|
MessageFormatter.info("Using YAML configuration", { prefix: "Config" });
|
@@ -135,7 +135,7 @@ async function migrateConfigFile(configFilePath: string, workingDir: string): Pr
|
|
135
135
|
lineWidth: 120,
|
136
136
|
noRefs: true
|
137
137
|
});
|
138
|
-
await fs.writeFile(path.join(appwriteDir, '
|
138
|
+
await fs.writeFile(path.join(appwriteDir, 'config.yaml'), yamlContent);
|
139
139
|
|
140
140
|
// Copy all directories except collections and schemas (we handle collections separately, skip schemas entirely)
|
141
141
|
const entries = await fs.readdir(configDir, { withFileTypes: true });
|
package/src/utils/loadConfigs.ts
CHANGED
@@ -69,7 +69,7 @@ const shouldIgnoreDirectory = (dirName: string): boolean => {
|
|
69
69
|
return ignoredDirs.includes(dirName) ||
|
70
70
|
dirName.startsWith('.git') ||
|
71
71
|
dirName.startsWith('node_modules') ||
|
72
|
-
dirName.startsWith('.');
|
72
|
+
(dirName.startsWith('.') && dirName !== '.appwrite');
|
73
73
|
};
|
74
74
|
|
75
75
|
const findAppwriteConfigTS = (dir: string, depth: number = 0): string | null => {
|