MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / publish

Function publish

modules/code-generator/src/publisher/zip/index.ts:36–63  ·  view source on GitHub ↗
(options: ZipFactoryParams = {})

Source from the content-addressed store, hash-verified

34 };
35
36 const publish = async (options: ZipFactoryParams = {}) => {
37 const projectToPublish = options.project || project;
38 if (!projectToPublish) {
39 throw new PublisherError('MissingProject');
40 }
41
42 const zipName = options.projectSlug || params.projectSlug || projectToPublish.name;
43
44 try {
45 const zipContent = await generateProjectZip(projectToPublish);
46
47 if (isNodeProcess()) {
48 // If not output path is provided on the node side, zip is not written to disk
49 const projectOutputPath = options.outputPath || outputPath;
50 if (projectOutputPath) {
51 await writeZipToDisk(projectOutputPath, zipContent, zipName);
52 }
53 } else {
54 // the browser end does not require a path
55 // auto download zip files
56 saveAs(zipContent as Blob, `${zipName}.zip`);
57 }
58
59 return { success: true, payload: zipContent };
60 } catch (error) {
61 throw new PublisherError(getErrorMessage(error) || 'UnknownError');
62 }
63 };
64
65 return {
66 publish,

Callers

nothing calls this directly

Calls 4

generateProjectZipFunction · 0.90
isNodeProcessFunction · 0.90
writeZipToDiskFunction · 0.90
getErrorMessageFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…