oc 0.49.13 → 0.49.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/.github/workflows/node.js.yml +1 -1
  2. package/.husky/pre-commit +1 -1
  3. package/.nvmrc +1 -1
  4. package/CHANGELOG.md +11 -1
  5. package/dist/cli/commands.d.ts +163 -163
  6. package/dist/cli/commands.js +162 -162
  7. package/dist/cli/domain/clean.d.ts +2 -2
  8. package/dist/cli/domain/clean.js +24 -24
  9. package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
  10. package/dist/cli/domain/get-components-by-dir.js +41 -41
  11. package/dist/cli/domain/get-mocked-plugins.d.ts +10 -10
  12. package/dist/cli/domain/get-mocked-plugins.js +89 -89
  13. package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +6 -6
  14. package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +16 -16
  15. package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +10 -10
  16. package/dist/cli/domain/handle-dependencies/get-compiler.js +28 -28
  17. package/dist/cli/domain/handle-dependencies/get-missing-dependencies.d.ts +1 -1
  18. package/dist/cli/domain/handle-dependencies/get-missing-dependencies.js +18 -18
  19. package/dist/cli/domain/handle-dependencies/index.d.ts +10 -10
  20. package/dist/cli/domain/handle-dependencies/index.js +70 -70
  21. package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +8 -8
  22. package/dist/cli/domain/handle-dependencies/install-compiler.js +58 -54
  23. package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +5 -5
  24. package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +63 -59
  25. package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +6 -6
  26. package/dist/cli/domain/handle-dependencies/link-missing-dependencies.js +32 -32
  27. package/dist/cli/domain/handle-dependencies/require-template.d.ts +17 -17
  28. package/dist/cli/domain/handle-dependencies/require-template.js +34 -34
  29. package/dist/cli/domain/init-template/index.d.ts +10 -10
  30. package/dist/cli/domain/init-template/index.js +44 -40
  31. package/dist/cli/domain/init-template/install-template.d.ts +11 -11
  32. package/dist/cli/domain/init-template/install-template.js +58 -54
  33. package/dist/cli/domain/init-template/scaffold.d.ts +11 -11
  34. package/dist/cli/domain/init-template/scaffold.js +30 -30
  35. package/dist/cli/domain/local.d.ts +21 -2
  36. package/dist/cli/domain/local.js +86 -82
  37. package/dist/cli/domain/mock.d.ts +5 -5
  38. package/dist/cli/domain/mock.js +33 -33
  39. package/dist/cli/domain/package-components.d.ts +9 -9
  40. package/dist/cli/domain/package-components.js +71 -67
  41. package/dist/cli/domain/registry.d.ts +20 -6
  42. package/dist/cli/domain/registry.js +143 -139
  43. package/dist/cli/domain/url-parser.d.ts +14 -14
  44. package/dist/cli/domain/url-parser.js +31 -31
  45. package/dist/cli/domain/watch.d.ts +1 -1
  46. package/dist/cli/domain/watch.js +29 -29
  47. package/dist/cli/facade/clean.d.ts +16 -16
  48. package/dist/cli/facade/clean.js +58 -58
  49. package/dist/cli/facade/dev.d.ts +114 -114
  50. package/dist/cli/facade/dev.js +180 -176
  51. package/dist/cli/facade/init.d.ts +18 -18
  52. package/dist/cli/facade/init.js +39 -39
  53. package/dist/cli/facade/mock.d.ts +18 -18
  54. package/dist/cli/facade/mock.js +12 -12
  55. package/dist/cli/facade/package.d.ts +19 -18
  56. package/dist/cli/facade/package.js +49 -49
  57. package/dist/cli/facade/preview.d.ts +14 -14
  58. package/dist/cli/facade/preview.js +20 -20
  59. package/dist/cli/facade/publish.d.ts +24 -23
  60. package/dist/cli/facade/publish.js +145 -145
  61. package/dist/cli/facade/registry-add.d.ts +14 -14
  62. package/dist/cli/facade/registry-add.js +18 -18
  63. package/dist/cli/facade/registry-ls.d.ts +10 -10
  64. package/dist/cli/facade/registry-ls.js +27 -27
  65. package/dist/cli/facade/registry-remove.d.ts +14 -14
  66. package/dist/cli/facade/registry-remove.js +18 -18
  67. package/dist/cli/facade/registry.d.ts +5 -5
  68. package/dist/cli/facade/registry.js +9 -9
  69. package/dist/cli/index.d.ts +1 -1
  70. package/dist/cli/index.js +91 -91
  71. package/dist/cli/logger.d.ts +8 -8
  72. package/dist/cli/logger.js +19 -19
  73. package/dist/cli/programmatic-api.d.ts +84 -84
  74. package/dist/cli/programmatic-api.js +66 -66
  75. package/dist/cli/validate-command.d.ts +2 -2
  76. package/dist/cli/validate-command.js +18 -18
  77. package/dist/components/oc-client/_package/package.json +1 -1
  78. package/dist/components/oc-client/_package/src/oc-client.min.js +2 -2
  79. package/dist/components/oc-client/_package/src/oc-client.min.map +1 -1
  80. package/dist/components/oc-client/package.json +1 -1
  81. package/dist/components/oc-client/src/oc-client.min.js +2 -2
  82. package/dist/components/oc-client/src/oc-client.min.map +1 -1
  83. package/dist/index.d.ts +3 -3
  84. package/dist/index.js +12 -12
  85. package/dist/oc-cli.d.ts +2 -2
  86. package/dist/oc-cli.js +3 -3
  87. package/dist/registry/app-start.d.ts +3 -2
  88. package/dist/registry/app-start.js +44 -44
  89. package/dist/registry/domain/authentication.d.ts +7 -7
  90. package/dist/registry/domain/authentication.js +53 -53
  91. package/dist/registry/domain/components-cache/components-list.d.ts +8 -8
  92. package/dist/registry/domain/components-cache/components-list.js +50 -50
  93. package/dist/registry/domain/components-cache/index.d.ts +7 -7
  94. package/dist/registry/domain/components-cache/index.js +76 -76
  95. package/dist/registry/domain/components-details.d.ts +6 -6
  96. package/dist/registry/domain/components-details.js +64 -64
  97. package/dist/registry/domain/events-handler.d.ts +40 -40
  98. package/dist/registry/domain/events-handler.js +37 -37
  99. package/dist/registry/domain/extract-package.d.ts +8 -8
  100. package/dist/registry/domain/extract-package.js +30 -26
  101. package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +2 -2
  102. package/dist/registry/domain/get-package-json-from-temp-dir.js +11 -11
  103. package/dist/registry/domain/nested-renderer.d.ts +14 -14
  104. package/dist/registry/domain/nested-renderer.js +59 -59
  105. package/dist/registry/domain/options-sanitiser.d.ts +6 -6
  106. package/dist/registry/domain/options-sanitiser.js +113 -106
  107. package/dist/registry/domain/plugins-initialiser.d.ts +3 -3
  108. package/dist/registry/domain/plugins-initialiser.js +95 -95
  109. package/dist/registry/domain/register-templates.d.ts +5 -5
  110. package/dist/registry/domain/register-templates.js +37 -30
  111. package/dist/registry/domain/repository.d.ts +22 -2
  112. package/dist/registry/domain/repository.js +241 -237
  113. package/dist/registry/domain/require-wrapper.d.ts +2 -2
  114. package/dist/registry/domain/require-wrapper.js +33 -33
  115. package/dist/registry/domain/sanitiser.d.ts +2 -2
  116. package/dist/registry/domain/sanitiser.js +52 -52
  117. package/dist/registry/domain/storage-adapter.d.ts +10 -10
  118. package/dist/registry/domain/storage-adapter.js +55 -55
  119. package/dist/registry/domain/url-builder.d.ts +10 -10
  120. package/dist/registry/domain/url-builder.js +60 -60
  121. package/dist/registry/domain/validators/component-parameters.d.ts +11 -11
  122. package/dist/registry/domain/validators/component-parameters.js +79 -79
  123. package/dist/registry/domain/validators/index.d.ts +16 -16
  124. package/dist/registry/domain/validators/index.js +29 -29
  125. package/dist/registry/domain/validators/node-version.d.ts +15 -15
  126. package/dist/registry/domain/validators/node-version.js +40 -40
  127. package/dist/registry/domain/validators/oc-cli-version.d.ts +15 -15
  128. package/dist/registry/domain/validators/oc-cli-version.js +34 -34
  129. package/dist/registry/domain/validators/package-json-validator.d.ts +13 -13
  130. package/dist/registry/domain/validators/package-json-validator.js +23 -23
  131. package/dist/registry/domain/validators/plugins-requirements.d.ts +9 -9
  132. package/dist/registry/domain/validators/plugins-requirements.js +22 -22
  133. package/dist/registry/domain/validators/registry-configuration.d.ts +9 -9
  134. package/dist/registry/domain/validators/registry-configuration.js +117 -113
  135. package/dist/registry/domain/validators/uploaded-package.d.ts +14 -14
  136. package/dist/registry/domain/validators/uploaded-package.js +25 -25
  137. package/dist/registry/domain/version-handler.d.ts +2 -2
  138. package/dist/registry/domain/version-handler.js +22 -22
  139. package/dist/registry/index.d.ts +48 -48
  140. package/dist/registry/index.js +110 -107
  141. package/dist/registry/middleware/base-url-handler.d.ts +2 -2
  142. package/dist/registry/middleware/base-url-handler.js +12 -12
  143. package/dist/registry/middleware/cors.d.ts +2 -2
  144. package/dist/registry/middleware/cors.js +11 -11
  145. package/dist/registry/middleware/discovery-handler.d.ts +2 -2
  146. package/dist/registry/middleware/discovery-handler.js +15 -15
  147. package/dist/registry/middleware/file-uploads.d.ts +2 -2
  148. package/dist/registry/middleware/file-uploads.js +23 -23
  149. package/dist/registry/middleware/index.d.ts +3 -3
  150. package/dist/registry/middleware/index.js +48 -48
  151. package/dist/registry/middleware/request-handler.d.ts +2 -2
  152. package/dist/registry/middleware/request-handler.js +30 -30
  153. package/dist/registry/router.d.ts +4 -3
  154. package/dist/registry/router.js +56 -56
  155. package/dist/registry/routes/component-info.d.ts +4 -3
  156. package/dist/registry/routes/component-info.js +94 -90
  157. package/dist/registry/routes/component-preview.d.ts +4 -3
  158. package/dist/registry/routes/component-preview.js +72 -68
  159. package/dist/registry/routes/component.d.ts +4 -3
  160. package/dist/registry/routes/component.js +43 -43
  161. package/dist/registry/routes/components.d.ts +4 -3
  162. package/dist/registry/routes/components.js +78 -78
  163. package/dist/registry/routes/dependencies.d.ts +3 -3
  164. package/dist/registry/routes/dependencies.js +28 -28
  165. package/dist/registry/routes/helpers/apply-default-values.d.ts +2 -2
  166. package/dist/registry/routes/helpers/apply-default-values.js +13 -13
  167. package/dist/registry/routes/helpers/get-available-dependencies.d.ts +8 -8
  168. package/dist/registry/routes/helpers/get-available-dependencies.js +24 -24
  169. package/dist/registry/routes/helpers/get-component-fallback.d.ts +17 -17
  170. package/dist/registry/routes/helpers/get-component-fallback.js +95 -91
  171. package/dist/registry/routes/helpers/get-component-retrieving-info.d.ts +20 -20
  172. package/dist/registry/routes/helpers/get-component-retrieving-info.js +24 -24
  173. package/dist/registry/routes/helpers/get-component.d.ts +34 -33
  174. package/dist/registry/routes/helpers/get-component.js +410 -406
  175. package/dist/registry/routes/helpers/get-components-history.d.ts +8 -8
  176. package/dist/registry/routes/helpers/get-components-history.js +28 -28
  177. package/dist/registry/routes/helpers/is-url-discoverable.d.ts +3 -3
  178. package/dist/registry/routes/helpers/is-url-discoverable.js +22 -22
  179. package/dist/registry/routes/index.d.ts +3 -3
  180. package/dist/registry/routes/index.js +93 -93
  181. package/dist/registry/routes/plugins.d.ts +3 -3
  182. package/dist/registry/routes/plugins.js +17 -17
  183. package/dist/registry/routes/publish.d.ts +3 -3
  184. package/dist/registry/routes/publish.js +101 -97
  185. package/dist/registry/routes/static-redirector.d.ts +3 -3
  186. package/dist/registry/routes/static-redirector.js +86 -63
  187. package/dist/registry/views/index.d.ts +2 -2
  188. package/dist/registry/views/index.js +39 -39
  189. package/dist/registry/views/info.d.ts +16 -16
  190. package/dist/registry/views/info.js +39 -39
  191. package/dist/registry/views/partials/component-author.d.ts +8 -8
  192. package/dist/registry/views/partials/component-author.js +20 -20
  193. package/dist/registry/views/partials/component-parameters.d.ts +5 -5
  194. package/dist/registry/views/partials/component-parameters.js +24 -24
  195. package/dist/registry/views/partials/component-state.d.ts +5 -5
  196. package/dist/registry/views/partials/component-state.js +6 -6
  197. package/dist/registry/views/partials/component-versions.d.ts +5 -5
  198. package/dist/registry/views/partials/component-versions.js +9 -9
  199. package/dist/registry/views/partials/components-dependencies.d.ts +2 -2
  200. package/dist/registry/views/partials/components-dependencies.js +12 -12
  201. package/dist/registry/views/partials/components-history.d.ts +2 -2
  202. package/dist/registry/views/partials/components-history.js +10 -10
  203. package/dist/registry/views/partials/components-list.d.ts +2 -2
  204. package/dist/registry/views/partials/components-list.js +26 -26
  205. package/dist/registry/views/partials/components-plugins.d.ts +2 -2
  206. package/dist/registry/views/partials/components-plugins.js +8 -8
  207. package/dist/registry/views/partials/components-templates.d.ts +2 -2
  208. package/dist/registry/views/partials/components-templates.js +14 -14
  209. package/dist/registry/views/partials/layout.d.ts +8 -8
  210. package/dist/registry/views/partials/layout.js +11 -11
  211. package/dist/registry/views/partials/property.d.ts +2 -2
  212. package/dist/registry/views/partials/property.js +11 -11
  213. package/dist/registry/views/partials/selected-checkbox.d.ts +4 -4
  214. package/dist/registry/views/partials/selected-checkbox.js +7 -7
  215. package/dist/registry/views/preview.d.ts +8 -8
  216. package/dist/registry/views/preview.js +9 -9
  217. package/dist/registry/views/static/index.d.ts +2 -2
  218. package/dist/registry/views/static/index.js +3 -3
  219. package/dist/registry/views/static/info.d.ts +2 -2
  220. package/dist/registry/views/static/info.js +3 -3
  221. package/dist/registry/views/static/style.d.ts +2 -2
  222. package/dist/registry/views/static/style.js +3 -3
  223. package/dist/resources/index.d.ts +134 -134
  224. package/dist/resources/index.js +145 -145
  225. package/dist/resources/settings.d.ts +17 -17
  226. package/dist/resources/settings.js +18 -18
  227. package/dist/types.d.ts +229 -287
  228. package/dist/types.js +2 -2
  229. package/dist/utils/clean-require.d.ts +16 -16
  230. package/dist/utils/clean-require.js +18 -18
  231. package/dist/utils/date-stringify.d.ts +1 -1
  232. package/dist/utils/date-stringify.js +22 -22
  233. package/dist/utils/error-to-string.d.ts +1 -1
  234. package/dist/utils/error-to-string.js +15 -15
  235. package/dist/utils/is-template-legacy.d.ts +3 -3
  236. package/dist/utils/is-template-legacy.js +6 -6
  237. package/dist/utils/is-template-valid.d.ts +4 -4
  238. package/dist/utils/is-template-valid.js +12 -12
  239. package/dist/utils/module-exists.d.ts +1 -1
  240. package/dist/utils/module-exists.js +15 -15
  241. package/dist/utils/npm-utils.d.ts +20 -20
  242. package/dist/utils/npm-utils.js +74 -74
  243. package/dist/utils/put.d.ts +2 -2
  244. package/dist/utils/put.js +29 -29
  245. package/dist/utils/strip-version.d.ts +1 -1
  246. package/dist/utils/strip-version.js +11 -11
  247. package/logintervals.md +1 -1
  248. package/package.json +34 -40
  249. package/src/cli/domain/local.ts +12 -5
  250. package/src/cli/domain/package-components.ts +1 -1
  251. package/src/cli/domain/registry.ts +10 -8
  252. package/src/cli/facade/clean.ts +1 -1
  253. package/src/cli/facade/dev.ts +1 -1
  254. package/src/cli/facade/init.ts +1 -1
  255. package/src/cli/facade/mock.ts +1 -1
  256. package/src/cli/facade/package.ts +2 -1
  257. package/src/cli/facade/preview.ts +1 -1
  258. package/src/cli/facade/publish.ts +3 -1
  259. package/src/cli/facade/registry-add.ts +1 -1
  260. package/src/cli/facade/registry-ls.ts +1 -1
  261. package/src/cli/facade/registry-remove.ts +1 -1
  262. package/src/cli/programmatic-api.ts +2 -3
  263. package/src/components/oc-client/_package/package.json +1 -1
  264. package/src/components/oc-client/_package/src/oc-client.min.js +2 -2
  265. package/src/components/oc-client/_package/src/oc-client.min.map +1 -1
  266. package/src/components/oc-client/package.json +1 -1
  267. package/src/components/oc-client/src/oc-client.min.js +2 -2
  268. package/src/components/oc-client/src/oc-client.min.map +1 -1
  269. package/src/oc-cli.js +0 -0
  270. package/src/registry/app-start.ts +2 -1
  271. package/src/registry/domain/components-cache/components-list.ts +2 -2
  272. package/src/registry/domain/extract-package.ts +7 -2
  273. package/src/registry/domain/options-sanitiser.ts +4 -0
  274. package/src/registry/domain/register-templates.ts +12 -2
  275. package/src/registry/domain/repository.ts +42 -17
  276. package/src/registry/domain/storage-adapter.ts +7 -7
  277. package/src/registry/index.ts +4 -1
  278. package/src/registry/router.ts +2 -1
  279. package/src/registry/routes/component-info.ts +2 -1
  280. package/src/registry/routes/component-preview.ts +2 -1
  281. package/src/registry/routes/component.ts +2 -1
  282. package/src/registry/routes/components.ts +2 -1
  283. package/src/registry/routes/helpers/get-component.ts +2 -1
  284. package/src/registry/routes/index.ts +2 -1
  285. package/src/registry/routes/publish.ts +3 -3
  286. package/src/registry/routes/static-redirector.ts +3 -3
  287. package/src/types.ts +2 -86
