index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. exports.configs = {
  3. '*': {
  4. hooks: './builder/hooks.js',
  5. options: {
  6. enabled: {
  7. label: '启用热更新',
  8. description: '仅适用于 Android、iOS、Windows、macOS 等原生平台。开启后将在构建完成时生成热更新资源包。',
  9. default: false,
  10. render: {
  11. ui: 'ui-checkbox',
  12. },
  13. },
  14. remoteUrl: {
  15. label: '热更新 URL',
  16. description: '远端热更新资源根地址。构建工具会自动补齐末尾的 /,并生成 project.manifest 与 version.manifest 地址。',
  17. default: 'http://127.0.0.1:7879/',
  18. render: {
  19. ui: 'ui-input',
  20. attributes: {
  21. placeholder: 'https://cdn.example.com/game/android/1.0.0/',
  22. },
  23. },
  24. verifyRules: ['http'],
  25. },
  26. version: {
  27. label: '热更新版本',
  28. description: '资源版本号,支持 1.0、1.0.0 或 1.0.0.0 格式。新版本必须大于客户端本地版本。',
  29. default: '1.0.0',
  30. render: {
  31. ui: 'ui-input',
  32. attributes: {
  33. placeholder: '1.0.0',
  34. },
  35. },
  36. verifyRules: ['hotUpdateVersion'],
  37. },
  38. },
  39. verifyRuleMap: {
  40. hotUpdateVersion: {
  41. message: '热更新版本必须为 1.0、1.0.0 或 1.0.0.0 格式。',
  42. func(value) {
  43. return /^\d+(?:\.\d+){1,3}$/.test(String(value || '').trim());
  44. },
  45. },
  46. },
  47. },
  48. };