@appsemble/cli 0.20.9 → 0.20.12

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 (295) hide show
  1. package/__fixtures__/getBlockConfigFromTypeScript/comments/index.ts +40 -0
  2. package/__fixtures__/getBlockConfigFromTypeScript/comments/tsconfig.json +7 -0
  3. package/__fixtures__/getBlockConfigFromTypeScript/duplicateActions/index.ts +34 -0
  4. package/__fixtures__/getBlockConfigFromTypeScript/duplicateActions/tsconfig.json +7 -0
  5. package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventEmitters/index.ts +34 -0
  6. package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventEmitters/tsconfig.json +7 -0
  7. package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventListeners/index.ts +34 -0
  8. package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventListeners/tsconfig.json +7 -0
  9. package/__fixtures__/getBlockConfigFromTypeScript/duplicateParameters/index.ts +34 -0
  10. package/__fixtures__/getBlockConfigFromTypeScript/duplicateParameters/tsconfig.json +7 -0
  11. package/__fixtures__/getBlockConfigFromTypeScript/fontawesomeParameters/index.ts +11 -0
  12. package/__fixtures__/getBlockConfigFromTypeScript/fontawesomeParameters/tsconfig.json +7 -0
  13. package/__fixtures__/getBlockConfigFromTypeScript/tsError/index.ts +4 -0
  14. package/__fixtures__/getBlockConfigFromTypeScript/tsError/tsconfig.json +8 -0
  15. package/__fixtures__/getBlockConfigFromTypeScript/valid/index.ts +28 -0
  16. package/__fixtures__/getBlockConfigFromTypeScript/valid/tsconfig.json +7 -0
  17. package/__fixtures__/makePayload/no-icon/output/block.js +1 -0
  18. package/__fixtures__/makePayload/with-icon/icon.svg +2 -0
  19. package/__fixtures__/makePayload/with-icon/output/block.js +1 -0
  20. package/assets/appsemblerc.schema.json +150 -0
  21. package/changed/added/.gitkeep +0 -0
  22. package/changed/changed/.gitkeep +0 -0
  23. package/changed/deprecated/.gitkeep +0 -0
  24. package/changed/fixed/.gitkeep +0 -0
  25. package/changed/removed/.gitkeep +0 -0
  26. package/changed/security/.gitkeep +0 -0
  27. package/{dist/commands → commands}/app/create.d.ts +0 -0
  28. package/{dist/commands → commands}/app/create.js +0 -0
  29. package/commands/app/create.js.map +1 -0
  30. package/commands/app/create.ts +104 -0
  31. package/{dist/commands → commands}/app/extract-messages.d.ts +0 -0
  32. package/{dist/commands → commands}/app/extract-messages.js +0 -0
  33. package/commands/app/extract-messages.js.map +1 -0
  34. package/commands/app/extract-messages.ts +56 -0
  35. package/{dist/commands → commands}/app/index.d.ts +0 -0
  36. package/{dist/commands → commands}/app/index.js +0 -0
  37. package/commands/app/index.js.map +1 -0
  38. package/commands/app/index.ts +14 -0
  39. package/{dist/commands → commands}/app/update.d.ts +0 -0
  40. package/{dist/commands → commands}/app/update.js +0 -0
  41. package/commands/app/update.js.map +1 -0
  42. package/commands/app/update.ts +111 -0
  43. package/{dist/commands → commands}/asset/create.d.ts +0 -0
  44. package/{dist/commands → commands}/asset/create.js +0 -0
  45. package/commands/asset/create.js.map +1 -0
  46. package/commands/asset/create.ts +84 -0
  47. package/{dist/commands → commands}/asset/index.d.ts +0 -0
  48. package/{dist/commands → commands}/asset/index.js +0 -0
  49. package/commands/asset/index.js.map +1 -0
  50. package/commands/asset/index.ts +12 -0
  51. package/{dist/commands → commands}/block/build.d.ts +0 -0
  52. package/{dist/commands → commands}/block/build.js +0 -0
  53. package/commands/block/build.js.map +1 -0
  54. package/commands/block/build.ts +32 -0
  55. package/{dist/commands → commands}/block/extract-messages.d.ts +0 -0
  56. package/{dist/commands → commands}/block/extract-messages.js +0 -0
  57. package/commands/block/extract-messages.js.map +1 -0
  58. package/commands/block/extract-messages.ts +41 -0
  59. package/{dist/commands → commands}/block/index.d.ts +0 -0
  60. package/{dist/commands → commands}/block/index.js +0 -0
  61. package/commands/block/index.js.map +1 -0
  62. package/commands/block/index.ts +14 -0
  63. package/{dist/commands → commands}/block/publish.d.ts +0 -0
  64. package/{dist/commands → commands}/block/publish.js +0 -0
  65. package/commands/block/publish.js.map +1 -0
  66. package/commands/block/publish.ts +58 -0
  67. package/{dist/commands → commands}/cleanupResources.d.ts +0 -0
  68. package/{dist/commands → commands}/cleanupResources.js +0 -0
  69. package/commands/cleanupResources.js.map +1 -0
  70. package/commands/cleanupResources.ts +45 -0
  71. package/{dist/commands → commands}/config/get.d.ts +0 -0
  72. package/{dist/commands → commands}/config/get.js +0 -0
  73. package/commands/config/get.js.map +1 -0
  74. package/commands/config/get.ts +26 -0
  75. package/{dist/commands → commands}/config/index.d.ts +0 -0
  76. package/{dist/commands → commands}/config/index.js +0 -0
  77. package/commands/config/index.js.map +1 -0
  78. package/commands/config/index.ts +13 -0
  79. package/{dist/commands → commands}/config/set.d.ts +0 -0
  80. package/{dist/commands → commands}/config/set.js +0 -0
  81. package/commands/config/set.js.map +1 -0
  82. package/commands/config/set.ts +44 -0
  83. package/{dist/commands → commands}/login.d.ts +0 -0
  84. package/{dist/commands → commands}/login.js +0 -0
  85. package/commands/login.js.map +1 -0
  86. package/commands/login.ts +5 -0
  87. package/{dist/commands → commands}/logout.d.ts +0 -0
  88. package/{dist/commands → commands}/logout.js +0 -0
  89. package/commands/logout.js.map +1 -0
  90. package/commands/logout.ts +5 -0
  91. package/{dist/commands → commands}/migrate.d.ts +0 -0
  92. package/{dist/commands → commands}/migrate.js +5 -2
  93. package/commands/migrate.js.map +1 -0
  94. package/commands/migrate.ts +50 -0
  95. package/{dist/commands → commands}/organization/create.d.ts +0 -0
  96. package/{dist/commands → commands}/organization/create.js +0 -0
  97. package/commands/organization/create.js.map +1 -0
  98. package/commands/organization/create.ts +65 -0
  99. package/{dist/commands → commands}/organization/index.d.ts +0 -0
  100. package/{dist/commands → commands}/organization/index.js +0 -0
  101. package/commands/organization/index.js.map +1 -0
  102. package/commands/organization/index.ts +13 -0
  103. package/{dist/commands → commands}/organization/update.d.ts +0 -0
  104. package/{dist/commands → commands}/organization/update.js +0 -0
  105. package/commands/organization/update.js.map +1 -0
  106. package/commands/organization/update.ts +65 -0
  107. package/{dist/commands → commands}/resource/create.d.ts +0 -0
  108. package/{dist/commands → commands}/resource/create.js +0 -0
  109. package/commands/resource/create.js.map +1 -0
  110. package/commands/resource/create.ts +78 -0
  111. package/{dist/commands → commands}/resource/index.d.ts +0 -0
  112. package/{dist/commands → commands}/resource/index.js +0 -0
  113. package/commands/resource/index.js.map +1 -0
  114. package/commands/resource/index.ts +13 -0
  115. package/{dist/commands → commands}/resource/update.d.ts +0 -0
  116. package/{dist/commands → commands}/resource/update.js +0 -0
  117. package/commands/resource/update.js.map +1 -0
  118. package/commands/resource/update.ts +77 -0
  119. package/{dist/commands → commands}/runCronJobs.d.ts +0 -0
  120. package/{dist/commands → commands}/runCronJobs.js +0 -0
  121. package/commands/runCronJobs.js.map +1 -0
  122. package/commands/runCronJobs.ts +45 -0
  123. package/{dist/commands → commands}/start.d.ts +0 -0
  124. package/{dist/commands → commands}/start.js +4 -0
  125. package/commands/start.js.map +1 -0
  126. package/commands/start.ts +140 -0
  127. package/{dist/commands → commands}/team/create.d.ts +0 -0
  128. package/{dist/commands → commands}/team/create.js +0 -0
  129. package/commands/team/create.js.map +1 -0
  130. package/commands/team/create.ts +60 -0
  131. package/{dist/commands → commands}/team/delete.d.ts +0 -0
  132. package/{dist/commands → commands}/team/delete.js +0 -0
  133. package/commands/team/delete.js.map +1 -0
  134. package/commands/team/delete.ts +54 -0
  135. package/{dist/commands → commands}/team/index.d.ts +0 -0
  136. package/{dist/commands → commands}/team/index.js +0 -0
  137. package/commands/team/index.js.map +1 -0
  138. package/commands/team/index.ts +15 -0
  139. package/{dist/commands → commands}/team/member/delete.d.ts +0 -0
  140. package/{dist/commands → commands}/team/member/delete.js +0 -0
  141. package/commands/team/member/delete.js.map +1 -0
  142. package/commands/team/member/delete.ts +61 -0
  143. package/{dist/commands → commands}/team/member/index.d.ts +0 -0
  144. package/{dist/commands → commands}/team/member/index.js +0 -0
  145. package/commands/team/member/index.js.map +1 -0
  146. package/commands/team/member/index.ts +14 -0
  147. package/{dist/commands → commands}/team/member/invite.d.ts +0 -0
  148. package/{dist/commands → commands}/team/member/invite.js +0 -0
  149. package/commands/team/member/invite.js.map +1 -0
  150. package/commands/team/member/invite.ts +61 -0
  151. package/{dist/commands → commands}/team/member/update.d.ts +0 -0
  152. package/{dist/commands → commands}/team/member/update.js +0 -0
  153. package/commands/team/member/update.js.map +1 -0
  154. package/commands/team/member/update.ts +70 -0
  155. package/{dist/commands → commands}/team/update.d.ts +0 -0
  156. package/{dist/commands → commands}/team/update.js +0 -0
  157. package/commands/team/update.js.map +1 -0
  158. package/commands/team/update.ts +60 -0
  159. package/index.d.ts +2 -0
  160. package/{dist/index.js → index.js} +2 -6
  161. package/index.js.map +1 -0
  162. package/index.ts +74 -0
  163. package/jest.config.js +1 -0
  164. package/jest.setup.d.ts +1 -0
  165. package/jest.setup.js +6 -0
  166. package/jest.setup.js.map +1 -0
  167. package/jest.setup.ts +4 -0
  168. package/lib/__snapshots__/getBlockConfigFromTypeScript.test.ts.snap +3872 -0
  169. package/{dist/lib → lib}/app.d.ts +17 -17
  170. package/{dist/lib → lib}/app.js +29 -29
  171. package/lib/app.js.map +1 -0
  172. package/lib/app.ts +797 -0
  173. package/{dist/lib → lib}/asset.d.ts +0 -0
  174. package/{dist/lib → lib}/asset.js +0 -0
  175. package/lib/asset.js.map +1 -0
  176. package/lib/asset.ts +43 -0
  177. package/{dist/lib → lib}/authentication.d.ts +3 -3
  178. package/{dist/lib → lib}/authentication.js +47 -15
  179. package/lib/authentication.js.map +1 -0
  180. package/lib/authentication.ts +193 -0
  181. package/{dist/lib → lib}/block.d.ts +16 -16
  182. package/{dist/lib → lib}/block.js +35 -26
  183. package/lib/block.js.map +1 -0
  184. package/lib/block.test.d.ts +1 -0
  185. package/lib/block.test.js +106 -0
  186. package/lib/block.test.js.map +1 -0
  187. package/lib/block.test.ts +103 -0
  188. package/lib/block.ts +384 -0
  189. package/{dist/lib → lib}/coercers.d.ts +2 -2
  190. package/{dist/lib → lib}/coercers.js +2 -2
  191. package/lib/coercers.js.map +1 -0
  192. package/lib/coercers.test.d.ts +1 -0
  193. package/lib/coercers.test.js +28 -0
  194. package/lib/coercers.test.js.map +1 -0
  195. package/lib/coercers.test.ts +27 -0
  196. package/lib/coercers.ts +57 -0
  197. package/{dist/lib → lib}/getBlockConfigFromTypeScript.d.ts +1 -1
  198. package/{dist/lib → lib}/getBlockConfigFromTypeScript.js +38 -36
  199. package/lib/getBlockConfigFromTypeScript.js.map +1 -0
  200. package/lib/getBlockConfigFromTypeScript.test.d.ts +1 -0
  201. package/lib/getBlockConfigFromTypeScript.test.js +238 -0
  202. package/lib/getBlockConfigFromTypeScript.test.js.map +1 -0
  203. package/lib/getBlockConfigFromTypeScript.test.ts +281 -0
  204. package/lib/getBlockConfigFromTypeScript.ts +354 -0
  205. package/{dist/lib → lib}/initAxios.d.ts +1 -1
  206. package/{dist/lib → lib}/initAxios.js +3 -4
  207. package/lib/initAxios.js.map +1 -0
  208. package/lib/initAxios.ts +16 -0
  209. package/{dist/lib → lib}/loadWebpackConfig.d.ts +3 -3
  210. package/{dist/lib → lib}/loadWebpackConfig.js +3 -3
  211. package/lib/loadWebpackConfig.js.map +1 -0
  212. package/lib/loadWebpackConfig.ts +59 -0
  213. package/{dist/lib → lib}/organization.d.ts +1 -1
  214. package/{dist/lib → lib}/organization.js +0 -0
  215. package/lib/organization.js.map +1 -0
  216. package/lib/organization.ts +105 -0
  217. package/{dist/lib → lib}/output.d.ts +0 -0
  218. package/{dist/lib → lib}/output.js +0 -0
  219. package/lib/output.js.map +1 -0
  220. package/lib/output.ts +19 -0
  221. package/{dist/lib → lib}/processCss.d.ts +1 -1
  222. package/{dist/lib → lib}/processCss.js +3 -3
  223. package/lib/processCss.js.map +1 -0
  224. package/lib/processCss.ts +24 -0
  225. package/{dist/lib → lib}/resource.d.ts +0 -0
  226. package/{dist/lib → lib}/resource.js +1 -1
  227. package/lib/resource.js.map +1 -0
  228. package/lib/resource.ts +128 -0
  229. package/{dist/lib → lib}/serverImport.d.ts +1 -1
  230. package/{dist/lib → lib}/serverImport.js +2 -2
  231. package/lib/serverImport.js.map +1 -0
  232. package/lib/serverImport.ts +43 -0
  233. package/{dist/lib → lib}/team.d.ts +0 -0
  234. package/{dist/lib → lib}/team.js +0 -0
  235. package/lib/team.js.map +1 -0
  236. package/lib/team.ts +152 -0
  237. package/package.json +14 -12
  238. package/tsconfig.json +10 -0
  239. package/{dist/types.d.ts → types.d.ts} +0 -0
  240. package/{dist/types.js → types.js} +0 -0
  241. package/types.js.map +1 -0
  242. package/types.ts +110 -0
  243. package/dist/commands/app/create.js.map +0 -1
  244. package/dist/commands/app/extract-messages.js.map +0 -1
  245. package/dist/commands/app/index.js.map +0 -1
  246. package/dist/commands/app/update.js.map +0 -1
  247. package/dist/commands/asset/create.js.map +0 -1
  248. package/dist/commands/asset/index.js.map +0 -1
  249. package/dist/commands/block/build.js.map +0 -1
  250. package/dist/commands/block/extract-messages.js.map +0 -1
  251. package/dist/commands/block/index.js.map +0 -1
  252. package/dist/commands/block/publish.js.map +0 -1
  253. package/dist/commands/cleanupResources.js.map +0 -1
  254. package/dist/commands/config/get.js.map +0 -1
  255. package/dist/commands/config/index.js.map +0 -1
  256. package/dist/commands/config/set.js.map +0 -1
  257. package/dist/commands/login.js.map +0 -1
  258. package/dist/commands/logout.js.map +0 -1
  259. package/dist/commands/migrate.js.map +0 -1
  260. package/dist/commands/organization/create.js.map +0 -1
  261. package/dist/commands/organization/index.js.map +0 -1
  262. package/dist/commands/organization/update.js.map +0 -1
  263. package/dist/commands/resource/create.js.map +0 -1
  264. package/dist/commands/resource/index.js.map +0 -1
  265. package/dist/commands/resource/update.js.map +0 -1
  266. package/dist/commands/runCronJobs.js.map +0 -1
  267. package/dist/commands/start.js.map +0 -1
  268. package/dist/commands/team/create.js.map +0 -1
  269. package/dist/commands/team/delete.js.map +0 -1
  270. package/dist/commands/team/index.js.map +0 -1
  271. package/dist/commands/team/member/delete.js.map +0 -1
  272. package/dist/commands/team/member/index.js.map +0 -1
  273. package/dist/commands/team/member/invite.js.map +0 -1
  274. package/dist/commands/team/member/update.js.map +0 -1
  275. package/dist/commands/team/update.js.map +0 -1
  276. package/dist/index.d.ts +0 -2
  277. package/dist/index.js.map +0 -1
  278. package/dist/lib/app.js.map +0 -1
  279. package/dist/lib/asset.js.map +0 -1
  280. package/dist/lib/authentication.js.map +0 -1
  281. package/dist/lib/block.js.map +0 -1
  282. package/dist/lib/coercers.js.map +0 -1
  283. package/dist/lib/getBlockConfigFromTypeScript.js.map +0 -1
  284. package/dist/lib/initAxios.js.map +0 -1
  285. package/dist/lib/loadWebpackConfig.js.map +0 -1
  286. package/dist/lib/organization.js.map +0 -1
  287. package/dist/lib/output.js.map +0 -1
  288. package/dist/lib/processCss.js.map +0 -1
  289. package/dist/lib/readPackageJson.d.ts +0 -9
  290. package/dist/lib/readPackageJson.js +0 -16
  291. package/dist/lib/readPackageJson.js.map +0 -1
  292. package/dist/lib/resource.js.map +0 -1
  293. package/dist/lib/serverImport.js.map +0 -1
  294. package/dist/lib/team.js.map +0 -1
  295. package/dist/types.js.map +0 -1