@@ -1,30 +1,30 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_extra_1 = __importDefault(require("fs-extra"));
7
- const path_1 = __importDefault(require("path"));
8
- const resources_1 = __importDefault(require("../../../resources"));
9
- async function scaffold(options) {
10
- const { compiler, compilerPath, componentName, componentPath, templateType } = options;
11
- const baseComponentPath = path_1.default.join(compilerPath, 'scaffold');
12
- const baseComponentFiles = path_1.default.join(baseComponentPath, 'src');
13
- const compilerPackage = await fs_extra_1.default.readJson(path_1.default.join(compilerPath, 'package.json'));
14
- try {
15
- await fs_extra_1.default.copy(baseComponentFiles, componentPath);
16
- const componentPackage = await fs_extra_1.default.readJson(path_1.default.join(componentPath, 'package.json'));
17
- componentPackage.name = componentName;
18
- componentPackage.devDependencies[compiler] = compilerPackage.version;
19
- await fs_extra_1.default.writeJson(componentPath + '/package.json', componentPackage, {
20
- spaces: 2
21
- });
22
- return { ok: true };
23
- }
24
- catch (error) {
25
- const url = (compilerPackage.bugs && compilerPackage.bugs.url) ||
26
- `the ${templateType} repo`;
27
- throw resources_1.default.errors.cli.scaffoldError(url, String(error));
28
- }
29
- }
30
- exports.default = scaffold;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_extra_1 = __importDefault(require("fs-extra"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const resources_1 = __importDefault(require("../../../resources"));
9
+ async function scaffold(options) {
10
+ const { compiler, compilerPath, componentName, componentPath, templateType } = options;
11
+ const baseComponentPath = path_1.default.join(compilerPath, 'scaffold');
12
+ const baseComponentFiles = path_1.default.join(baseComponentPath, 'src');
13
+ const compilerPackage = await fs_extra_1.default.readJson(path_1.default.join(compilerPath, 'package.json'));
14
+ try {
15
+ await fs_extra_1.default.copy(baseComponentFiles, componentPath);
16
+ const componentPackage = await fs_extra_1.default.readJson(path_1.default.join(componentPath, 'package.json'));
17
+ componentPackage.name = componentName;
18
+ componentPackage.devDependencies[compiler] = compilerPackage.version;
19
+ await fs_extra_1.default.writeJson(componentPath + '/package.json', componentPackage, {
20
+ spaces: 2
21
+ });
22
+ return { ok: true };
23
+ }
24
+ catch (error) {
25
+ const url = (compilerPackage.bugs && compilerPackage.bugs.url) ||
26
+ `the ${templateType} repo`;
27
+ throw resources_1.default.errors.cli.scaffoldError(url, String(error));
28
+ }
29
+ }
30
+ exports.default = scaffold;
@@ -1,2 +1,21 @@
1
- import { Local } from '../../types';
2
- export default function local(): Local;
1
+ import * as clean from './clean';
2
+ import { Logger } from '../logger';
3
+ export default function local(): {
4
+ clean: typeof clean;
5
+ cleanup(compressedPackagePath: string): Promise<void>;
6
+ compress(input: string, output: string): Promise<void>;
7
+ getComponentsByDir: (componentsDir: string, componentsToRun?: string[] | undefined) => Promise<string[]>;
8
+ init(options: {
9
+ componentName: string;
10
+ logger: Logger;
11
+ componentPath: string;
12
+ templateType: string;
13
+ }): Promise<void>;
14
+ mock: (params: {
15
+ targetType: string;
16
+ targetValue: string;
17
+ targetName: string;
18
+ }) => Promise<void>;
19
+ package: (options: import("./package-components").PackageOptions) => Promise<import("../../types").Component>;
20
+ };
21
+ export declare type Local = ReturnType<typeof local>;
@@ -1,82 +1,86 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- const fs_extra_1 = __importDefault(require("fs-extra"));
26
- const targz_1 = __importDefault(require("targz"));
27
- const util_1 = require("util");
28
- const clean = __importStar(require("./clean"));
29
- const get_components_by_dir_1 = __importDefault(require("./get-components-by-dir"));
30
- const init_template_1 = __importDefault(require("./init-template"));
31
- const is_template_legacy_1 = __importDefault(require("../../utils/is-template-legacy"));
32
- const mock_1 = __importDefault(require("./mock"));
33
- const package_components_1 = __importDefault(require("./package-components"));
34
- const resources_1 = __importDefault(require("../../resources"));
35
- const validator = __importStar(require("../../registry/domain/validators"));
36
- function local() {
37
- return {
38
- clean,
39
- cleanup(compressedPackagePath) {
40
- return fs_extra_1.default.unlink(compressedPackagePath);
41
- },
42
- compress(input, output) {
43
- return (0, util_1.promisify)(targz_1.default.compress)({
44
- src: input,
45
- dest: output,
46
- tar: {
47
- map: function (file) {
48
- return Object.assign(file, {
49
- name: `_package/${file.name}`
50
- });
51
- }
52
- }
53
- });
54
- },
55
- getComponentsByDir: (0, get_components_by_dir_1.default)(),
56
- async init(options) {
57
- const { componentName, logger } = options;
58
- let { templateType } = options;
59
- if (!validator.validateComponentName(componentName)) {
60
- throw 'name not valid';
61
- }
62
- // LEGACY TEMPLATES WARNING
63
- if ((0, is_template_legacy_1.default)(templateType)) {
64
- const legacyName = templateType;
65
- templateType = legacyName.replace(legacyName, `oc-template-${legacyName}`);
66
- logger.warn(resources_1.default.messages.cli.legacyTemplateDeprecationWarning(legacyName, templateType));
67
- }
68
- try {
69
- await (0, init_template_1.default)(Object.assign(options, {
70
- templateType,
71
- compiler: `${templateType}-compiler`
72
- }));
73
- }
74
- catch (e) {
75
- throw 'template type not valid';
76
- }
77
- },
78
- mock: (0, mock_1.default)(),
79
- package: (0, package_components_1.default)()
80
- };
81
- }
82
- exports.default = local;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const fs_extra_1 = __importDefault(require("fs-extra"));
30
+ const targz_1 = __importDefault(require("targz"));
31
+ const util_1 = require("util");
32
+ const clean = __importStar(require("./clean"));
33
+ const get_components_by_dir_1 = __importDefault(require("./get-components-by-dir"));
34
+ const init_template_1 = __importDefault(require("./init-template"));
35
+ const is_template_legacy_1 = __importDefault(require("../../utils/is-template-legacy"));
36
+ const mock_1 = __importDefault(require("./mock"));
37
+ const package_components_1 = __importDefault(require("./package-components"));
38
+ const resources_1 = __importDefault(require("../../resources"));
39
+ const validator = __importStar(require("../../registry/domain/validators"));
40
+ function local() {
41
+ return {
42
+ clean,
43
+ cleanup(compressedPackagePath) {
44
+ return fs_extra_1.default.unlink(compressedPackagePath);
45
+ },
46
+ compress(input, output) {
47
+ return (0, util_1.promisify)(targz_1.default.compress)({
48
+ src: input,
49
+ dest: output,
50
+ tar: {
51
+ map: function (file) {
52
+ return Object.assign(file, {
53
+ name: `_package/${file.name}`
54
+ });
55
+ }
56
+ }
57
+ });
58
+ },
59
+ getComponentsByDir: (0, get_components_by_dir_1.default)(),
60
+ async init(options) {
61
+ const { componentName, logger } = options;
62
+ let { templateType } = options;
63
+ if (!validator.validateComponentName(componentName)) {
64
+ throw 'name not valid';
65
+ }
66
+ // LEGACY TEMPLATES WARNING
67
+ if ((0, is_template_legacy_1.default)(templateType)) {
68
+ const legacyName = templateType;
69
+ templateType = legacyName.replace(legacyName, `oc-template-${legacyName}`);
70
+ logger.warn(resources_1.default.messages.cli.legacyTemplateDeprecationWarning(legacyName, templateType));
71
+ }
72
+ try {
73
+ await (0, init_template_1.default)(Object.assign(options, {
74
+ templateType,
75
+ compiler: `${templateType}-compiler`
76
+ }));
77
+ }
78
+ catch (e) {
79
+ throw 'template type not valid';
80
+ }
81
+ },
82
+ mock: (0, mock_1.default)(),
83
+ package: (0, package_components_1.default)()
84
+ };
85
+ }
86
+ exports.default = local;
@@ -1,5 +1,5 @@
1
- export default function mock(): (params: {
2
- targetType: string;
3
- targetValue: string;
4
- targetName: string;
5
- }) => Promise<void>;
1
+ export default function mock(): (params: {
2
+ targetType: string;
3
+ targetValue: string;
4
+ targetName: string;
5
+ }) => Promise<void>;
@@ -1,33 +1,33 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_extra_1 = __importDefault(require("fs-extra"));
7
- const path_1 = __importDefault(require("path"));
8
- const settings_1 = __importDefault(require("../../resources/settings"));
9
- function mock() {
10
- return async function (params) {
11
- const localConfig = await fs_extra_1.default
12
- .readJson(settings_1.default.configFile.src)
13
- .catch(() => ({}));
14
- const mockType = params.targetType + 's';
15
- if (!localConfig.mocks) {
16
- localConfig.mocks = {};
17
- }
18
- if (!localConfig.mocks[mockType]) {
19
- localConfig.mocks[mockType] = {};
20
- }
21
- let pluginType = 'static';
22
- if (fs_extra_1.default.existsSync(path_1.default.resolve(params.targetValue.toString()))) {
23
- pluginType = 'dynamic';
24
- }
25
- if (!localConfig.mocks[mockType][pluginType]) {
26
- localConfig.mocks[mockType][pluginType] = {};
27
- }
28
- localConfig.mocks[mockType][pluginType][params.targetName] =
29
- params.targetValue;
30
- return fs_extra_1.default.writeJson(settings_1.default.configFile.src, localConfig, { spaces: 2 });
31
- };
32
- }
33
- exports.default = mock;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_extra_1 = __importDefault(require("fs-extra"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const settings_1 = __importDefault(require("../../resources/settings"));
9
+ function mock() {
10
+ return async function (params) {
11
+ const localConfig = await fs_extra_1.default
12
+ .readJson(settings_1.default.configFile.src)
13
+ .catch(() => ({}));
14
+ const mockType = params.targetType + 's';
15
+ if (!localConfig.mocks) {
16
+ localConfig.mocks = {};
17
+ }
18
+ if (!localConfig.mocks[mockType]) {
19
+ localConfig.mocks[mockType] = {};
20
+ }
21
+ let pluginType = 'static';
22
+ if (fs_extra_1.default.existsSync(path_1.default.resolve(params.targetValue.toString()))) {
23
+ pluginType = 'dynamic';
24
+ }
25
+ if (!localConfig.mocks[mockType][pluginType]) {
26
+ localConfig.mocks[mockType][pluginType] = {};
27
+ }
28
+ localConfig.mocks[mockType][pluginType][params.targetName] =
29
+ params.targetValue;
30
+ return fs_extra_1.default.writeJson(settings_1.default.configFile.src, localConfig, { spaces: 2 });
31
+ };
32
+ }
33
+ exports.default = mock;
@@ -1,9 +1,9 @@
1
- import { Component } from '../../types';
2
- interface PackageOptions {
3
- componentPath: string;
4
- minify?: boolean;
5
- verbose?: boolean;
6
- production?: boolean;
7
- }
8
- declare const packageComponents: () => (options: PackageOptions) => Promise<Component>;
9
- export default packageComponents;
1
+ import { Component } from '../../types';
2
+ export interface PackageOptions {
3
+ componentPath: string;
4
+ minify?: boolean;
5
+ verbose?: boolean;
6
+ production?: boolean;
7
+ }
8
+ declare const packageComponents: () => (options: PackageOptions) => Promise<Component>;
9
+ export default packageComponents;
@@ -1,67 +1,71 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- const fs_extra_1 = __importDefault(require("fs-extra"));
26
- const util_1 = require("util");
27
- const path_1 = __importDefault(require("path"));
28
- const require_template_1 = __importDefault(require("./handle-dependencies/require-template"));
29
- const validator = __importStar(require("../../registry/domain/validators"));
30
- const packageComponents = () => async (options) => {
31
- const production = options.production;
32
- const componentPath = options.componentPath;
33
- const minify = options.minify === true;
34
- const verbose = options.verbose === true;
35
- const publishPath = path_1.default.join(componentPath, '_package');
36
- const componentPackagePath = path_1.default.join(componentPath, 'package.json');
37
- const ocPackagePath = path_1.default.join(__dirname, '../../../package.json');
38
- if (!fs_extra_1.default.existsSync(componentPackagePath)) {
39
- throw new Error('component does not contain package.json');
40
- }
41
- else if (!fs_extra_1.default.existsSync(ocPackagePath)) {
42
- throw new Error('error resolving oc internal dependencies');
43
- }
44
- await fs_extra_1.default.emptyDir(publishPath);
45
- const componentPackage = await fs_extra_1.default.readJson(componentPackagePath);
46
- const ocPackage = await fs_extra_1.default.readJson(ocPackagePath);
47
- if (!validator.validateComponentName(componentPackage.name)) {
48
- throw new Error('name not valid');
49
- }
50
- const type = componentPackage.oc.files.template.type;
51
- const compileOptions = {
52
- publishPath,
53
- componentPath,
54
- componentPackage,
55
- ocPackage,
56
- minify,
57
- verbose,
58
- production
59
- };
60
- const ocTemplate = (0, require_template_1.default)(type, {
61
- compiler: true,
62
- componentPath
63
- });
64
- const compile = (0, util_1.promisify)(ocTemplate.compile);
65
- return compile(compileOptions);
66
- };
67
- exports.default = packageComponents;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const fs_extra_1 = __importDefault(require("fs-extra"));
30
+ const util_1 = require("util");
31
+ const path_1 = __importDefault(require("path"));
32
+ const require_template_1 = __importDefault(require("./handle-dependencies/require-template"));
33
+ const validator = __importStar(require("../../registry/domain/validators"));
34
+ const packageComponents = () => async (options) => {
35
+ const production = options.production;
36
+ const componentPath = options.componentPath;
37
+ const minify = options.minify === true;
38
+ const verbose = options.verbose === true;
39
+ const publishPath = path_1.default.join(componentPath, '_package');
40
+ const componentPackagePath = path_1.default.join(componentPath, 'package.json');
41
+ const ocPackagePath = path_1.default.join(__dirname, '../../../package.json');
42
+ if (!fs_extra_1.default.existsSync(componentPackagePath)) {
43
+ throw new Error('component does not contain package.json');
44
+ }
45
+ else if (!fs_extra_1.default.existsSync(ocPackagePath)) {
46
+ throw new Error('error resolving oc internal dependencies');
47
+ }
48
+ await fs_extra_1.default.emptyDir(publishPath);
49
+ const componentPackage = await fs_extra_1.default.readJson(componentPackagePath);
50
+ const ocPackage = await fs_extra_1.default.readJson(ocPackagePath);
51
+ if (!validator.validateComponentName(componentPackage.name)) {
52
+ throw new Error('name not valid');
53
+ }
54
+ const type = componentPackage.oc.files.template.type;
55
+ const compileOptions = {
56
+ publishPath,
57
+ componentPath,
58
+ componentPackage,
59
+ ocPackage,
60
+ minify,
61
+ verbose,
62
+ production
63
+ };
64
+ const ocTemplate = (0, require_template_1.default)(type, {
65
+ compiler: true,
66
+ componentPath
67
+ });
68
+ const compile = (0, util_1.promisify)(ocTemplate.compile);
69
+ return compile(compileOptions);
70
+ };
71
+ exports.default = packageComponents;
@@ -1,6 +1,20 @@
1
- import { RegistryCli } from '../../types';
2
- interface RegistryOptions {
3
- registry?: string;
4
- }
5
- export default function registry(opts?: RegistryOptions): RegistryCli;
6
- export {};
1
+ import path from 'path';
2
+ import { Component } from '../../types';
3
+ interface RegistryOptions {
4
+ registry?: string;
5
+ }
6
+ export default function registry(opts?: RegistryOptions): {
7
+ add(registry: string): Promise<void>;
8
+ get(): Promise<string[]>;
9
+ getApiComponentByHref(href: string): Promise<Component>;
10
+ getComponentPreviewUrlByUrl(componentHref: string): Promise<string>;
11
+ putComponent(options: {
12
+ username?: string;
13
+ password?: string;
14
+ route: string;
15
+ path: string;
16
+ }): Promise<void>;
17
+ remove(registry: string): Promise<void>;
18
+ };
19
+ export declare type RegistryCli = ReturnType<typeof registry>;
20
+ export {};