@pmate/cli 0.24.40 → 0.24.42
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/index.js +25 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16398,10 +16398,13 @@ async function archiveMessageImages(rootDir, sourceKey, threadKey, messages2) {
|
|
|
16398
16398
|
);
|
|
16399
16399
|
}
|
|
16400
16400
|
async function archiveMessageImage(rootDir, attachmentRoot, threadKey, imagePath) {
|
|
16401
|
-
if (!imagePath || isExternalImageRef(imagePath)
|
|
16401
|
+
if (!imagePath || isExternalImageRef(imagePath)) {
|
|
16402
16402
|
return imagePath;
|
|
16403
16403
|
}
|
|
16404
16404
|
const normalized = import_node_path18.default.posix.normalize(imagePath.replace(/\\/g, "/"));
|
|
16405
|
+
if (normalized.startsWith("attachments/")) {
|
|
16406
|
+
return import_node_path18.default.join(rootDir, ...normalized.split("/"));
|
|
16407
|
+
}
|
|
16405
16408
|
if (normalized.startsWith("../") || import_node_path18.default.posix.isAbsolute(normalized)) {
|
|
16406
16409
|
return imagePath;
|
|
16407
16410
|
}
|
|
@@ -16411,7 +16414,7 @@ async function archiveMessageImage(rootDir, attachmentRoot, threadKey, imagePath
|
|
|
16411
16414
|
try {
|
|
16412
16415
|
await import_node_fs13.promises.mkdir(import_node_path18.default.dirname(destinationPath), { recursive: true });
|
|
16413
16416
|
await import_node_fs13.promises.copyFile(sourcePath, destinationPath);
|
|
16414
|
-
return
|
|
16417
|
+
return destinationPath;
|
|
16415
16418
|
} catch {
|
|
16416
16419
|
return imagePath;
|
|
16417
16420
|
}
|
|
@@ -18928,7 +18931,7 @@ var ServiceRuntimeRunner = class {
|
|
|
18928
18931
|
if (cwd) {
|
|
18929
18932
|
return import_node_path24.default.resolve(process.cwd(), cwd);
|
|
18930
18933
|
}
|
|
18931
|
-
const repository = this.getType(service) === "vite" || this.getType(service) === "static" ? this.
|
|
18934
|
+
const repository = this.getType(service) === "vite" || this.getType(service) === "static" ? this.getRepoStaticSite(service).repository.trim() : this.getType(service) === "fc" ? this.getFc(service).repository?.trim() : this.getType(service) === "ios" || this.getType(service) === "android" ? void 0 : this.getNetwork(service).repository?.trim();
|
|
18932
18935
|
if (repository) {
|
|
18933
18936
|
const repoName = repository.replace(/\/+$/, "").split("/").pop()?.replace(/\.git$/i, "");
|
|
18934
18937
|
if (repoName) {
|
|
@@ -18947,13 +18950,14 @@ var ServiceRuntimeRunner = class {
|
|
|
18947
18950
|
}
|
|
18948
18951
|
resolveLocalDir(service, cwd) {
|
|
18949
18952
|
const repoRoot = this.resolveRepoRoot(service, cwd);
|
|
18950
|
-
const dir = this.getType(service) === "vite" || this.getType(service) === "static" ? this.
|
|
18953
|
+
const dir = this.getType(service) === "vite" || this.getType(service) === "static" ? this.getRepoStaticSite(service).dir.trim() : this.getType(service) === "fc" ? this.getFc(service).dir?.trim() : this.getType(service) === "ios" || this.getType(service) === "android" ? void 0 : this.getNetwork(service).dir?.trim();
|
|
18951
18954
|
if (!dir) {
|
|
18952
18955
|
throw new Error(`Missing service dir for ${service.id}`);
|
|
18953
18956
|
}
|
|
18954
18957
|
return import_node_path24.default.resolve(repoRoot, dir);
|
|
18955
18958
|
}
|
|
18956
18959
|
async deployVite(service, options) {
|
|
18960
|
+
this.assertDeployableStaticSite(service);
|
|
18957
18961
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
18958
18962
|
const packageJsonPath = import_node_path24.default.join(appDir, "package.json");
|
|
18959
18963
|
if (!(0, import_node_fs20.existsSync)(packageJsonPath)) {
|
|
@@ -18983,6 +18987,7 @@ var ServiceRuntimeRunner = class {
|
|
|
18983
18987
|
await AliyunService.uploadDirectory(distDir, bucketName);
|
|
18984
18988
|
}
|
|
18985
18989
|
async deployStatic(service, options) {
|
|
18990
|
+
this.assertDeployableStaticSite(service);
|
|
18986
18991
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
18987
18992
|
const srcDir = import_node_path24.default.join(appDir, "src");
|
|
18988
18993
|
if (!(0, import_node_fs20.existsSync)(srcDir)) {
|
|
@@ -19308,6 +19313,9 @@ var ServiceRuntimeRunner = class {
|
|
|
19308
19313
|
}
|
|
19309
19314
|
async initStaticLike(service) {
|
|
19310
19315
|
const site = this.getSite(service);
|
|
19316
|
+
if (site.exposeType === "managed-oss-cdn") {
|
|
19317
|
+
throw new Error(`Service ${service.id} is managed-oss-cdn and cannot be initialized`);
|
|
19318
|
+
}
|
|
19311
19319
|
const bucketName = site.bucket?.trim();
|
|
19312
19320
|
const baseDomain = site.domain?.trim();
|
|
19313
19321
|
if (!bucketName) {
|
|
@@ -19324,6 +19332,19 @@ var ServiceRuntimeRunner = class {
|
|
|
19324
19332
|
routeType: this.getType(service) === "vite" ? "spa" : "spa"
|
|
19325
19333
|
});
|
|
19326
19334
|
}
|
|
19335
|
+
assertDeployableStaticSite(service) {
|
|
19336
|
+
const site = this.getSite(service);
|
|
19337
|
+
if (site.exposeType === "managed-oss-cdn") {
|
|
19338
|
+
throw new Error(`Service ${service.id} is managed-oss-cdn and cannot be deployed`);
|
|
19339
|
+
}
|
|
19340
|
+
}
|
|
19341
|
+
getRepoStaticSite(service) {
|
|
19342
|
+
const site = this.getSite(service);
|
|
19343
|
+
if (site.exposeType === "managed-oss-cdn") {
|
|
19344
|
+
throw new Error(`Service ${service.id} is managed-oss-cdn and has no repository or dir`);
|
|
19345
|
+
}
|
|
19346
|
+
return site;
|
|
19347
|
+
}
|
|
19327
19348
|
async initServerApp(service, options, config) {
|
|
19328
19349
|
const network = this.getNetwork(service);
|
|
19329
19350
|
const subdomain = "subdomain" in network ? network.subdomain?.trim() : void 0;
|