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