@memberjunction/installer 0.0.1 → 5.5.0
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/InstallerEngine.d.ts +182 -0
- package/dist/InstallerEngine.d.ts.map +1 -0
- package/dist/InstallerEngine.js +571 -0
- package/dist/InstallerEngine.js.map +1 -0
- package/dist/adapters/FileSystemAdapter.d.ts +197 -0
- package/dist/adapters/FileSystemAdapter.d.ts.map +1 -0
- package/dist/adapters/FileSystemAdapter.js +355 -0
- package/dist/adapters/FileSystemAdapter.js.map +1 -0
- package/dist/adapters/GitHubReleaseProvider.d.ts +197 -0
- package/dist/adapters/GitHubReleaseProvider.d.ts.map +1 -0
- package/dist/adapters/GitHubReleaseProvider.js +348 -0
- package/dist/adapters/GitHubReleaseProvider.js.map +1 -0
- package/dist/adapters/ProcessRunner.d.ts +174 -0
- package/dist/adapters/ProcessRunner.d.ts.map +1 -0
- package/dist/adapters/ProcessRunner.js +264 -0
- package/dist/adapters/ProcessRunner.js.map +1 -0
- package/dist/adapters/SqlServerAdapter.d.ts +78 -0
- package/dist/adapters/SqlServerAdapter.d.ts.map +1 -0
- package/dist/adapters/SqlServerAdapter.js +120 -0
- package/dist/adapters/SqlServerAdapter.js.map +1 -0
- package/dist/errors/InstallerError.d.ts +92 -0
- package/dist/errors/InstallerError.d.ts.map +1 -0
- package/dist/errors/InstallerError.js +66 -0
- package/dist/errors/InstallerError.js.map +1 -0
- package/dist/events/InstallerEvents.d.ts +255 -0
- package/dist/events/InstallerEvents.d.ts.map +1 -0
- package/dist/events/InstallerEvents.js +96 -0
- package/dist/events/InstallerEvents.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/models/Diagnostics.d.ts +121 -0
- package/dist/models/Diagnostics.d.ts.map +1 -0
- package/dist/models/Diagnostics.js +75 -0
- package/dist/models/Diagnostics.js.map +1 -0
- package/dist/models/InstallConfig.d.ts +139 -0
- package/dist/models/InstallConfig.d.ts.map +1 -0
- package/dist/models/InstallConfig.js +207 -0
- package/dist/models/InstallConfig.js.map +1 -0
- package/dist/models/InstallPlan.d.ts +189 -0
- package/dist/models/InstallPlan.d.ts.map +1 -0
- package/dist/models/InstallPlan.js +117 -0
- package/dist/models/InstallPlan.js.map +1 -0
- package/dist/models/InstallState.d.ts +173 -0
- package/dist/models/InstallState.d.ts.map +1 -0
- package/dist/models/InstallState.js +203 -0
- package/dist/models/InstallState.js.map +1 -0
- package/dist/models/VersionInfo.d.ts +53 -0
- package/dist/models/VersionInfo.d.ts.map +1 -0
- package/dist/models/VersionInfo.js +2 -0
- package/dist/models/VersionInfo.js.map +1 -0
- package/dist/phases/CodeGenPhase.d.ts +364 -0
- package/dist/phases/CodeGenPhase.d.ts.map +1 -0
- package/dist/phases/CodeGenPhase.js +1086 -0
- package/dist/phases/CodeGenPhase.js.map +1 -0
- package/dist/phases/ConfigurePhase.d.ts +86 -0
- package/dist/phases/ConfigurePhase.d.ts.map +1 -0
- package/dist/phases/ConfigurePhase.js +439 -0
- package/dist/phases/ConfigurePhase.js.map +1 -0
- package/dist/phases/DatabaseProvisionPhase.d.ts +82 -0
- package/dist/phases/DatabaseProvisionPhase.d.ts.map +1 -0
- package/dist/phases/DatabaseProvisionPhase.js +284 -0
- package/dist/phases/DatabaseProvisionPhase.js.map +1 -0
- package/dist/phases/DependencyPhase.d.ts +88 -0
- package/dist/phases/DependencyPhase.d.ts.map +1 -0
- package/dist/phases/DependencyPhase.js +237 -0
- package/dist/phases/DependencyPhase.js.map +1 -0
- package/dist/phases/MigratePhase.d.ts +70 -0
- package/dist/phases/MigratePhase.d.ts.map +1 -0
- package/dist/phases/MigratePhase.js +96 -0
- package/dist/phases/MigratePhase.js.map +1 -0
- package/dist/phases/PlatformCompatPhase.d.ts +193 -0
- package/dist/phases/PlatformCompatPhase.d.ts.map +1 -0
- package/dist/phases/PlatformCompatPhase.js +587 -0
- package/dist/phases/PlatformCompatPhase.js.map +1 -0
- package/dist/phases/PreflightPhase.d.ts +119 -0
- package/dist/phases/PreflightPhase.d.ts.map +1 -0
- package/dist/phases/PreflightPhase.js +394 -0
- package/dist/phases/PreflightPhase.js.map +1 -0
- package/dist/phases/ScaffoldPhase.d.ts +99 -0
- package/dist/phases/ScaffoldPhase.d.ts.map +1 -0
- package/dist/phases/ScaffoldPhase.js +235 -0
- package/dist/phases/ScaffoldPhase.js.map +1 -0
- package/dist/phases/SmokeTestPhase.d.ts +111 -0
- package/dist/phases/SmokeTestPhase.d.ts.map +1 -0
- package/dist/phases/SmokeTestPhase.js +426 -0
- package/dist/phases/SmokeTestPhase.js.map +1 -0
- package/package.json +26 -7
- package/README.md +0 -45
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter for file system operations used by the installer.
|
|
3
|
+
*
|
|
4
|
+
* Provides a testable abstraction over Node.js `fs` operations including
|
|
5
|
+
* ZIP extraction, directory inspection, disk space checks, write permission
|
|
6
|
+
* tests, temp directory creation, JSON/text I/O, and recursive file search.
|
|
7
|
+
*
|
|
8
|
+
* All methods are async and use `node:fs/promises` internally. The adapter
|
|
9
|
+
* pattern allows phases to be unit-tested with mock file system implementations.
|
|
10
|
+
*
|
|
11
|
+
* @module adapters/FileSystemAdapter
|
|
12
|
+
* @see ScaffoldPhase — uses ExtractZip, CreateTempDir, RemoveFile.
|
|
13
|
+
* @see PreflightPhase — uses GetFreeDiskSpace, CanWrite, DirectoryExists.
|
|
14
|
+
* @see ConfigurePhase — uses WriteText, ReadText, FileExists, ListFiles.
|
|
15
|
+
* @see CodeGenPhase — uses ReadText, WriteText, GetModifiedTime, FindFiles.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const fs = new FileSystemAdapter();
|
|
20
|
+
* await fs.ExtractZip('/tmp/release.zip', '/path/to/install');
|
|
21
|
+
* const config = await fs.ReadJSON<{ settings: object }>('/path/to/mj.config.cjs');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* File system adapter providing all I/O operations needed by installer phases.
|
|
26
|
+
*
|
|
27
|
+
* Methods are organized into categories:
|
|
28
|
+
* - **ZIP operations**: {@link ExtractZip}
|
|
29
|
+
* - **Directory operations**: {@link CreateDirectory}, {@link DirectoryExists},
|
|
30
|
+
* {@link IsDirectoryEmpty}, {@link ListDirectoryEntries}, {@link RemoveDir}
|
|
31
|
+
* - **File operations**: {@link FileExists}, {@link RemoveFile}, {@link ReadJSON},
|
|
32
|
+
* {@link WriteJSON}, {@link WriteText}, {@link ReadText}
|
|
33
|
+
* - **Disk checks**: {@link GetFreeDiskSpace}, {@link CanWrite}
|
|
34
|
+
* - **Temp/search**: {@link CreateTempDir}, {@link ListFiles}, {@link FindFiles},
|
|
35
|
+
* {@link GetModifiedTime}
|
|
36
|
+
*/
|
|
37
|
+
export declare class FileSystemAdapter {
|
|
38
|
+
/**
|
|
39
|
+
* Extract a ZIP file into a target directory.
|
|
40
|
+
*
|
|
41
|
+
* Handles the common GitHub zipball convention where all files are nested
|
|
42
|
+
* inside a single root folder (e.g., `MemberJunction-MJ-abc1234/`). When
|
|
43
|
+
* a single root folder is detected, its contents are extracted directly
|
|
44
|
+
* into `targetDir` without the wrapper folder.
|
|
45
|
+
*
|
|
46
|
+
* @param zipPath - Absolute path to the ZIP file.
|
|
47
|
+
* @param targetDir - Directory to extract into (created if it doesn't exist).
|
|
48
|
+
* @returns List of top-level entry names in the target directory after extraction.
|
|
49
|
+
* @throws Error if the ZIP file is corrupt or unreadable.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const entries = await fs.ExtractZip('/tmp/v5.1.0.zip', '/path/to/install');
|
|
54
|
+
* // ['packages', 'package.json', 'turbo.json', ...]
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
ExtractZip(zipPath: string, targetDir: string): Promise<string[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Create a directory and any missing parent directories.
|
|
60
|
+
*
|
|
61
|
+
* @param dirPath - Absolute path of the directory to create.
|
|
62
|
+
*/
|
|
63
|
+
CreateDirectory(dirPath: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Check whether a path exists and is a directory.
|
|
66
|
+
*
|
|
67
|
+
* @param dirPath - Absolute path to check.
|
|
68
|
+
* @returns `true` if the path exists and is a directory, `false` otherwise.
|
|
69
|
+
*/
|
|
70
|
+
DirectoryExists(dirPath: string): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Check whether a path exists and is a regular file.
|
|
73
|
+
*
|
|
74
|
+
* @param filePath - Absolute path to check.
|
|
75
|
+
* @returns `true` if the path exists and is a file, `false` otherwise.
|
|
76
|
+
*/
|
|
77
|
+
FileExists(filePath: string): Promise<boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* Check whether a directory is empty (contains no files or subdirectories).
|
|
80
|
+
*
|
|
81
|
+
* @param dirPath - Absolute path to the directory.
|
|
82
|
+
* @returns `true` if the directory is empty or doesn't exist, `false` otherwise.
|
|
83
|
+
*/
|
|
84
|
+
IsDirectoryEmpty(dirPath: string): Promise<boolean>;
|
|
85
|
+
/**
|
|
86
|
+
* List all entries (files and directories) in a directory.
|
|
87
|
+
* Returns an empty array if the directory doesn't exist.
|
|
88
|
+
*/
|
|
89
|
+
ListDirectoryEntries(dirPath: string): Promise<string[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Get free disk space in bytes at a given path.
|
|
92
|
+
*
|
|
93
|
+
* Walks up the directory tree to find an existing ancestor if `dirPath`
|
|
94
|
+
* doesn't exist yet (common for fresh installs). Uses `fs.statfs()` to
|
|
95
|
+
* query available blocks.
|
|
96
|
+
*
|
|
97
|
+
* @param dirPath - Path to check free space for (can be non-existent).
|
|
98
|
+
* @returns Available disk space in bytes.
|
|
99
|
+
* @throws Error if the filesystem stats cannot be read.
|
|
100
|
+
*/
|
|
101
|
+
GetFreeDiskSpace(dirPath: string): Promise<number>;
|
|
102
|
+
/**
|
|
103
|
+
* Test whether the current process can write to a directory.
|
|
104
|
+
*
|
|
105
|
+
* Creates the directory if it doesn't exist, writes a temporary probe file,
|
|
106
|
+
* then deletes it. Returns `false` if any step fails (permission denied, etc.).
|
|
107
|
+
*
|
|
108
|
+
* @param dirPath - Directory path to test write access for.
|
|
109
|
+
* @returns `true` if a file can be written and deleted in the directory.
|
|
110
|
+
*/
|
|
111
|
+
CanWrite(dirPath: string): Promise<boolean>;
|
|
112
|
+
/**
|
|
113
|
+
* Create a temporary directory in the system temp folder.
|
|
114
|
+
*
|
|
115
|
+
* @param prefix - Directory name prefix (default: `'mj-install-'`).
|
|
116
|
+
* @returns Absolute path to the created temporary directory.
|
|
117
|
+
*/
|
|
118
|
+
CreateTempDir(prefix?: string): Promise<string>;
|
|
119
|
+
/**
|
|
120
|
+
* Recursively remove a directory and all its contents.
|
|
121
|
+
*
|
|
122
|
+
* @param dirPath - Absolute path of the directory to remove.
|
|
123
|
+
*/
|
|
124
|
+
RemoveDir(dirPath: string): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Remove a single file. Silently succeeds if the file doesn't exist.
|
|
127
|
+
*
|
|
128
|
+
* @param filePath - Absolute path of the file to remove.
|
|
129
|
+
*/
|
|
130
|
+
RemoveFile(filePath: string): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Read and parse a JSON file.
|
|
133
|
+
*
|
|
134
|
+
* @typeParam T - Expected shape of the parsed JSON.
|
|
135
|
+
* @param filePath - Absolute path to the JSON file.
|
|
136
|
+
* @returns Parsed JSON content cast to type `T`.
|
|
137
|
+
* @throws Error if the file doesn't exist or contains invalid JSON.
|
|
138
|
+
*/
|
|
139
|
+
ReadJSON<T>(filePath: string): Promise<T>;
|
|
140
|
+
/**
|
|
141
|
+
* Serialize data as JSON and write it to a file (pretty-printed, 2-space indent).
|
|
142
|
+
*
|
|
143
|
+
* @param filePath - Absolute path to write the JSON file.
|
|
144
|
+
* @param data - Data to serialize.
|
|
145
|
+
*/
|
|
146
|
+
WriteJSON(filePath: string, data: unknown): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Write a UTF-8 text file, creating parent directories if needed.
|
|
149
|
+
* Used for `.env`, SQL scripts, environment.ts, and manifest files.
|
|
150
|
+
*
|
|
151
|
+
* @param filePath - Absolute path to write the file.
|
|
152
|
+
* @param content - Text content to write.
|
|
153
|
+
*/
|
|
154
|
+
WriteText(filePath: string, content: string): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Read a UTF-8 text file and return its content as a string.
|
|
157
|
+
*
|
|
158
|
+
* @param filePath - Absolute path to the file.
|
|
159
|
+
* @returns File content as a string.
|
|
160
|
+
* @throws Error if the file doesn't exist.
|
|
161
|
+
*/
|
|
162
|
+
ReadText(filePath: string): Promise<string>;
|
|
163
|
+
/**
|
|
164
|
+
* List file names in a directory, optionally filtered by a regex pattern.
|
|
165
|
+
* Returns only regular files (not directories).
|
|
166
|
+
*
|
|
167
|
+
* @param dirPath - Absolute path to the directory.
|
|
168
|
+
* @param pattern - Optional regex to filter file names (e.g., `/environment.*\.ts$/`).
|
|
169
|
+
* @returns Array of matching file names (not full paths). Empty if directory doesn't exist.
|
|
170
|
+
*/
|
|
171
|
+
ListFiles(dirPath: string, pattern?: RegExp): Promise<string[]>;
|
|
172
|
+
/**
|
|
173
|
+
* Get the last-modified time of a file in milliseconds since the Unix epoch.
|
|
174
|
+
*
|
|
175
|
+
* Used by {@link CodeGenPhase}'s fast mode to compare source vs compiled
|
|
176
|
+
* file timestamps and determine whether post-codegen rebuilds are needed.
|
|
177
|
+
*
|
|
178
|
+
* @param filePath - Absolute path to the file.
|
|
179
|
+
* @returns Modification time in milliseconds, or `null` if the file doesn't exist.
|
|
180
|
+
*/
|
|
181
|
+
GetModifiedTime(filePath: string): Promise<number | null>;
|
|
182
|
+
/**
|
|
183
|
+
* Recursively search for files with a specific name under a directory.
|
|
184
|
+
*
|
|
185
|
+
* Skips `node_modules` and `.git` directories to avoid excessive traversal.
|
|
186
|
+
* Used by {@link PlatformCompatPhase} to find all `package.json` files
|
|
187
|
+
* in the workspace.
|
|
188
|
+
*
|
|
189
|
+
* @param dirPath - Root directory to start the search from.
|
|
190
|
+
* @param filename - Exact file name to match (e.g., `'package.json'`).
|
|
191
|
+
* @param maxDepth - Maximum directory depth to recurse into (default: `3`).
|
|
192
|
+
* @returns Array of absolute paths to matching files.
|
|
193
|
+
*/
|
|
194
|
+
FindFiles(dirPath: string, filename: string, maxDepth?: number): Promise<string[]>;
|
|
195
|
+
private findFilesRecursive;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=FileSystemAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystemAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/FileSystemAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;;;;;;;;;;;;;OAkBG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA2CvE;;;;OAIG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD;;;;;OAKG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASxD;;;;;OAKG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASpD;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASzD;;;OAGG;IACG,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ9D;;;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1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter for file system operations used by the installer.
|
|
3
|
+
*
|
|
4
|
+
* Provides a testable abstraction over Node.js `fs` operations including
|
|
5
|
+
* ZIP extraction, directory inspection, disk space checks, write permission
|
|
6
|
+
* tests, temp directory creation, JSON/text I/O, and recursive file search.
|
|
7
|
+
*
|
|
8
|
+
* All methods are async and use `node:fs/promises` internally. The adapter
|
|
9
|
+
* pattern allows phases to be unit-tested with mock file system implementations.
|
|
10
|
+
*
|
|
11
|
+
* @module adapters/FileSystemAdapter
|
|
12
|
+
* @see ScaffoldPhase — uses ExtractZip, CreateTempDir, RemoveFile.
|
|
13
|
+
* @see PreflightPhase — uses GetFreeDiskSpace, CanWrite, DirectoryExists.
|
|
14
|
+
* @see ConfigurePhase — uses WriteText, ReadText, FileExists, ListFiles.
|
|
15
|
+
* @see CodeGenPhase — uses ReadText, WriteText, GetModifiedTime, FindFiles.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const fs = new FileSystemAdapter();
|
|
20
|
+
* await fs.ExtractZip('/tmp/release.zip', '/path/to/install');
|
|
21
|
+
* const config = await fs.ReadJSON<{ settings: object }>('/path/to/mj.config.cjs');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
import fs from 'node:fs/promises';
|
|
25
|
+
import path from 'node:path';
|
|
26
|
+
import os from 'node:os';
|
|
27
|
+
import AdmZip from 'adm-zip';
|
|
28
|
+
/**
|
|
29
|
+
* File system adapter providing all I/O operations needed by installer phases.
|
|
30
|
+
*
|
|
31
|
+
* Methods are organized into categories:
|
|
32
|
+
* - **ZIP operations**: {@link ExtractZip}
|
|
33
|
+
* - **Directory operations**: {@link CreateDirectory}, {@link DirectoryExists},
|
|
34
|
+
* {@link IsDirectoryEmpty}, {@link ListDirectoryEntries}, {@link RemoveDir}
|
|
35
|
+
* - **File operations**: {@link FileExists}, {@link RemoveFile}, {@link ReadJSON},
|
|
36
|
+
* {@link WriteJSON}, {@link WriteText}, {@link ReadText}
|
|
37
|
+
* - **Disk checks**: {@link GetFreeDiskSpace}, {@link CanWrite}
|
|
38
|
+
* - **Temp/search**: {@link CreateTempDir}, {@link ListFiles}, {@link FindFiles},
|
|
39
|
+
* {@link GetModifiedTime}
|
|
40
|
+
*/
|
|
41
|
+
export class FileSystemAdapter {
|
|
42
|
+
/**
|
|
43
|
+
* Extract a ZIP file into a target directory.
|
|
44
|
+
*
|
|
45
|
+
* Handles the common GitHub zipball convention where all files are nested
|
|
46
|
+
* inside a single root folder (e.g., `MemberJunction-MJ-abc1234/`). When
|
|
47
|
+
* a single root folder is detected, its contents are extracted directly
|
|
48
|
+
* into `targetDir` without the wrapper folder.
|
|
49
|
+
*
|
|
50
|
+
* @param zipPath - Absolute path to the ZIP file.
|
|
51
|
+
* @param targetDir - Directory to extract into (created if it doesn't exist).
|
|
52
|
+
* @returns List of top-level entry names in the target directory after extraction.
|
|
53
|
+
* @throws Error if the ZIP file is corrupt or unreadable.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const entries = await fs.ExtractZip('/tmp/v5.1.0.zip', '/path/to/install');
|
|
58
|
+
* // ['packages', 'package.json', 'turbo.json', ...]
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
async ExtractZip(zipPath, targetDir) {
|
|
62
|
+
const zip = new AdmZip(zipPath);
|
|
63
|
+
const entries = zip.getEntries();
|
|
64
|
+
// Determine if ZIP has a single root folder (common for GitHub zipballs)
|
|
65
|
+
const topLevelNames = new Set();
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
const firstSegment = entry.entryName.split('/')[0];
|
|
68
|
+
topLevelNames.add(firstSegment);
|
|
69
|
+
}
|
|
70
|
+
const hasSingleRoot = topLevelNames.size === 1;
|
|
71
|
+
const rootPrefix = hasSingleRoot ? [...topLevelNames][0] + '/' : '';
|
|
72
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
73
|
+
for (const entry of entries) {
|
|
74
|
+
let relativePath = entry.entryName;
|
|
75
|
+
// Strip the single root folder if present
|
|
76
|
+
if (hasSingleRoot && relativePath.startsWith(rootPrefix)) {
|
|
77
|
+
relativePath = relativePath.slice(rootPrefix.length);
|
|
78
|
+
}
|
|
79
|
+
if (!relativePath) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const fullPath = path.join(targetDir, relativePath);
|
|
83
|
+
if (entry.isDirectory) {
|
|
84
|
+
await fs.mkdir(fullPath, { recursive: true });
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
88
|
+
await fs.writeFile(fullPath, new Uint8Array(entry.getData()));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Return the list of top-level items in the target dir after extraction
|
|
92
|
+
const extracted = await fs.readdir(targetDir);
|
|
93
|
+
return extracted;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create a directory and any missing parent directories.
|
|
97
|
+
*
|
|
98
|
+
* @param dirPath - Absolute path of the directory to create.
|
|
99
|
+
*/
|
|
100
|
+
async CreateDirectory(dirPath) {
|
|
101
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check whether a path exists and is a directory.
|
|
105
|
+
*
|
|
106
|
+
* @param dirPath - Absolute path to check.
|
|
107
|
+
* @returns `true` if the path exists and is a directory, `false` otherwise.
|
|
108
|
+
*/
|
|
109
|
+
async DirectoryExists(dirPath) {
|
|
110
|
+
try {
|
|
111
|
+
const stat = await fs.stat(dirPath);
|
|
112
|
+
return stat.isDirectory();
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Check whether a path exists and is a regular file.
|
|
120
|
+
*
|
|
121
|
+
* @param filePath - Absolute path to check.
|
|
122
|
+
* @returns `true` if the path exists and is a file, `false` otherwise.
|
|
123
|
+
*/
|
|
124
|
+
async FileExists(filePath) {
|
|
125
|
+
try {
|
|
126
|
+
const stat = await fs.stat(filePath);
|
|
127
|
+
return stat.isFile();
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check whether a directory is empty (contains no files or subdirectories).
|
|
135
|
+
*
|
|
136
|
+
* @param dirPath - Absolute path to the directory.
|
|
137
|
+
* @returns `true` if the directory is empty or doesn't exist, `false` otherwise.
|
|
138
|
+
*/
|
|
139
|
+
async IsDirectoryEmpty(dirPath) {
|
|
140
|
+
try {
|
|
141
|
+
const entries = await fs.readdir(dirPath);
|
|
142
|
+
return entries.length === 0;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return true; // doesn't exist = treat as empty
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* List all entries (files and directories) in a directory.
|
|
150
|
+
* Returns an empty array if the directory doesn't exist.
|
|
151
|
+
*/
|
|
152
|
+
async ListDirectoryEntries(dirPath) {
|
|
153
|
+
try {
|
|
154
|
+
return await fs.readdir(dirPath);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get free disk space in bytes at a given path.
|
|
162
|
+
*
|
|
163
|
+
* Walks up the directory tree to find an existing ancestor if `dirPath`
|
|
164
|
+
* doesn't exist yet (common for fresh installs). Uses `fs.statfs()` to
|
|
165
|
+
* query available blocks.
|
|
166
|
+
*
|
|
167
|
+
* @param dirPath - Path to check free space for (can be non-existent).
|
|
168
|
+
* @returns Available disk space in bytes.
|
|
169
|
+
* @throws Error if the filesystem stats cannot be read.
|
|
170
|
+
*/
|
|
171
|
+
async GetFreeDiskSpace(dirPath) {
|
|
172
|
+
// Ensure the directory exists (use parent if it doesn't)
|
|
173
|
+
let checkPath = dirPath;
|
|
174
|
+
while (!(await this.DirectoryExists(checkPath))) {
|
|
175
|
+
const parent = path.dirname(checkPath);
|
|
176
|
+
if (parent === checkPath)
|
|
177
|
+
break; // reached root
|
|
178
|
+
checkPath = parent;
|
|
179
|
+
}
|
|
180
|
+
const stats = await fs.statfs(checkPath);
|
|
181
|
+
return stats.bavail * stats.bsize;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Test whether the current process can write to a directory.
|
|
185
|
+
*
|
|
186
|
+
* Creates the directory if it doesn't exist, writes a temporary probe file,
|
|
187
|
+
* then deletes it. Returns `false` if any step fails (permission denied, etc.).
|
|
188
|
+
*
|
|
189
|
+
* @param dirPath - Directory path to test write access for.
|
|
190
|
+
* @returns `true` if a file can be written and deleted in the directory.
|
|
191
|
+
*/
|
|
192
|
+
async CanWrite(dirPath) {
|
|
193
|
+
try {
|
|
194
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
195
|
+
const testFile = path.join(dirPath, `.mj-install-write-test-${Date.now()}`);
|
|
196
|
+
await fs.writeFile(testFile, 'test');
|
|
197
|
+
await fs.unlink(testFile);
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Create a temporary directory in the system temp folder.
|
|
206
|
+
*
|
|
207
|
+
* @param prefix - Directory name prefix (default: `'mj-install-'`).
|
|
208
|
+
* @returns Absolute path to the created temporary directory.
|
|
209
|
+
*/
|
|
210
|
+
async CreateTempDir(prefix = 'mj-install-') {
|
|
211
|
+
return fs.mkdtemp(path.join(os.tmpdir(), prefix));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Recursively remove a directory and all its contents.
|
|
215
|
+
*
|
|
216
|
+
* @param dirPath - Absolute path of the directory to remove.
|
|
217
|
+
*/
|
|
218
|
+
async RemoveDir(dirPath) {
|
|
219
|
+
await fs.rm(dirPath, { recursive: true, force: true });
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Remove a single file. Silently succeeds if the file doesn't exist.
|
|
223
|
+
*
|
|
224
|
+
* @param filePath - Absolute path of the file to remove.
|
|
225
|
+
*/
|
|
226
|
+
async RemoveFile(filePath) {
|
|
227
|
+
try {
|
|
228
|
+
await fs.unlink(filePath);
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
// ignore if it doesn't exist
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Read and parse a JSON file.
|
|
236
|
+
*
|
|
237
|
+
* @typeParam T - Expected shape of the parsed JSON.
|
|
238
|
+
* @param filePath - Absolute path to the JSON file.
|
|
239
|
+
* @returns Parsed JSON content cast to type `T`.
|
|
240
|
+
* @throws Error if the file doesn't exist or contains invalid JSON.
|
|
241
|
+
*/
|
|
242
|
+
async ReadJSON(filePath) {
|
|
243
|
+
const raw = await fs.readFile(filePath, 'utf-8');
|
|
244
|
+
return JSON.parse(raw);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Serialize data as JSON and write it to a file (pretty-printed, 2-space indent).
|
|
248
|
+
*
|
|
249
|
+
* @param filePath - Absolute path to write the JSON file.
|
|
250
|
+
* @param data - Data to serialize.
|
|
251
|
+
*/
|
|
252
|
+
async WriteJSON(filePath, data) {
|
|
253
|
+
const json = JSON.stringify(data, null, 2);
|
|
254
|
+
await fs.writeFile(filePath, json, 'utf-8');
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Write a UTF-8 text file, creating parent directories if needed.
|
|
258
|
+
* Used for `.env`, SQL scripts, environment.ts, and manifest files.
|
|
259
|
+
*
|
|
260
|
+
* @param filePath - Absolute path to write the file.
|
|
261
|
+
* @param content - Text content to write.
|
|
262
|
+
*/
|
|
263
|
+
async WriteText(filePath, content) {
|
|
264
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
265
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Read a UTF-8 text file and return its content as a string.
|
|
269
|
+
*
|
|
270
|
+
* @param filePath - Absolute path to the file.
|
|
271
|
+
* @returns File content as a string.
|
|
272
|
+
* @throws Error if the file doesn't exist.
|
|
273
|
+
*/
|
|
274
|
+
async ReadText(filePath) {
|
|
275
|
+
return fs.readFile(filePath, 'utf-8');
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* List file names in a directory, optionally filtered by a regex pattern.
|
|
279
|
+
* Returns only regular files (not directories).
|
|
280
|
+
*
|
|
281
|
+
* @param dirPath - Absolute path to the directory.
|
|
282
|
+
* @param pattern - Optional regex to filter file names (e.g., `/environment.*\.ts$/`).
|
|
283
|
+
* @returns Array of matching file names (not full paths). Empty if directory doesn't exist.
|
|
284
|
+
*/
|
|
285
|
+
async ListFiles(dirPath, pattern) {
|
|
286
|
+
try {
|
|
287
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
288
|
+
const files = entries
|
|
289
|
+
.filter((e) => e.isFile())
|
|
290
|
+
.map((e) => e.name);
|
|
291
|
+
if (pattern) {
|
|
292
|
+
return files.filter((f) => pattern.test(f));
|
|
293
|
+
}
|
|
294
|
+
return files;
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Get the last-modified time of a file in milliseconds since the Unix epoch.
|
|
302
|
+
*
|
|
303
|
+
* Used by {@link CodeGenPhase}'s fast mode to compare source vs compiled
|
|
304
|
+
* file timestamps and determine whether post-codegen rebuilds are needed.
|
|
305
|
+
*
|
|
306
|
+
* @param filePath - Absolute path to the file.
|
|
307
|
+
* @returns Modification time in milliseconds, or `null` if the file doesn't exist.
|
|
308
|
+
*/
|
|
309
|
+
async GetModifiedTime(filePath) {
|
|
310
|
+
try {
|
|
311
|
+
const stat = await fs.stat(filePath);
|
|
312
|
+
return stat.mtimeMs;
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Recursively search for files with a specific name under a directory.
|
|
320
|
+
*
|
|
321
|
+
* Skips `node_modules` and `.git` directories to avoid excessive traversal.
|
|
322
|
+
* Used by {@link PlatformCompatPhase} to find all `package.json` files
|
|
323
|
+
* in the workspace.
|
|
324
|
+
*
|
|
325
|
+
* @param dirPath - Root directory to start the search from.
|
|
326
|
+
* @param filename - Exact file name to match (e.g., `'package.json'`).
|
|
327
|
+
* @param maxDepth - Maximum directory depth to recurse into (default: `3`).
|
|
328
|
+
* @returns Array of absolute paths to matching files.
|
|
329
|
+
*/
|
|
330
|
+
async FindFiles(dirPath, filename, maxDepth = 3) {
|
|
331
|
+
const results = [];
|
|
332
|
+
await this.findFilesRecursive(dirPath, filename, maxDepth, 0, results);
|
|
333
|
+
return results;
|
|
334
|
+
}
|
|
335
|
+
async findFilesRecursive(dirPath, filename, maxDepth, currentDepth, results) {
|
|
336
|
+
if (currentDepth > maxDepth)
|
|
337
|
+
return;
|
|
338
|
+
try {
|
|
339
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
340
|
+
for (const entry of entries) {
|
|
341
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
342
|
+
if (entry.isFile() && entry.name === filename) {
|
|
343
|
+
results.push(fullPath);
|
|
344
|
+
}
|
|
345
|
+
else if (entry.isDirectory() && entry.name !== 'node_modules' && entry.name !== '.git') {
|
|
346
|
+
await this.findFilesRecursive(fullPath, filename, maxDepth, currentDepth + 1, results);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
// skip directories we can't read
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
//# sourceMappingURL=FileSystemAdapter.js.map
|
|
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