File without changes
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset.js","sourceRoot":"","sources":["asset.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAsC;AAEtC,sDAA+C;AAC/C,4CAA6C;AAC7C,kDAA0B;AAC1B,0DAAiC;AAyB1B,KAAK,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAqB;IAChF,MAAM,QAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,IAAA,qBAAgB,EAAC,IAAI,CAAC,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9B,IAAI,IAAI,EAAE;QACR,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAA,iBAAS,EAAC,IAAI,CAAC,CAAC,CAAC;KAC1C;IAED,MAAM,EACJ,IAAI,EAAE,EAAE,EAAE,EAAE,GACb,GAAG,MAAM,eAAK,CAAC,IAAI,CAAiB,aAAa,KAAK,SAAS,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACjG,mBAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,cAAc,IAAA,iBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACnF,CAAC;AAZD,kCAYC"}
package/lib/asset.ts ADDED
@@ -0,0 +1,43 @@
1
+ import { createReadStream } from 'fs';
2
+
3
+ import { logger } from '@appsemble/node-utils';
4
+ import { normalize } from '@appsemble/utils';
5
+ import axios from 'axios';
6
+ import FormData from 'form-data';
7
+
8
+ interface CreateAssetParams {
9
+ /**
10
+ * The name of the asset being uploaded.
11
+ * This must be a unique name for the app. If left empty, the ID is used instead.
12
+ */
13
+ name: string;
14
+
15
+ /**
16
+ * The path in which the resource JSON is located.
17
+ */
18
+ path: string;
19
+
20
+ /**
21
+ * The ID of the app to create a resource entry for.
22
+ */
23
+ appId: number;
24
+
25
+ /**
26
+ * The remote server to create the app on.
27
+ */
28
+ remote: string;
29
+ }
30
+
31
+ export async function createAsset({ appId, name, path, remote }: CreateAssetParams): Promise<void> {
32
+ const formData = new FormData();
33
+ const file = createReadStream(path);
34
+ formData.append('file', file);
35
+ if (name) {
36
+ formData.append('name', normalize(name));
37
+ }
38
+
39
+ const {
40
+ data: { id },
41
+ } = await axios.post<{ id: string }>(`/api/apps/${appId}/assets`, formData, { baseURL: remote });
42
+ logger.info(`Created asset ${id}${name ? ` with name ${normalize(name)}` : ''}`);
43
+ }
@@ -5,9 +5,9 @@ export declare function remove({ remote }: BaseArguments): Promise<void>;
5
5
  /**
6
6
  * Login to the server using OAuth2 client credentials.
7
7
  *
8
- * @param remote - Host to fetch token from.
9
- * @param scope - The OAuth2 scope to request. This may be space separated to request
8
+ * @param remote Host to fetch token from.
9
+ * @param scope The OAuth2 scope to request. This may be space separated to request
10
10
  * multiple scopes.
11
- * @param inputCredentials - Client credentials passed from the command line.
11
+ * @param inputCredentials Client credentials passed from the command line.
12
12
  */
