@mdfriday/foundry 26.4.3 → 26.4.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/dist/cli.js +113 -14
- package/dist/index.js +2 -2
- package/dist/internal/domain/publish/repository/manifest-repository.d.ts +3 -3
- package/dist/internal/domain/publish/value-object/mdfriday-publisher.d.ts +2 -0
- package/dist/internal/infrastructure/persistence/node-manifest-repository.d.ts +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8674,14 +8674,35 @@ var init_mdfriday_publisher = __esm({
|
|
|
8674
8674
|
"MDFriday access token not found.\nPlease login first:\n mdf auth login"
|
|
8675
8675
|
);
|
|
8676
8676
|
}
|
|
8677
|
+
const { changedFiles, allFiles } = await this.getFileLists(
|
|
8678
|
+
sourceDir,
|
|
8679
|
+
options?.incremental
|
|
8680
|
+
);
|
|
8681
|
+
const isIncremental = options?.incremental && changedFiles.length < allFiles.length && changedFiles.length > 0;
|
|
8682
|
+
if (isIncremental) {
|
|
8683
|
+
log12.info(
|
|
8684
|
+
`Incremental deploy: ${changedFiles.length}/${allFiles.length} files (${Math.round(changedFiles.length / allFiles.length * 100)}%)`
|
|
8685
|
+
);
|
|
8686
|
+
} else if (options?.incremental && changedFiles.length === 0) {
|
|
8687
|
+
log12.info("No files changed, skipping deployment");
|
|
8688
|
+
return {
|
|
8689
|
+
success: true,
|
|
8690
|
+
url: "",
|
|
8691
|
+
filesUploaded: 0,
|
|
8692
|
+
bytesTransferred: 0,
|
|
8693
|
+
duration: Date.now() - startTime
|
|
8694
|
+
};
|
|
8695
|
+
}
|
|
8677
8696
|
options?.onProgress?.({
|
|
8678
8697
|
phase: "scanning",
|
|
8679
8698
|
percentage: 5,
|
|
8680
|
-
message: "Creating deployment package..."
|
|
8699
|
+
message: isIncremental ? `Creating incremental package (${changedFiles.length} files)...` : "Creating deployment package..."
|
|
8681
8700
|
});
|
|
8682
|
-
const zipContent = await this.createZipFromDirectory(sourceDir);
|
|
8701
|
+
const zipContent = isIncremental ? await this.createIncrementalZip(sourceDir, changedFiles) : await this.createZipFromDirectory(sourceDir);
|
|
8683
8702
|
const zipSize = zipContent.length;
|
|
8684
|
-
log12.info(
|
|
8703
|
+
log12.info(
|
|
8704
|
+
`Created ${isIncremental ? "incremental" : "full"} ZIP package: ${this.formatBytes(zipSize)}`
|
|
8705
|
+
);
|
|
8685
8706
|
options?.onProgress?.({
|
|
8686
8707
|
phase: "scanning",
|
|
8687
8708
|
percentage: 30,
|
|
@@ -8724,7 +8745,11 @@ var init_mdfriday_publisher = __esm({
|
|
|
8724
8745
|
"mdfriday",
|
|
8725
8746
|
{ previewId, deploymentType: this.config.deploymentType }
|
|
8726
8747
|
);
|
|
8727
|
-
await this.manifestRepo.saveManifest(
|
|
8748
|
+
await this.manifestRepo.saveManifest(
|
|
8749
|
+
this.projectPath,
|
|
8750
|
+
manifest,
|
|
8751
|
+
this.config.deploymentType
|
|
8752
|
+
);
|
|
8728
8753
|
options?.onProgress?.({
|
|
8729
8754
|
phase: "complete",
|
|
8730
8755
|
percentage: 100,
|
|
@@ -8735,7 +8760,7 @@ var init_mdfriday_publisher = __esm({
|
|
|
8735
8760
|
return {
|
|
8736
8761
|
success: true,
|
|
8737
8762
|
url: deployUrl,
|
|
8738
|
-
filesUploaded:
|
|
8763
|
+
filesUploaded: changedFiles.length,
|
|
8739
8764
|
bytesTransferred: zipSize,
|
|
8740
8765
|
duration
|
|
8741
8766
|
};
|
|
@@ -8793,6 +8818,70 @@ var init_mdfriday_publisher = __esm({
|
|
|
8793
8818
|
// ============================================================================
|
|
8794
8819
|
// Private Methods
|
|
8795
8820
|
// ============================================================================
|
|
8821
|
+
/**
|
|
8822
|
+
* Get file lists for incremental or full publish
|
|
8823
|
+
* Similar to FtpPublisher.getFileLists()
|
|
8824
|
+
*
|
|
8825
|
+
* @returns changedFiles - Files that are new or modified
|
|
8826
|
+
* @returns allFiles - All current files in sourceDir
|
|
8827
|
+
*/
|
|
8828
|
+
async getFileLists(sourceDir, incremental) {
|
|
8829
|
+
const currentManifest = await this.manifestRepo.generateManifest(
|
|
8830
|
+
this.projectId,
|
|
8831
|
+
sourceDir,
|
|
8832
|
+
"mdfriday",
|
|
8833
|
+
{ deploymentType: this.config.deploymentType }
|
|
8834
|
+
);
|
|
8835
|
+
const allFiles = currentManifest.getAllFiles();
|
|
8836
|
+
if (!incremental) {
|
|
8837
|
+
log12.debug("Full publish mode: deploying all files");
|
|
8838
|
+
return {
|
|
8839
|
+
changedFiles: allFiles,
|
|
8840
|
+
allFiles
|
|
8841
|
+
};
|
|
8842
|
+
}
|
|
8843
|
+
const lastManifest = await this.manifestRepo.loadManifest(
|
|
8844
|
+
this.projectPath,
|
|
8845
|
+
"mdfriday",
|
|
8846
|
+
this.config.deploymentType
|
|
8847
|
+
);
|
|
8848
|
+
if (!lastManifest) {
|
|
8849
|
+
log12.info("No previous manifest found, performing full deploy");
|
|
8850
|
+
return {
|
|
8851
|
+
changedFiles: allFiles,
|
|
8852
|
+
allFiles
|
|
8853
|
+
};
|
|
8854
|
+
}
|
|
8855
|
+
const changedFiles = lastManifest.getChangedFiles(currentManifest);
|
|
8856
|
+
log12.info(`Incremental mode: ${changedFiles.length}/${allFiles.length} files changed`);
|
|
8857
|
+
return {
|
|
8858
|
+
changedFiles,
|
|
8859
|
+
allFiles
|
|
8860
|
+
};
|
|
8861
|
+
}
|
|
8862
|
+
/**
|
|
8863
|
+
* Create incremental ZIP containing only specified files
|
|
8864
|
+
* Maintains directory structure
|
|
8865
|
+
*/
|
|
8866
|
+
async createIncrementalZip(sourceDir, filesToInclude) {
|
|
8867
|
+
const JSZip2 = require("jszip");
|
|
8868
|
+
const zip = new JSZip2();
|
|
8869
|
+
log12.debug(`Creating incremental ZIP with ${filesToInclude.length} files`);
|
|
8870
|
+
for (const relativePath of filesToInclude) {
|
|
8871
|
+
const filePath = import_path10.default.join(sourceDir, relativePath);
|
|
8872
|
+
try {
|
|
8873
|
+
const fileContent = await import_fs7.promises.readFile(filePath);
|
|
8874
|
+
zip.file(relativePath, new Uint8Array(fileContent));
|
|
8875
|
+
} catch (error) {
|
|
8876
|
+
log12.error(`Failed to add file to ZIP: ${relativePath}`, error);
|
|
8877
|
+
throw new Error(`Failed to add file to incremental ZIP: ${relativePath}`);
|
|
8878
|
+
}
|
|
8879
|
+
}
|
|
8880
|
+
return await zip.generateAsync({ type: "uint8array" });
|
|
8881
|
+
}
|
|
8882
|
+
// ============================================================================
|
|
8883
|
+
// Private Methods
|
|
8884
|
+
// ============================================================================
|
|
8796
8885
|
/**
|
|
8797
8886
|
* Create ZIP file from directory
|
|
8798
8887
|
* Similar to old Netlify implementation
|
|
@@ -9075,8 +9164,8 @@ var init_node_manifest_repository = __esm({
|
|
|
9075
9164
|
/**
|
|
9076
9165
|
* Load manifest from file
|
|
9077
9166
|
*/
|
|
9078
|
-
async loadManifest(projectPath, publishMethod) {
|
|
9079
|
-
const manifestPath = this.getManifestPath(projectPath, publishMethod);
|
|
9167
|
+
async loadManifest(projectPath, publishMethod, suffix) {
|
|
9168
|
+
const manifestPath = this.getManifestPath(projectPath, publishMethod, suffix);
|
|
9080
9169
|
try {
|
|
9081
9170
|
const content = await import_fs8.promises.readFile(manifestPath, "utf-8");
|
|
9082
9171
|
const json = JSON.parse(content);
|
|
@@ -9093,10 +9182,14 @@ var init_node_manifest_repository = __esm({
|
|
|
9093
9182
|
/**
|
|
9094
9183
|
* Save manifest to file
|
|
9095
9184
|
*/
|
|
9096
|
-
async saveManifest(projectPath, manifest) {
|
|
9185
|
+
async saveManifest(projectPath, manifest, suffix) {
|
|
9097
9186
|
const manifestDir = import_path11.default.join(projectPath, ".mdfriday");
|
|
9098
9187
|
await import_fs8.promises.mkdir(manifestDir, { recursive: true });
|
|
9099
|
-
const manifestPath = this.getManifestPath(
|
|
9188
|
+
const manifestPath = this.getManifestPath(
|
|
9189
|
+
projectPath,
|
|
9190
|
+
manifest.getPublishMethod(),
|
|
9191
|
+
suffix
|
|
9192
|
+
);
|
|
9100
9193
|
await import_fs8.promises.writeFile(
|
|
9101
9194
|
manifestPath,
|
|
9102
9195
|
JSON.stringify(manifest.toJSON(), null, 2),
|
|
@@ -9123,8 +9216,8 @@ var init_node_manifest_repository = __esm({
|
|
|
9123
9216
|
/**
|
|
9124
9217
|
* Delete manifest file
|
|
9125
9218
|
*/
|
|
9126
|
-
async deleteManifest(projectPath, publishMethod) {
|
|
9127
|
-
const manifestPath = this.getManifestPath(projectPath, publishMethod);
|
|
9219
|
+
async deleteManifest(projectPath, publishMethod, suffix) {
|
|
9220
|
+
const manifestPath = this.getManifestPath(projectPath, publishMethod, suffix);
|
|
9128
9221
|
try {
|
|
9129
9222
|
await import_fs8.promises.unlink(manifestPath);
|
|
9130
9223
|
log14.debug(`Manifest deleted: ${manifestPath}`);
|
|
@@ -9141,9 +9234,15 @@ var init_node_manifest_repository = __esm({
|
|
|
9141
9234
|
// ============================================================================
|
|
9142
9235
|
/**
|
|
9143
9236
|
* Get manifest file path
|
|
9237
|
+
*
|
|
9238
|
+
* @param projectPath
|
|
9239
|
+
* @param publishMethod
|
|
9240
|
+
* @param suffix - Optional suffix for manifest filename (e.g., 'free', 'custom')
|
|
9241
|
+
* For mdfriday with different deploymentTypes
|
|
9144
9242
|
*/
|
|
9145
|
-
getManifestPath(projectPath, publishMethod) {
|
|
9146
|
-
|
|
9243
|
+
getManifestPath(projectPath, publishMethod, suffix) {
|
|
9244
|
+
const filename = suffix ? `manifest-${publishMethod}-${suffix}.json` : `manifest-${publishMethod}.json`;
|
|
9245
|
+
return import_path11.default.join(projectPath, ".mdfriday", filename);
|
|
9147
9246
|
}
|
|
9148
9247
|
/**
|
|
9149
9248
|
* Recursively scan directory and collect file info
|
|
@@ -55225,7 +55324,7 @@ For more information, visit: https://help.mdfriday.com
|
|
|
55225
55324
|
* Show version
|
|
55226
55325
|
*/
|
|
55227
55326
|
showVersion() {
|
|
55228
|
-
const version = "26.4.
|
|
55327
|
+
const version = "26.4.5";
|
|
55229
55328
|
return {
|
|
55230
55329
|
success: true,
|
|
55231
55330
|
message: `MDFriday CLI v${version}`
|