appwrite-utils-cli 0.9.61 → 0.9.63

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.
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import fs from "fs";
3
3
  import {} from "appwrite-utils";
4
4
  import { register } from "tsx/esm/api"; // Import the register function
5
- import { fileURLToPath } from "node:url";
5
+ import { pathToFileURL } from "node:url";
6
6
  /**
7
7
  * Recursively searches for a file named 'appwriteConfig.ts' starting from the given directory.
8
8
  * @param dir The directory to start the search from.
@@ -35,13 +35,15 @@ export const loadConfig = async (configDir) => {
35
35
  try {
36
36
  const configPath = path.join(configDir, "appwriteConfig.ts");
37
37
  console.log(`Loading config from: ${configPath}`);
38
- const config = (await import(configPath)).default;
38
+ const configUrl = pathToFileURL(configPath).href;
39
+ const config = (await import(configUrl)).default;
39
40
  const collectionsDir = path.join(configDir, "collections");
40
41
  const collectionFiles = fs.readdirSync(collectionsDir);
41
42
  config.collections = [];
42
43
  for (const file of collectionFiles) {
43
44
  const filePath = path.join(collectionsDir, file);
44
- const collectionModule = (await import(filePath)).default;
45
+ const fileUrl = pathToFileURL(filePath).href;
46
+ const collectionModule = (await import(fileUrl)).default;
45
47
  config.collections.push(collectionModule);
46
48
  }
47
49
  return config;
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": "0.9.61",
4
+ "version": "0.9.63",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import fs from "fs";
3
3
  import { type AppwriteConfig, type Collection } from "appwrite-utils";
4
4
  import { register } from "tsx/esm/api"; // Import the register function
5
- import { fileURLToPath } from "node:url";
5
+ import { pathToFileURL } from "node:url";
6
6
 
7
7
  /**
8
8
  * Recursively searches for a file named 'appwriteConfig.ts' starting from the given directory.
@@ -40,7 +40,8 @@ export const loadConfig = async (
40
40
  try {
41
41
  const configPath = path.join(configDir, "appwriteConfig.ts");
42
42
  console.log(`Loading config from: ${configPath}`);
43
- const config = (await import(configPath)).default as AppwriteConfig;
43
+ const configUrl = pathToFileURL(configPath).href;
44
+ const config = (await import(configUrl)).default as AppwriteConfig;
44
45
 
45
46
  const collectionsDir = path.join(configDir, "collections");
46
47
  const collectionFiles = fs.readdirSync(collectionsDir);
@@ -49,7 +50,8 @@ export const loadConfig = async (
49
50
 
50
51
  for (const file of collectionFiles) {
51
52
  const filePath = path.join(collectionsDir, file);
52
- const collectionModule = (await import(filePath)).default as Collection;
53
+ const fileUrl = pathToFileURL(filePath).href;
54
+ const collectionModule = (await import(fileUrl)).default as Collection;
53
55
  config.collections.push(collectionModule);
54
56
  }
55
57