schema.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.projectConfig = exports.dependencyConfig = void 0;
  6. function t() {
  7. const data = _interopRequireWildcard(require("@hapi/joi"));
  8. t = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
  14. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  15. const map = (key, value) => t().object().unknown(true).pattern(key, value);
  16. /**
  17. * Schema for CommandT
  18. */
  19. const command = t().object({
  20. name: t().string().required(),
  21. description: t().string(),
  22. usage: t().string(),
  23. func: t().func().required(),
  24. options: t().array().items(t().object({
  25. name: t().string().required(),
  26. description: t().string(),
  27. parse: t().func(),
  28. default: t().alternatives().try([t().bool(), t().number(), t().string().allow(''), t().func()])
  29. }).rename('command', 'name', {
  30. ignoreUndefined: true
  31. })),
  32. examples: t().array().items(t().object({
  33. desc: t().string().required(),
  34. cmd: t().string().required()
  35. }))
  36. });
  37. /**
  38. * Schema for UserDependencyConfigT
  39. */
  40. const dependencyConfig = t().object({
  41. dependency: t().object({
  42. platforms: map(t().string(), t().any()).keys({
  43. ios: t().object({
  44. project: t().string(),
  45. podspecPath: t().string(),
  46. sharedLibraries: t().array().items(t().string()),
  47. libraryFolder: t().string(),
  48. scriptPhases: t().array().items(t().object())
  49. }).default({}),
  50. android: t().object({
  51. sourceDir: t().string(),
  52. manifestPath: t().string(),
  53. packageImportPath: t().string(),
  54. packageInstance: t().string()
  55. }).default({})
  56. }).default(),
  57. assets: t().array().items(t().string()).default([]),
  58. hooks: map(t().string(), t().string()).default({}),
  59. params: t().array().items(t().object({
  60. name: t().string(),
  61. type: t().string(),
  62. message: t().string()
  63. })).default([])
  64. }).default(),
  65. platforms: map(t().string(), t().object({
  66. npmPackageName: t().string().optional(),
  67. dependencyConfig: t().func(),
  68. projectConfig: t().func(),
  69. linkConfig: t().func()
  70. })).default({}),
  71. commands: t().array().items(command).default([])
  72. }).unknown(true).default();
  73. /**
  74. * Schema for ProjectConfigT
  75. */
  76. exports.dependencyConfig = dependencyConfig;
  77. const projectConfig = t().object({
  78. dependencies: map(t().string(), t().object({
  79. root: t().string(),
  80. platforms: map(t().string(), t().any()).keys({
  81. ios: t().object({
  82. sourceDir: t().string(),
  83. folder: t().string(),
  84. pbxprojPath: t().string(),
  85. podfile: t().string(),
  86. podspecPath: t().string(),
  87. projectPath: t().string(),
  88. projectName: t().string(),
  89. libraryFolder: t().string(),
  90. sharedLibraries: t().array().items(t().string())
  91. }).allow(null),
  92. android: t().object({
  93. sourceDir: t().string(),
  94. folder: t().string(),
  95. packageImportPath: t().string(),
  96. packageInstance: t().string()
  97. }).allow(null)
  98. }),
  99. assets: t().array().items(t().string()),
  100. hooks: map(t().string(), t().string()),
  101. params: t().array().items(t().object({
  102. name: t().string(),
  103. type: t().string(),
  104. message: t().string()
  105. }))
  106. }).allow(null)).default({}),
  107. reactNativePath: t().string(),
  108. project: map(t().string(), t().any()).keys({
  109. ios: t().object({
  110. project: t().string(),
  111. sharedLibraries: t().array().items(t().string()),
  112. libraryFolder: t().string()
  113. }).default({}),
  114. android: t().object({
  115. sourceDir: t().string(),
  116. manifestPath: t().string(),
  117. packageName: t().string(),
  118. packageFolder: t().string(),
  119. mainFilePath: t().string(),
  120. stringsPath: t().string(),
  121. settingsGradlePath: t().string(),
  122. assetsPath: t().string(),
  123. buildGradlePath: t().string(),
  124. appName: t().string()
  125. }).default({})
  126. }).default(),
  127. assets: t().array().items(t().string()).default([]),
  128. commands: t().array().items(command).default([]),
  129. platforms: map(t().string(), t().object({
  130. npmPackageName: t().string().optional(),
  131. dependencyConfig: t().func(),
  132. projectConfig: t().func(),
  133. linkConfig: t().func()
  134. })).default({})
  135. }).unknown(true).default();
  136. exports.projectConfig = projectConfig;
  137. //# sourceMappingURL=schema.js.map