aem-ext-daemon 0.3.1 → 0.3.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.
@@ -13,6 +13,8 @@ export declare function browse(dirPath: string, showHidden?: boolean): string;
13
13
  export declare function roots(): string;
14
14
  /** Read a file and return its content. */
15
15
  export declare function readFile(filePath: string): string;
16
+ /** Create a directory (and parents) if it doesn't exist. */
17
+ export declare function mkdir(dirPath: string): string;
16
18
  /** Write content to a file. Creates parent directories if needed. */
17
19
  export declare function writeFile(filePath: string, content: string): string;
18
20
  /** Recursive directory listing up to a max depth. */
@@ -53,6 +53,11 @@ export function readFile(filePath) {
53
53
  }
54
54
  return fs.readFileSync(filePath, "utf-8");
55
55
  }
56
+ /** Create a directory (and parents) if it doesn't exist. */
57
+ export function mkdir(dirPath) {
58
+ fs.mkdirSync(dirPath, { recursive: true });
59
+ return JSON.stringify({ created: true, path: dirPath });
60
+ }
56
61
  /** Write content to a file. Creates parent directories if needed. */
57
62
  export function writeFile(filePath, content) {
58
63
  const dir = path.dirname(filePath);
@@ -41,6 +41,12 @@ export async function dispatch(command, payload, connection) {
41
41
  : getWorkspaceRoot();
42
42
  return fsCap.browse(target, payload.showHidden);
43
43
  }
44
+ case "fs:mkdir": {
45
+ const dirPath = payload.path;
46
+ if (!dirPath || !path.isAbsolute(dirPath))
47
+ throw new Error("Absolute path is required");
48
+ return fsCap.mkdir(dirPath);
49
+ }
44
50
  case "fs:read": {
45
51
  const filePath = validatePath(payload.path);
46
52
  return fsCap.readFile(filePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aem-ext-daemon",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Local daemon for AEM Extension Builder — connects your machine to the cloud UI",
5
5
  "type": "module",
6
6
  "bin": {