message: CLI - build wasm & plugin support refactor WIP
diff: @@ -167,6 +167,8 @@ async function run(options: BuildCommandOptions) {
  client,
  });
  + let execute: () => Promise<Boolean>;
  +
  if (isPolywrapManifestLanguage(language)) {
  await validateManifestModules(manifest as PolywrapManifest);
  @@ -176,7 +178,7 @@ async function run(options: BuildCommandOptions) {
  project as PolywrapProject
  );
  - const execute = async (): Promise<boolean> => {
  + execute = async (): Promise<boolean> => {
  const compiler = new Compiler({
  project: project as PolywrapProject,
  outputDir,
  @@ -192,6 +194,29 @@ async function run(options: BuildCommandOptions) {
  return true;
  };
  + } else if (isPluginManifestLanguage(language)) {
  + execute = async (): Promise<boolean> => {
  + // Output the built manifest
  + const manifestPath = path.join(outputDir, "wrap.info");
  +
  + if (!fs.existsSync(outputDir)) {
  + fs.mkdirSync(outputDir);
  + }
  +
  + await generateWrapFile(
  + await schemaComposer.getComposedAbis(),
  + await project.getName(),
  + "plugin",
  + manifestPath,
  + logger
  + );
  +
  + return true;
  + };
  + } else {
  + console.log("Unsupported project type!");
  + return;
  + }
  if (!watch) {
  const result = await execute();
  @@ -199,6 +224,8 @@ async function run(options: BuildCommandOptions) {
  if (!result) {
  process.exit(1);
  }
  +
  + process.exit(0);
  } else {
  // Execute
  await execute();
  @@ -250,24 +277,4 @@ async function run(options: BuildCommandOptions) {
  },
  });
  }
  - } else if (isPluginManifestLanguage(language)){
  - // Output the built manifest
  - const manifestPath = path.join(outputDir, "wrap.info");
  -
  - if (!fs.existsSync(outputDir)) {
  - fs.mkdirSync(outputDir);
  - }
  -
  - await generateWrapFile(
  - await schemaComposer.getComposedAbis(),
  - await project.getName(),
  - "plugin",
  - manifestPath,
  - logger
  - );
  - } else {
  - console.log("Unsupported project type!");
  - }
  -
  - process.exit(0);
  }
  