forge.config.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import type { ForgeConfig } from "@electron-forge/shared-types";
  2. import { MakerZIP } from "@electron-forge/maker-zip";
  3. import { MakerDeb } from "@electron-forge/maker-deb";
  4. import { MakerDMG } from "@electron-forge/maker-dmg";
  5. import { WebpackPlugin } from "@electron-forge/plugin-webpack";
  6. import { mainConfig } from "./config/webpack.main.config";
  7. import { rendererConfig } from "./config/webpack.renderer.config";
  8. import path from "path";
  9. const config: ForgeConfig = {
  10. packagerConfig: {
  11. appBundleId: "fun.upup.musicfree",
  12. icon: path.resolve(__dirname, "res/logo"),
  13. executableName: "MusicFree",
  14. extraResource: [path.resolve(__dirname, "res")],
  15. protocols: [
  16. {
  17. name: "MusicFree",
  18. schemes: ["musicfree"],
  19. },
  20. ],
  21. },
  22. rebuildConfig: {},
  23. makers: [
  24. // new MakerSquirrel({
  25. // exe: "MusicFree",
  26. // setupIcon: path.resolve(__dirname, "resources/logo.ico"),
  27. // setupMsi: "MusicFreeInstaller",
  28. // }),
  29. new MakerZIP({}, ["darwin"]),
  30. new MakerDMG(
  31. {
  32. // background
  33. format: "ULFO",
  34. },
  35. ["darwin"]
  36. ),
  37. // new MakerRpm({}),
  38. new MakerDeb({
  39. options: {
  40. name: "MusicFree",
  41. bin: "MusicFree",
  42. mimeType: ["x-scheme-handler/musicfree"],
  43. },
  44. }),
  45. ],
  46. plugins: [
  47. new WebpackPlugin({
  48. devContentSecurityPolicy: `default-src * self blob: data: gap: file:; style-src * self 'unsafe-inline' blob: data: gap: file:; script-src * 'self' 'unsafe-eval' 'unsafe-inline' blob: data: gap: file:; object-src * 'self' blob: data: gap:; img-src * self 'unsafe-inline' blob: data: gap: file:; connect-src self * 'unsafe-inline' blob: data: gap:; frame-src * self blob: data: gap:;`,
  49. mainConfig,
  50. renderer: {
  51. config: rendererConfig,
  52. entryPoints: [
  53. {
  54. html: "./src/renderer/document/index.html",
  55. js: "./src/renderer/document/index.tsx",
  56. name: "main_window",
  57. preload: {
  58. js: "./src/preload/index.ts",
  59. },
  60. },
  61. {
  62. html: "./src/renderer-lrc/document/index.html",
  63. js: "./src/renderer-lrc/document/index.tsx",
  64. name: "lrc_window",
  65. preload: {
  66. js: "./src/preload/extension.ts",
  67. },
  68. },
  69. {
  70. html: "./src/renderer-minimode/document/index.html",
  71. js: "./src/renderer-minimode/document/index.tsx",
  72. name: "minimode_window",
  73. preload: {
  74. js: "./src/preload/extension.ts",
  75. },
  76. },
  77. /** webworkers */
  78. {
  79. js: "./src/webworkers/downloader.ts",
  80. name: "worker_downloader",
  81. nodeIntegration: true,
  82. },
  83. {
  84. js: "./src/webworkers/local-file-watcher.ts",
  85. name: "local_file_watcher",
  86. nodeIntegration: true,
  87. },
  88. {
  89. js: "./src/webworkers/db-worker.ts",
  90. name: "db",
  91. nodeIntegration: true,
  92. },
  93. ],
  94. },
  95. }),
  96. {
  97. name: "@timfish/forge-externals-plugin",
  98. config: {
  99. externals: ["sharp"],
  100. includeDeps: true,
  101. },
  102. },
  103. ],
  104. };
  105. export default config;