13
13
  export declare function authenticate(remote: string, scope: string, inputCredentials: string): Promise<void>;
@@ -27,9 +27,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.authenticate = exports.remove = exports.login = exports.CREDENTIALS_ENV_VAR = void 0;
30
+ const os_1 = require("os");
30
31
  const node_utils_1 = require("@appsemble/node-utils");
31
32
  const axios_1 = __importDefault(require("axios"));
32
- const inquirer_1 = require("inquirer");
33
+ const inquirer_1 = __importDefault(require("inquirer"));
34
+ const koa_1 = __importDefault(require("koa"));
35
+ const open_1 = __importDefault(require("open"));
36
+ const raw_body_1 = __importDefault(require("raw-body"));
33
37
  exports.CREDENTIALS_ENV_VAR = 'APPSEMBLE_CLIENT_CREDENTIALS';
34
38
  const authorizedRemotes = new Set();
35
39
  function validate(credentials) {
@@ -38,6 +42,41 @@ function validate(credentials) {
38
42
  function getService(remote) {
39
43
  return `appsemble://${new URL(remote).host}`;
40
44
  }
45
+ function waitForCredentials(url) {
46
+ return new Promise((resolve) => {
47
+ const app = new koa_1.default();
48
+ let server;
49
+ app.use(async (ctx) => {
50
+ ctx.set({
51
+ 'access-control-allow-headers': '*',
52
+ 'access-control-allow-methods': 'post',
53
+ 'access-control-allow-origin': url.origin,
54
+ });
55
+ if (ctx.method === 'OPTIONS') {
56
+ ctx.status = 204;
57
+ return;
58
+ }
59
+ ctx.assert(ctx.path === '/', 404);
60
+ ctx.assert(ctx.method === 'POST', 405);
61
+ ctx.assert(ctx.is('json'), 415);
62
+ let credentials;
63
+ try {
64
+ ({ credentials } = JSON.parse(await (0, raw_body_1.default)(ctx.req, { encoding: 'utf8' })));
65
+ }
66
+ catch {
67
+ ctx.throw(400, 'Invalid JSON');
68
+ }
69
+ ctx.assert(typeof credentials === 'string' && validate(credentials), 400, 'Invalid client credentials');
70
+ ctx.status = 204;
71
+ server.close();
72
+ resolve(credentials);
73
+ });
74
+ server = app.listen();
75
+ url.searchParams.set('callback', String(server.address().port));
76
+ url.searchParams.set('description', (0, os_1.hostname)());
77
+ (0, open_1.default)(String(url));
78
+ });
79
+ }
41
80
  async function getKeytar() {
42
81
  try {
43
82
  return await Promise.resolve().then(() => __importStar(require('keytar')));
@@ -65,7 +104,7 @@ async function getClientCredentials(remote, inputCredentials) {
65
104
  [choice] = choices;
66
105
  }
67
106
  else {
68
- ({ choice } = await (0, inquirer_1.prompt)([
107
+ ({ choice } = await inquirer_1.default.prompt([
69
108
  {
70
109
  name: 'choice',
71
110
  message: 'Select client id to use',
@@ -87,15 +126,8 @@ async function login({ clientCredentials, remote }) {
87
126
  credentials = clientCredentials;
88
127
  }
89
128
  else {
90
- node_utils_1.logger.info(`Client credentials can be registered on ${url}`);
91
- ({ credentials } = await (0, inquirer_1.prompt)([
92
- {
93
- name: 'credentials',
94
- type: 'password',
95
- message: 'Enter client credentials',
96
- validate,
97
- },
98
- ]));
129
+ node_utils_1.logger.info(`Opening ${url}`);
130
+ credentials = await waitForCredentials(url);
99
131
  }
100
132
  const [clientId, clientSecret] = credentials.split(':');
101
133
  await setPassword(getService(remote), clientId, clientSecret);
@@ -109,7 +141,7 @@ async function remove({ remote }) {
109
141
  node_utils_1.logger.warn('No client credentials are currently in use.');
110
142
  return;
111
143
  }
112
- const { clientIds } = await (0, inquirer_1.prompt)([
144
+ const { clientIds } = await inquirer_1.default.prompt([
113
145
  {
114
146
  name: 'clientIds',
115
147
  message: 'Select client ids to delete',
@@ -126,10 +158,10 @@ exports.remove = remove;
126
158
  /**
127
159
  * Login to the server using OAuth2 client credentials.
128
160
  *
129
- * @param remote - Host to fetch token from.
130
- * @param scope - The OAuth2 scope to request. This may be space separated to request
161
+ * @param remote Host to fetch token from.
162
+ * @param scope The OAuth2 scope to request. This may be space separated to request
131
163
  * multiple scopes.
132
- * @param inputCredentials - Client credentials passed from the command line.
164
+ * @param inputCredentials Client credentials passed from the command line.
133
165
  */
134
166
  async function authenticate(remote, scope, inputCredentials) {
135
167
  const credentials = await getClientCredentials(remote, inputCredentials);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA8B;AAE9B,sDAA+D;AAE/D,kDAA0B;AAC1B,wDAAgC;AAChC,8CAAmC;AACnC,gDAAwB;AACxB,wDAA2B;AAId,QAAA,mBAAmB,GAAG,8BAA8B,CAAC;AAElE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;AAE5C,SAAS,QAAQ,CAAC,WAAmB;IACnC,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,eAAe,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAQ;IAClC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,IAAI,aAAG,EAAE,CAAC;QAEtB,IAAI,MAAc,CAAC;QACnB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAY,EAAE,EAAE;YAC7B,GAAG,CAAC,GAAG,CAAC;gBACN,8BAA8B,EAAE,GAAG;gBACnC,8BAA8B,EAAE,MAAM;gBACtC,6BAA6B,EAAE,GAAG,CAAC,MAAM;aAC1C,CAAC,CAAC;YACH,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;gBAC5B,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;gBACjB,OAAO;aACR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OAAO,KAAK,MAAM,EAAE;YAC7B,OAAO;gBACL,GAAG,MAAM;gBACT,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,YAAY,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE;aAC7E,CAAC;SACH;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IACH,mBAAM,CAAC,IAAI,CAAC,gBAAgB,MAAM,eAAe,CAAC,CAAC;IACnD,mBAAM,CAAC,OAAO,CAAC,gBAAgB,KAAK,EAAE,CAAC,CAAC;AAC1C,CAAC;AA/BD,oCA+BC"}
@@ -0,0 +1,193 @@
1
+ import { AddressInfo, Server } from 'net';
2
+ import { hostname } from 'os';
3
+
4
+ import { AppsembleError, logger } from '@appsemble/node-utils';
5
+ import { TokenResponse } from '@appsemble/types';
6
+ import axios from 'axios';
7
+ import inquirer from 'inquirer';
8
+ import Koa, { Context } from 'koa';
9
+ import open from 'open';
10
+ import raw from 'raw-body';
11
+
12
+ import { BaseArguments } from '../types';
13
+
14
+ export const CREDENTIALS_ENV_VAR = 'APPSEMBLE_CLIENT_CREDENTIALS';
15
+
16
+ const authorizedRemotes = new Set<string>();
17
+
18
+ function validate(credentials: string): boolean {
19
+ return /.+:.+/.test(credentials);
20
+ }
21
+
22
+ function getService(remote: string): string {
23
+ return `appsemble://${new URL(remote).host}`;
24
+ }
25
+
26
+ function waitForCredentials(url: URL): Promise<string> {
27
+ return new Promise((resolve) => {
28
+ const app = new Koa();
29
+
30
+ let server: Server;
31
+ app.use(async (ctx: Context) => {
32
+ ctx.set({
33
+ 'access-control-allow-headers': '*',
34
+ 'access-control-allow-methods': 'post',
35
+ 'access-control-allow-origin': url.origin,
36
+ });
37
+ if (ctx.method === 'OPTIONS') {
38
+ ctx.status = 204;
39
+ return;
40
+ }
41
+ ctx.assert(ctx.path === '/', 404);
42
+ ctx.assert(ctx.method === 'POST', 405);
43
+ ctx.assert(ctx.is('json'), 415);
44
+ let credentials: string;
45
+ try {
46
+ ({ credentials } = JSON.parse(await raw(ctx.req, { encoding: 'utf8' })));
47
+ } catch {
48
+ ctx.throw(400, 'Invalid JSON');
49
+ }
50
+ ctx.assert(
51
+ typeof credentials === 'string' && validate(credentials),
52
+ 400,
53
+ 'Invalid client credentials',
54
+ );
55
+ ctx.status = 204;
56
+ server.close();
57
+ resolve(credentials);
58
+ });
59
+ server = app.listen();
60
+
61
+ url.searchParams.set('callback', String((server.address() as AddressInfo).port));
62
+ url.searchParams.set('description', hostname());
63
+ open(String(url));
64
+ });
65
+ }
66
+
67
+ async function getKeytar(): Promise<typeof import('keytar')> {
68
+ try {
69
+ return await import('keytar');
70
+ } catch {
71
+ throw new AppsembleError(
72
+ 'Couldn’t find module keytar. Either install libsecret and reinstall @appsemble/cli, or pass --client-credentials on the command line.',
73
+ );
74
+ }
75
+ }
76
+
77
+ async function getClientCredentials(remote: string, inputCredentials: string): Promise<string> {
78
+ if (inputCredentials) {
79
+ return inputCredentials;
80
+ }
81
+
82
+ const envCredentials = process.env[CREDENTIALS_ENV_VAR];
83
+ if (envCredentials) {
84
+ logger.info(`Detected client credentials from ${CREDENTIALS_ENV_VAR} environment variable`);
85
+ return envCredentials;
86
+ }
87
+
88
+ const { findCredentials } = await getKeytar();
89
+ const choices = await findCredentials(getService(remote));
90
+ if (choices.length === 0) {
91
+ throw new AppsembleError(
92
+ `No client credentials found. Register them using:\n\nappsemble login --remote ${remote}`,
93
+ );
94
+ }
95
+ let choice;
96
+ if (choices.length === 1) {
97
+ [choice] = choices;
98
+ } else {
99
+ ({ choice } = await inquirer.prompt([
100
+ {
101
+ name: 'choice',
102
+ message: 'Select client id to use',
103
+ choices: choices.map((value) => ({ name: value.account, value })),
104
+ type: 'list',
105
+ },
106
+ ]));
107
+ }
108
+ return `${choice.account}:${choice.password}`;
109
+ }
110
+
111
+ export async function login({ clientCredentials, remote }: BaseArguments): Promise<void> {
112
+ const { setPassword } = await getKeytar();
113
+ const url = new URL('/settings/client-credentials', remote);
114
+ let credentials = clientCredentials;
115
+ if (credentials) {
116
+ if (!validate(clientCredentials)) {
117
+ throw new AppsembleError(
118
+ `Invalid client credentials. Client credentials can be registered on ${url}`,
119
+ );
120
+ }
121
+ credentials = clientCredentials;
122
+ } else {
123
+ logger.info(`Opening ${url}`);
124
+ credentials = await waitForCredentials(url);
125
+ }
126
+ const [clientId, clientSecret] = credentials.split(':');
127
+ await setPassword(getService(remote), clientId, clientSecret);
128
+ logger.info(`Successfully stored credentials for ${clientId} 🕶`);
129
+ }
130
+
131
+ export async function remove({ remote }: BaseArguments): Promise<void> {
132
+ const { deletePassword, findCredentials } = await getKeytar();
133
+ const choices = await findCredentials(getService(remote));
134
+ if (choices.length === 0) {
135
+ logger.warn('No client credentials are currently in use.');
136
+ return;
137
+ }
138
+ const { clientIds } = await inquirer.prompt<{ clientIds: string[] }>([
139
+ {
140
+ name: 'clientIds',
141
+ message: 'Select client ids to delete',
142
+ choices: choices.map(({ account }) => account),
143
+ type: 'checkbox',
144
+ },
145
+ ]);
146
+ await Promise.all(
147
+ clientIds.map(async (clientId) => {
148
+ await deletePassword(getService(remote), clientId);
149
+ logger.info(`Successfully delete client id ${clientId}`);
150
+ }),
151
+ );
152
+ }
153
+
154
+ /**
155
+ * Login to the server using OAuth2 client credentials.
156
+ *
157
+ * @param remote Host to fetch token from.
158
+ * @param scope The OAuth2 scope to request. This may be space separated to request
159
+ * multiple scopes.
160
+ * @param inputCredentials Client credentials passed from the command line.
161
+ */
162
+ export async function authenticate(
163
+ remote: string,
164
+ scope: string,
165
+ inputCredentials: string,
166
+ ): Promise<void> {
167
+ const credentials = await getClientCredentials(remote, inputCredentials);
168
+ if (authorizedRemotes.has(remote)) {
169
+ logger.verbose(`Already logged in to ${remote}`);
170
+ return;
171
+ }
172
+ logger.verbose(`Logging in to ${remote}`);
173
+ const { data } = await axios.post<TokenResponse>(
174
+ '/oauth2/token',
175
+ new URLSearchParams({ grant_type: 'client_credentials', scope }),
176
+ {
177
+ headers: { authorization: `Basic ${Buffer.from(credentials).toString('base64')}` },
178
+ baseURL: remote,
179
+ },
180
+ );
181
+ authorizedRemotes.add(remote);
182
+ axios.interceptors.request.use((config) => {
183
+ if (config.baseURL === remote) {
184
+ return {
185
+ ...config,
186
+ headers: { authorization: `Bearer ${data.access_token}`, ...config.headers },
187
+ };
188
+ }
189
+ return config;
190
+ });
191
+ logger.info(`Logged in to ${remote} successfully`);
192
+ logger.verbose(`Login scope: ${scope}`);
193
+ }
@@ -4,14 +4,14 @@ import { Stats } from 'webpack';
4
4
  /**
5
5
  * Builds a block using Webpack.
6
6
  *
7
- * @param config - The config of the block to build.
7
+ * @param config The config of the block to build.
8
8
  * @returns The Webpack stats object.
9
9
  */
10
10
  export declare function buildBlock(config: BlockConfig): Promise<Stats>;
11
11
  /**
12
12
  * Get the block configuration from a block directory.
13
13
  *
14
- * @param dir - The directory in which to search for the configuration file.
14
+ * @param dir The directory in which to search for the configuration file.
15
15
  * @returns The block configuration.
16
16
  */
17
17
  export declare function getBlockConfig(dir: string): Promise<BlockConfig>;
@@ -20,42 +20,42 @@ export declare function getBlockConfig(dir: string): Promise<BlockConfig>;
20
20
  *
21
21
  * Both Lerna and Yarn workspaces are supported.
22
22
  *
23
- * @param root - The project root in which to find workspaces.
23
+ * @param root The project root in which to find workspaces.
24
24
  * @returns Discovered Appsemble blocks.
25
25
  */
26
26
  export declare function discoverBlocks(root: string): Promise<BlockConfig[]>;
27
27
  /**
28
28
  * Configure the payload for a new block version upload.
29
29
  *
30
- * @param config - The block configuration
30
+ * @param config The block configuration
31
31
  * @returns The payload that should be sent to the version endpoint.
32
32
  */
33
33
  export declare function makePayload(config: BlockConfig): Promise<FormData>;
34
34
  /**
35
35
  * Publish a new block version.
36
36
  *
37
- * @param config - The block configuration
38
- * @param ignoreConflict - Prevent the command from crashing when a conflict has been detected.
37
+ * @param config The block configuration
38
+ * @param ignoreConflict Prevent the command from crashing when a conflict has been detected.
39
39
  */
40
40
  export declare function publishBlock(config: BlockConfig, ignoreConflict: boolean): Promise<void>;
41
41
  /**
42
42
  * Uploads an app block theme
43
43
  *
44
- * @param filePath - The path of the index.css file
45
- * @param organization - The ID of the organization the block belongs to.
46
- * @param appId - The ID of the app to upload the theme for.
47
- * @param block - The name of the block.
48
- * @param remote - The HTTP origin to upload the theme to.
49
- * @param force - Force update the theme if the app is locked.
44
+ * @param filePath The path of the index.css file
45
+ * @param organization The ID of the organization the block belongs to.
46
+ * @param appId The ID of the app to upload the theme for.
47
+ * @param block The name of the block.
48
+ * @param remote The HTTP origin to upload the theme to.
49
+ * @param force Force update the theme if the app is locked.
50
50
  */
51
51
  export declare function uploadAppBlockTheme(filePath: string, organization: string, appId: number, block: string, remote: string, force: boolean): Promise<void>;
52
52
  /**
53
53
  * Traverses the directory at a given path for app block themes and uploads them.
54
54
  *
55
- * @param path - The path of the app.
56
- * @param appId - The ID of the app.
57
- * @param remote - The HTTP origin to upload the themes to.
58
- * @param force - Force update the theme if the app is locked.
55
+ * @param path The path of the app.
56
+ * @param appId The ID of the app.
57
+ * @param remote The HTTP origin to upload the themes to.
58
+ * @param force Force update the theme if the app is locked.
59
59
  */
60
60
  export declare function traverseBlockThemes(path: string, appId: number, remote: string, force: boolean): Promise<void>;
61
61
  export declare function processBlockMessages(config: BlockConfig, languages: string[]): Promise<void>;
@@ -5,15 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.processBlockMessages = exports.traverseBlockThemes = exports.uploadAppBlockTheme = exports.publishBlock = exports.makePayload = exports.discoverBlocks = exports.getBlockConfig = exports.buildBlock = void 0;
7
7
  const fs_1 = require("fs");
8
+ const promises_1 = require("fs/promises");
8
9
  const path_1 = require("path");
9
10
  const util_1 = require("util");
10
11
  const node_utils_1 = require("@appsemble/node-utils");
11
12
  const utils_1 = require("@appsemble/utils");
12
13
  const axios_1 = __importDefault(require("axios"));
13
- const chalk_1 = require("chalk");
14
+ const chalk_1 = __importDefault(require("chalk"));
14
15
  const cosmiconfig_1 = require("cosmiconfig");
15
16
  const form_data_1 = __importDefault(require("form-data"));
16
- const fs_extra_1 = require("fs-extra");
17
17
  const webpack_1 = require("webpack");
18
18
  const getBlockConfigFromTypeScript_1 = require("./getBlockConfigFromTypeScript");
19
19
  const loadWebpackConfig_1 = require("./loadWebpackConfig");
@@ -21,14 +21,14 @@ const processCss_1 = require("./processCss");
21
21
  /**
22
22
  * Builds a block using Webpack.
23
23
  *
24
- * @param config - The config of the block to build.
24
+ * @param config The config of the block to build.
25
25
  * @returns The Webpack stats object.
26
26
  */
27
27
  async function buildBlock(config) {
28
28
  const conf = await (0, loadWebpackConfig_1.loadWebpackConfig)(config, 'production', (0, path_1.join)(config.dir, config.output));
29
- if (await (0, fs_extra_1.pathExists)(conf.output.path)) {
29
+ if ((0, fs_1.existsSync)(conf.output.path)) {
30
30
  node_utils_1.logger.warn(`Removing ${conf.output.path}`);
31
- await (0, fs_extra_1.remove)(conf.output.path);
31
+ await (0, promises_1.rm)(conf.output.path, { force: true, recursive: true });
32
32
  }
33
33
  node_utils_1.logger.info(`Building ${config.name}@${config.version} 🔨`);
34
34
  const compiler = (0, webpack_1.webpack)(conf);
@@ -51,7 +51,7 @@ exports.buildBlock = buildBlock;
51
51
  /**
52
52
  * Get the block configuration from a block directory.
53
53
  *
54
- * @param dir - The directory in which to search for the configuration file.
54
+ * @param dir The directory in which to search for the configuration file.
55
55
  * @returns The block configuration.
56
56
  */
57
57
  async function getBlockConfig(dir) {
@@ -64,11 +64,11 @@ async function getBlockConfig(dir) {
64
64
  node_utils_1.logger.info(`Found configuration file: ${filepath}`);
65
65
  const [pkg] = await (0, node_utils_1.readData)((0, path_1.join)(dir, 'package.json'));
66
66
  if (!pkg.private) {
67
- node_utils_1.logger.warn(`It is ${chalk_1.underline.yellow('highly recommended')} to set “${(0, chalk_1.green)('"private"')}: ${(0, chalk_1.cyan)('true')}” in package.json`);
67
+ node_utils_1.logger.warn(`It is ${chalk_1.default.underline.yellow('highly recommended')} to set “${chalk_1.default.green('"private"')}: ${chalk_1.default.cyan('true')}” in package.json`);
68
68
  }
69
69
  let longDescription;
70
70
  if ((0, fs_1.existsSync)((0, path_1.join)(dir, 'README.md'))) {
71
- longDescription = await fs_1.promises.readFile((0, path_1.join)(dir, 'README.md'), 'utf8');
71
+ longDescription = await (0, promises_1.readFile)((0, path_1.join)(dir, 'README.md'), 'utf8');
72
72
  }
73
73
  const result = {
74
74
  description: pkg.description,
@@ -88,7 +88,7 @@ exports.getBlockConfig = getBlockConfig;
88
88
  *
89
89
  * Both Lerna and Yarn workspaces are supported.
90
90
  *
91
- * @param root - The project root in which to find workspaces.
91
+ * @param root The project root in which to find workspaces.
92
92
  * @returns Discovered Appsemble blocks.
93
93
  */
94
94
  async function discoverBlocks(root) {
@@ -104,7 +104,7 @@ exports.discoverBlocks = discoverBlocks;
104
104
  /**
105
105
  * Configure the payload for a new block version upload.
106
106
  *
107
- * @param config - The block configuration
107
+ * @param config The block configuration
108
108
  * @returns The payload that should be sent to the version endpoint.
109
109
  */
110
110
  async function makePayload(config) {
@@ -113,7 +113,7 @@ async function makePayload(config) {
113
113
  const form = new form_data_1.default();
114
114
  const { description, layout, longDescription, name, version, visibility } = config;
115
115
  const { actions, events, messages, parameters } = (0, getBlockConfigFromTypeScript_1.getBlockConfigFromTypeScript)(config);
116
- const files = await fs_1.promises.readdir(dir);
116
+ const files = await (0, promises_1.readdir)(dir);
117
117
  const icon = files.find((entry) => entry.match(/^icon\.(png|svg)$/));
118
118
  function append(field, value) {
119
119
  if (value) {
@@ -148,7 +148,7 @@ async function makePayload(config) {
148
148
  const messageKeys = Object.keys(messages).sort(utils_1.compareStrings);
149
149
  const messagesResult = {};
150
150
  const messagesPath = (0, path_1.join)(dir, 'i18n');
151
- const translations = (await fs_1.promises.readdir(messagesPath)).map((language) => language.toLowerCase());
151
+ const translations = (await (0, promises_1.readdir)(messagesPath)).map((language) => language.toLowerCase());
152
152
  if (!translations.includes('en.json')) {
153
153
  throw new node_utils_1.AppsembleError('Could not find ‘en.json’. Try running extract-messages');
154
154
  }
@@ -170,6 +170,15 @@ async function makePayload(config) {
170
170
  }
171
171
  form.append('messages', JSON.stringify(messagesResult));
172
172
  }
173
+ if (files.includes('examples')) {
174
+ await (0, node_utils_1.opendirSafe)((0, path_1.join)(dir, 'examples'), async (file, stat) => {
175
+ if (!stat.isFile() || !file.endsWith('.yaml')) {
176
+ throw new node_utils_1.AppsembleError(`Expected ${file} to be a YAML file`);
177
+ }
178
+ node_utils_1.logger.info(`Adding example file ${file}`);
179
+ form.append('examples', await (0, promises_1.readFile)(file, 'utf8'));
180
+ }, { allowMissing: true });
181
+ }
173
182
  await (0, node_utils_1.opendirSafe)(distPath, (fullpath, stat) => {
174
183
  if (!stat.isFile()) {
175
184
  return;
@@ -187,8 +196,8 @@ exports.makePayload = makePayload;
187
196
  /**
188
197
  * Publish a new block version.
189
198
  *
190
- * @param config - The block configuration
191
- * @param ignoreConflict - Prevent the command from crashing when a conflict has been detected.
199
+ * @param config The block configuration
200
+ * @param ignoreConflict Prevent the command from crashing when a conflict has been detected.
192
201
  */
193
202
  async function publishBlock(config, ignoreConflict) {
194
203
  node_utils_1.logger.info(`Publishing ${config.name}@${config.version}…`);
@@ -209,12 +218,12 @@ exports.publishBlock = publishBlock;
209
218
  /**
210
219
  * Uploads an app block theme
211
220
  *
212
- * @param filePath - The path of the index.css file
213
- * @param organization - The ID of the organization the block belongs to.
214
- * @param appId - The ID of the app to upload the theme for.
215
- * @param block - The name of the block.
216
- * @param remote - The HTTP origin to upload the theme to.
217
- * @param force - Force update the theme if the app is locked.
221
+ * @param filePath The path of the index.css file
222
+ * @param organization The ID of the organization the block belongs to.
223
+ * @param appId The ID of the app to upload the theme for.
224
+ * @param block The name of the block.
225
+ * @param remote The HTTP origin to upload the theme to.
226
+ * @param force Force update the theme if the app is locked.
218
227
  */
219
228
  async function uploadAppBlockTheme(filePath, organization, appId, block, remote, force) {
220
229
  node_utils_1.logger.info(`Upload ${organization}/${block} stylesheet for app ${appId}`);
@@ -226,10 +235,10 @@ exports.uploadAppBlockTheme = uploadAppBlockTheme;
226
235
  /**
227
236
  * Traverses the directory at a given path for app block themes and uploads them.
228
237
  *
229
- * @param path - The path of the app.
230
- * @param appId - The ID of the app.
231
- * @param remote - The HTTP origin to upload the themes to.
232
- * @param force - Force update the theme if the app is locked.
238
+ * @param path The path of the app.
239
+ * @param appId The ID of the app.
240
+ * @param remote The HTTP origin to upload the themes to.
241
+ * @param force Force update the theme if the app is locked.
233
242
  */
234
243
  async function traverseBlockThemes(path, appId, remote, force) {
235
244
  node_utils_1.logger.verbose(`Searching themes in ${path}`);
@@ -258,8 +267,8 @@ async function traverseBlockThemes(path, appId, remote, force) {
258
267
  exports.traverseBlockThemes = traverseBlockThemes;
259
268
  async function processBlockMessages(config, languages) {
260
269
  const path = (0, path_1.join)(config.dir, 'i18n');
261
- await fs_1.promises.mkdir(path, { recursive: true });
262
- const dir = await fs_1.promises.readdir(path);
270
+ await (0, promises_1.mkdir)(path, { recursive: true });
271
+ const dir = await (0, promises_1.readdir)(path);
263
272
  const { messages } = (0, getBlockConfigFromTypeScript_1.getBlockConfigFromTypeScript)(config);
264
273
  if (!messages) {
265
274
  node_utils_1.logger.warn(`Block ${config.name} has no messages.`);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.js","sourceRoot":"","sources":["block.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAkD;AAClD,0CAA2D;AAC3D,+BAAwE;AACxE,+BAA+B;AAE/B,sDAO+B;AAE/B,4CAAkD;AAClD,kDAA0B;AAC1B,kDAA0B;AAC1B,6CAA0C;AAC1C,0DAAiC;AAEjC,qCAAyC;AAEzC,iFAA8E;AAC9E,2DAAwD;AACxD,6CAA0C;AAE1C;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAAC,MAAmB;IAClD,MAAM,IAAI,GAAG,MAAM,IAAA,qCAAiB,EAAC,MAAM,EAAE,YAAY,EAA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