Home Reference Source

cables_dev/cables_electron/src/export/export_patch_electron.js

  1. import sanitizeFileName from "sanitize-filename";
  2. import path from "path";
  3. import { fileURLToPath } from "url";
  4. import HtmlExportElectron from "./export_html_electron.js";
  5. export default class PatchExportElectron extends HtmlExportElectron
  6. {
  7. constructor(provider, _exportOptions, user)
  8. {
  9. super(provider, {}, user);
  10. this.options.combineJS = false;
  11. this.options.addOpCode = true;
  12. this.options.removeIndexHtml = true;
  13. this.options.rewriteAssetPorts = true;
  14. this.options.flattenAssetNames = false;
  15. this.options.handleAssets = "auto";
  16. this.options.assetsInSubdirs = true;
  17. this.finalAssetPath = "assets/";
  18. this.finalJsPath = "/";
  19. }
  20. static getName()
  21. {
  22. return "patch";
  23. }
  24. _replaceInString(replacements, theString)
  25. {
  26. return theString;
  27. }
  28. _addProjectHtmlCode(proj, options, libs, coreLibs, template = "/patchview/patchview_export.html", _dependencies = [])
  29. {
  30. const projectName = sanitizeFileName(proj.name).replace(/ /g, "_");
  31. const projectNameVer = projectName + proj.exports;
  32. this.append(JSON.stringify(proj), { "name": projectNameVer + ".cables" });
  33. }
  34. _getOpExportSubdir(opName)
  35. {
  36. return path.join("ops", this._opsUtil.getOpTargetDir(opName, true));
  37. }
  38. static getExportOptions(user, teams, project, exportQuota)
  39. {
  40. return {
  41. "type": this.getName(),
  42. "allowed": true,
  43. "possible": true,
  44. "fields": {}
  45. };
  46. }
  47. }