apify-cli 0.19.3-beta.4 → 1.0.0-beta.0

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 (231) hide show
  1. package/README.md +87 -63
  2. package/bin/dev.cmd +3 -0
  3. package/bin/dev.js +16 -0
  4. package/bin/run.js +16 -0
  5. package/dist/.tsbuildinfo +1 -0
  6. package/dist/commands/actor/get-input.d.ts +6 -0
  7. package/dist/commands/actor/get-input.d.ts.map +1 -0
  8. package/dist/commands/actor/get-input.js +14 -0
  9. package/dist/commands/actor/get-input.js.map +1 -0
  10. package/dist/commands/actor/get-value.d.ts +9 -0
  11. package/dist/commands/actor/get-value.d.ts.map +1 -0
  12. package/dist/commands/actor/get-value.js +27 -0
  13. package/dist/commands/actor/get-value.js.map +1 -0
  14. package/dist/commands/actor/index.d.ts +6 -0
  15. package/dist/commands/actor/index.d.ts.map +1 -0
  16. package/dist/commands/actor/index.js +13 -0
  17. package/dist/commands/actor/index.js.map +1 -0
  18. package/dist/commands/actor/push-data.d.ts +11 -0
  19. package/dist/commands/actor/push-data.d.ts.map +1 -0
  20. package/dist/commands/actor/push-data.js +56 -0
  21. package/dist/commands/actor/push-data.js.map +1 -0
  22. package/dist/commands/actor/set-value.d.ts +15 -0
  23. package/dist/commands/actor/set-value.d.ts.map +1 -0
  24. package/dist/commands/actor/set-value.js +76 -0
  25. package/dist/commands/actor/set-value.js.map +1 -0
  26. package/dist/commands/call.d.ts +15 -0
  27. package/dist/commands/call.d.ts.map +1 -0
  28. package/dist/commands/call.js +142 -0
  29. package/dist/commands/call.js.map +1 -0
  30. package/dist/commands/check-version.d.ts +11 -0
  31. package/dist/commands/check-version.d.ts.map +1 -0
  32. package/dist/commands/check-version.js +39 -0
  33. package/dist/commands/check-version.js.map +1 -0
  34. package/dist/commands/create.d.ts +14 -0
  35. package/dist/commands/create.d.ts.map +1 -0
  36. package/dist/commands/create.js +181 -0
  37. package/dist/commands/create.js.map +1 -0
  38. package/dist/commands/edit-input-schema.d.ts +11 -0
  39. package/dist/commands/edit-input-schema.d.ts.map +1 -0
  40. package/{src → dist}/commands/edit-input-schema.js +81 -85
  41. package/dist/commands/edit-input-schema.js.map +1 -0
  42. package/dist/commands/info.d.ts +6 -0
  43. package/dist/commands/info.d.ts.map +1 -0
  44. package/dist/commands/info.js +26 -0
  45. package/dist/commands/info.js.map +1 -0
  46. package/dist/commands/init-wrap-scrapy.d.ts +10 -0
  47. package/dist/commands/init-wrap-scrapy.d.ts.map +1 -0
  48. package/dist/commands/init-wrap-scrapy.js +41 -0
  49. package/dist/commands/init-wrap-scrapy.js.map +1 -0
  50. package/dist/commands/init.d.ts +12 -0
  51. package/dist/commands/init.d.ts.map +1 -0
  52. package/dist/commands/init.js +88 -0
  53. package/dist/commands/init.js.map +1 -0
  54. package/dist/commands/login-new.d.ts +10 -0
  55. package/dist/commands/login-new.d.ts.map +1 -0
  56. package/{src → dist}/commands/login-new.js +79 -82
  57. package/dist/commands/login-new.js.map +1 -0
  58. package/dist/commands/login.d.ts +9 -0
  59. package/dist/commands/login.d.ts.map +1 -0
  60. package/dist/commands/login.js +43 -0
  61. package/dist/commands/login.js.map +1 -0
  62. package/dist/commands/logout.d.ts +6 -0
  63. package/dist/commands/logout.d.ts.map +1 -0
  64. package/dist/commands/logout.js +20 -0
  65. package/dist/commands/logout.js.map +1 -0
  66. package/dist/commands/pull.d.ts +12 -0
  67. package/dist/commands/pull.d.ts.map +1 -0
  68. package/dist/commands/pull.js +148 -0
  69. package/dist/commands/pull.js.map +1 -0
  70. package/dist/commands/push.d.ts +16 -0
  71. package/dist/commands/push.d.ts.map +1 -0
  72. package/dist/commands/push.js +242 -0
  73. package/dist/commands/push.js.map +1 -0
  74. package/dist/commands/run.d.ts +12 -0
  75. package/dist/commands/run.d.ts.map +1 -0
  76. package/{src → dist}/commands/run.js +96 -109
  77. package/dist/commands/run.js.map +1 -0
  78. package/dist/commands/secrets/add.d.ts +10 -0
  79. package/dist/commands/secrets/add.d.ts.map +1 -0
  80. package/dist/commands/secrets/add.js +31 -0
  81. package/dist/commands/secrets/add.js.map +1 -0
  82. package/dist/commands/secrets/index.d.ts +6 -0
  83. package/dist/commands/secrets/index.d.ts.map +1 -0
  84. package/dist/commands/secrets/index.js +24 -0
  85. package/dist/commands/secrets/index.js.map +1 -0
  86. package/dist/commands/secrets/rm.d.ts +9 -0
  87. package/dist/commands/secrets/rm.d.ts.map +1 -0
  88. package/dist/commands/secrets/rm.js +27 -0
  89. package/dist/commands/secrets/rm.js.map +1 -0
  90. package/dist/commands/vis.d.ts +9 -0
  91. package/dist/commands/vis.d.ts.map +1 -0
  92. package/dist/commands/vis.js +52 -0
  93. package/dist/commands/vis.js.map +1 -0
  94. package/dist/hooks/init.d.ts +7 -0
  95. package/dist/hooks/init.d.ts.map +1 -0
  96. package/dist/hooks/init.js +17 -0
  97. package/dist/hooks/init.js.map +1 -0
  98. package/dist/index.d.ts +2 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +3 -0
  101. package/dist/index.js.map +1 -0
  102. package/dist/lib/actor.d.ts +27 -0
  103. package/dist/lib/actor.d.ts.map +1 -0
  104. package/{src → dist}/lib/actor.js +21 -44
  105. package/dist/lib/actor.js.map +1 -0
  106. package/dist/lib/apify-oclif-help.d.ts +15 -0
  107. package/dist/lib/apify-oclif-help.d.ts.map +1 -0
  108. package/dist/lib/apify-oclif-help.js +19 -0
  109. package/dist/lib/apify-oclif-help.js.map +1 -0
  110. package/dist/lib/apify_command.d.ts +22 -0
  111. package/dist/lib/apify_command.d.ts.map +1 -0
  112. package/dist/lib/apify_command.js +103 -0
  113. package/dist/lib/apify_command.js.map +1 -0
  114. package/dist/lib/community.d.ts +2 -0
  115. package/dist/lib/community.d.ts.map +1 -0
  116. package/dist/lib/community.js +4 -0
  117. package/dist/lib/community.js.map +1 -0
  118. package/dist/lib/consts.d.ts +45 -0
  119. package/dist/lib/consts.d.ts.map +1 -0
  120. package/dist/lib/consts.js +54 -0
  121. package/dist/lib/consts.js.map +1 -0
  122. package/dist/lib/create-utils.d.ts +8 -0
  123. package/dist/lib/create-utils.d.ts.map +1 -0
  124. package/{src → dist}/lib/create-utils.js +74 -113
  125. package/dist/lib/create-utils.js.map +1 -0
  126. package/dist/lib/exec.d.ts +4 -0
  127. package/dist/lib/exec.d.ts.map +1 -0
  128. package/{src → dist}/lib/exec.js +15 -16
  129. package/dist/lib/exec.js.map +1 -0
  130. package/dist/lib/files.d.ts +14 -0
  131. package/dist/lib/files.d.ts.map +1 -0
  132. package/dist/lib/files.js +58 -0
  133. package/dist/lib/files.js.map +1 -0
  134. package/dist/lib/input_schema.d.ts +26 -0
  135. package/dist/lib/input_schema.d.ts.map +1 -0
  136. package/{src → dist}/lib/input_schema.js +34 -55
  137. package/dist/lib/input_schema.js.map +1 -0
  138. package/dist/lib/local_state.d.ts +11 -0
  139. package/dist/lib/local_state.d.ts.map +1 -0
  140. package/dist/lib/local_state.js +27 -0
  141. package/dist/lib/local_state.js.map +1 -0
  142. package/dist/lib/outputs.d.ts +7 -0
  143. package/dist/lib/outputs.d.ts.map +1 -0
  144. package/{src → dist}/lib/outputs.js +8 -15
  145. package/dist/lib/outputs.js.map +1 -0
  146. package/dist/lib/project_analyzer.d.ts +4 -0
  147. package/dist/lib/project_analyzer.d.ts.map +1 -0
  148. package/{src → dist}/lib/project_analyzer.js +6 -11
  149. package/dist/lib/project_analyzer.js.map +1 -0
  150. package/dist/lib/projects/CrawleeAnalyzer.d.ts +4 -0
  151. package/dist/lib/projects/CrawleeAnalyzer.d.ts.map +1 -0
  152. package/{src → dist}/lib/projects/CrawleeAnalyzer.js +7 -24
  153. package/dist/lib/projects/CrawleeAnalyzer.js.map +1 -0
  154. package/dist/lib/projects/OldApifySDKAnalyzer.d.ts +4 -0
  155. package/dist/lib/projects/OldApifySDKAnalyzer.d.ts.map +1 -0
  156. package/{src → dist}/lib/projects/OldApifySDKAnalyzer.js +9 -32
  157. package/dist/lib/projects/OldApifySDKAnalyzer.js.map +1 -0
  158. package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts +17 -0
  159. package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts.map +1 -0
  160. package/{src/lib/scrapy-wrapper → dist/lib/projects/scrapy}/ScrapyProjectAnalyzer.js +33 -36
  161. package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.js.map +1 -0
  162. package/dist/lib/projects/scrapy/Spider.d.ts +14 -0
  163. package/dist/lib/projects/scrapy/Spider.d.ts.map +1 -0
  164. package/dist/lib/projects/scrapy/Spider.js +33 -0
  165. package/dist/lib/projects/scrapy/Spider.js.map +1 -0
  166. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts +7 -0
  167. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts.map +1 -0
  168. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js +25 -0
  169. package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js.map +1 -0
  170. package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts +4 -0
  171. package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts.map +1 -0
  172. package/{src/lib/scrapy-wrapper/index.js → dist/lib/projects/scrapy/wrapScrapyProject.js} +43 -73
  173. package/dist/lib/projects/scrapy/wrapScrapyProject.js.map +1 -0
  174. package/dist/lib/projects/shared.d.ts +2 -0
  175. package/dist/lib/projects/shared.d.ts.map +1 -0
  176. package/dist/lib/projects/shared.js +13 -0
  177. package/dist/lib/projects/shared.js.map +1 -0
  178. package/dist/lib/secrets.d.ts +22 -0
  179. package/dist/lib/secrets.d.ts.map +1 -0
  180. package/{src → dist}/lib/secrets.js +32 -40
  181. package/dist/lib/secrets.js.map +1 -0
  182. package/dist/lib/telemetry.d.ts +21 -0
  183. package/dist/lib/telemetry.d.ts.map +1 -0
  184. package/dist/lib/telemetry.js +87 -0
  185. package/dist/lib/telemetry.js.map +1 -0
  186. package/dist/lib/types.d.ts +11 -0
  187. package/dist/lib/types.d.ts.map +1 -0
  188. package/dist/lib/types.js +2 -0
  189. package/dist/lib/types.js.map +1 -0
  190. package/dist/lib/utils.d.ts +106 -0
  191. package/dist/lib/utils.d.ts.map +1 -0
  192. package/{src → dist}/lib/utils.js +235 -347
  193. package/dist/lib/utils.js.map +1 -0
  194. package/dist/lib/version_check.d.ts +14 -0
  195. package/dist/lib/version_check.d.ts.map +1 -0
  196. package/{src → dist}/lib/version_check.js +25 -54
  197. package/dist/lib/version_check.js.map +1 -0
  198. package/oclif.manifest.json +722 -1
  199. package/package.json +137 -113
  200. package/index.js +0 -1
  201. package/src/bin/run +0 -16
  202. package/src/commands/actor/get-input.js +0 -12
  203. package/src/commands/actor/get-value.js +0 -23
  204. package/src/commands/actor/index.js +0 -13
  205. package/src/commands/actor/push-data.js +0 -44
  206. package/src/commands/actor/set-value.js +0 -63
  207. package/src/commands/call.js +0 -131
  208. package/src/commands/check-version.js +0 -28
  209. package/src/commands/create.js +0 -203
  210. package/src/commands/info.js +0 -24
  211. package/src/commands/init-wrap-scrapy.js +0 -34
  212. package/src/commands/init.js +0 -83
  213. package/src/commands/login.js +0 -40
  214. package/src/commands/logout.js +0 -18
  215. package/src/commands/pull.js +0 -154
  216. package/src/commands/push.js +0 -234
  217. package/src/commands/secrets/add.js +0 -28
  218. package/src/commands/secrets/index.js +0 -24
  219. package/src/commands/secrets/rm.js +0 -23
  220. package/src/commands/vis.js +0 -50
  221. package/src/hooks/init.js +0 -16
  222. package/src/lib/apify-oclif-help.js +0 -23
  223. package/src/lib/apify_command.js +0 -82
  224. package/src/lib/community.js +0 -3
  225. package/src/lib/consts.js +0 -69
  226. package/src/lib/files.js +0 -76
  227. package/src/lib/local_state.js +0 -39
  228. package/src/lib/scrapy-wrapper/Spider.js +0 -10
  229. package/src/lib/scrapy-wrapper/SpiderFileAnalyzer.js +0 -26
  230. package/src/lib/telemetry.js +0 -104
  231. /package/{src/bin → bin}/run.cmd +0 -0
@@ -0,0 +1,54 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ import { readFileSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { KEY_VALUE_STORE_KEYS, META_ORIGINS } from '@apify/consts';
6
+ export const DEFAULT_LOCAL_STORAGE_DIR = 'storage';
7
+ export const LEGACY_LOCAL_STORAGE_DIR = 'apify_storage';
8
+ export const ACTOR_SPECIFICATION_VERSION = 1;
9
+ export const EMPTY_LOCAL_CONFIG = {
10
+ actorSpecification: ACTOR_SPECIFICATION_VERSION,
11
+ name: null,
12
+ version: '0.0',
13
+ buildTag: 'latest',
14
+ environmentVariables: {},
15
+ };
16
+ export const LANGUAGE = {
17
+ NODEJS: 'nodejs',
18
+ PYTHON: 'python',
19
+ UNKNOWN: 'n/a',
20
+ };
21
+ export const PROJECT_TYPES = {
22
+ SCRAPY: 'scrapy',
23
+ CRAWLEE: 'crawlee',
24
+ PRE_CRAWLEE_APIFY_SDK: 'apify',
25
+ UNKNOWN: 'unknown',
26
+ };
27
+ export const COMMANDS_WITHIN_ACTOR = ['init', 'run', 'push', 'pull', 'call'];
28
+ export const CHECK_VERSION_EVERY_MILLIS = 24 * 60 * 60 * 1000; // Once a day
29
+ export const GLOBAL_CONFIGS_FOLDER = () => {
30
+ const base = join(homedir(), '.apify');
31
+ if (process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__) {
32
+ return join(base, process.env.__APIFY_INTERNAL_TEST_AUTH_PATH__);
33
+ }
34
+ return base;
35
+ };
36
+ export const AUTH_FILE_PATH = () => join(GLOBAL_CONFIGS_FOLDER(), 'auth.json');
37
+ export const SECRETS_FILE_PATH = () => join(GLOBAL_CONFIGS_FOLDER(), 'secrets.json');
38
+ export const STATE_FILE_PATH = () => join(GLOBAL_CONFIGS_FOLDER(), 'state.json');
39
+ export const TELEMETRY_FILE_PATH = () => join(GLOBAL_CONFIGS_FOLDER(), 'telemetry.json');
40
+ export const DEPRECATED_LOCAL_CONFIG_NAME = 'apify.json';
41
+ export const ACTOR_SPECIFICATION_FOLDER = '.actor';
42
+ export const LOCAL_CONFIG_NAME = 'actor.json';
43
+ export const LOCAL_CONFIG_PATH = join(ACTOR_SPECIFICATION_FOLDER, LOCAL_CONFIG_NAME);
44
+ export const INPUT_FILE_REG_EXP = new RegExp(`^${KEY_VALUE_STORE_KEYS.INPUT}\\..*`);
45
+ export const MAIN_FILE = 'main.js';
46
+ export const UPLOADS_STORE_NAME = 'apify-cli-deployments';
47
+ const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));
48
+ export const SUPPORTED_NODEJS_VERSION = pkg.engines.node;
49
+ export const CURRENT_APIFY_CLI_VERSION = pkg.version;
50
+ export const APIFY_CLIENT_DEFAULT_HEADERS = { 'X-Apify-Request-Origin': META_ORIGINS.CLI };
51
+ export const MINIMUM_SUPPORTED_PYTHON_VERSION = '3.8.0';
52
+ export const PYTHON_VENV_PATH = '.venv';
53
+ export const MIXPANEL_TOKEN = 'ea75e434d4b4d2405d79ed9d14bfc93b';
54
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/lib/consts.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEnE,MAAM,CAAC,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AAExD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,kBAAkB,EAAE,2BAA2B;IAC/C,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,KAA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AAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAEzF,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC;AAEzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,CAAC;AAErF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,IAAI,oBAAoB,CAAC,KAAK,OAAO,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAE1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7F,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;AAEzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC,OAAO,CAAC;AAErD,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,wBAAwB,EAAE,YAAY,CAAC,GAAG,EAAE,CAAC;AAE3F,MAAM,CAAC,MAAM,gCAAgC,GAAG,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,kCAAkC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Manifest, Template } from '@apify/actor-templates';
2
+ export declare const ensureValidActorName: (maybeActorName?: string) => Promise<string>;
3
+ export declare const getTemplateDefinition: (maybeTemplateName: string | undefined, manifestPromise: Promise<Manifest | Error>) => Promise<Template>;
4
+ /**
5
+ * Fetch local readme suffix from the manifest and append it to the readme.
6
+ */
7
+ export declare const enhanceReadmeWithLocalSuffix: (readmePath: string, manifestPromise: Promise<Manifest | Error>) => Promise<void>;
8
+ //# sourceMappingURL=create-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-utils.d.ts","sourceRoot":"","sources":["../../src/lib/create-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAS5D,eAAO,MAAM,oBAAoB,oBAA2B,MAAM,oBAMjE,CAAC;AAGF,eAAO,MAAM,qBAAqB,sBAA6B,MAAM,GAAG,SAAS,mBAAmB,QAAQ,QAAQ,GAAG,KAAK,CAAC,sBAe5H,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,4BAA4B,eAAsB,MAAM,mBAAmB,QAAQ,QAAQ,GAAG,KAAK,CAAC,kBAchH,CAAC"}
@@ -1,40 +1,24 @@
1
- const fs = require('fs');
2
- const { pipeline } = require('stream');
3
- const { promisify } = require('util');
4
-
5
- const chalk = require('chalk');
6
- const inquirer = require('inquirer');
7
-
8
- const {
9
- warning,
10
- } = require('./outputs');
11
- const { validateActorName, httpsGet } = require('./utils');
12
-
1
+ import { createWriteStream } from 'node:fs';
2
+ import { pipeline } from 'node:stream/promises';
3
+ import chalk from 'chalk';
4
+ import inquirer from 'inquirer';
5
+ import { warning } from './outputs.js';
6
+ import { httpsGet, validateActorName } from './utils.js';
13
7
  const PROGRAMMING_LANGUAGES = ['JavaScript', 'TypeScript', 'Python'];
14
-
15
- /**
16
- * @param {string} maybeActorName
17
- * @returns {Promise<string>}
18
- */
19
- exports.ensureValidActorName = async (maybeActorName) => {
8
+ export const ensureValidActorName = async (maybeActorName) => {
20
9
  if (maybeActorName) {
21
10
  validateActorName(maybeActorName);
22
11
  return maybeActorName;
23
12
  }
24
13
  return promptActorName();
25
14
  };
26
-
27
- /**
28
- * @param {string} maybeTemplateName
29
- * @param {Promise<object>} manifestPromise
30
- * @returns {Promise<object>}
31
- */
32
- exports.getTemplateDefinition = async (maybeTemplateName, manifestPromise) => {
15
+ // TODO: this isn't even used anymore
16
+ export const getTemplateDefinition = async (maybeTemplateName, manifestPromise) => {
33
17
  const manifest = await manifestPromise;
34
18
  // If the fetch failed earlier, the resolve value of
35
19
  // the promise will be the error from fetching the manifest.
36
- if (manifest instanceof Error) throw manifest;
37
-
20
+ if (manifest instanceof Error)
21
+ throw manifest;
38
22
  if (maybeTemplateName) {
39
23
  const templateDefinition = manifest.templates.find((t) => t.name === maybeTemplateName);
40
24
  if (!templateDefinition) {
@@ -42,35 +26,30 @@ exports.getTemplateDefinition = async (maybeTemplateName, manifestPromise) => {
42
26
  }
43
27
  return templateDefinition;
44
28
  }
45
-
46
29
  return executePrompts(manifest);
47
30
  };
48
-
31
+ // TODO: this isn't even used anymore
49
32
  /**
50
33
  * Fetch local readme suffix from the manifest and append it to the readme.
51
- * @param {string} readmePath
52
- * @param {Promise<object>} manifestPromise
53
34
  */
54
- exports.enhanceReadmeWithLocalSuffix = async (readmePath, manifestPromise) => {
35
+ export const enhanceReadmeWithLocalSuffix = async (readmePath, manifestPromise) => {
55
36
  const manifest = await manifestPromise;
56
37
  // If the fetch failed earlier, the resolve value of
57
38
  // the promise will be the error from fetching the manifest.
58
- if (manifest instanceof Error) throw manifest;
59
-
39
+ if (manifest instanceof Error)
40
+ throw manifest;
60
41
  try {
61
42
  const suffixStream = await httpsGet(manifest.localReadmeSuffixUrl);
62
- const readmeStream = fs.createWriteStream(readmePath, { flags: 'a' });
43
+ const readmeStream = createWriteStream(readmePath, { flags: 'a' });
63
44
  readmeStream.write('\n\n');
64
- await promisify(pipeline)(suffixStream, readmeStream);
65
- } catch (err) {
45
+ await pipeline(suffixStream, readmeStream);
46
+ }
47
+ catch (err) {
66
48
  warning(`Could not append local development instructions to README.md. Cause: ${err.message}`);
67
49
  }
68
50
  };
69
-
70
51
  /**
71
52
  * Inquirer does not have a native way to "go back" between prompts.
72
- * @param {object} manifest
73
- * @returns {Promise<object>}
74
53
  */
75
54
  async function executePrompts(manifest) {
76
55
  const programmingLanguage = await promptProgrammingLanguage();
@@ -82,106 +61,88 @@ async function executePrompts(manifest) {
82
61
  if (shouldInstall) {
83
62
  return templateDefinition;
84
63
  }
85
- } else {
64
+ }
65
+ else {
86
66
  return executePrompts(manifest);
87
67
  }
88
68
  }
89
69
  }
90
-
91
- /**
92
- * @returns {Promise<string>}
93
- */
94
70
  async function promptActorName() {
95
71
  const answer = await inquirer.prompt([{
96
- name: 'actorName',
97
- message: 'Name of your new Actor:',
98
- type: 'input',
99
- validate: (promptText) => {
100
- try {
101
- validateActorName(promptText);
102
- } catch (err) {
103
- return err.message;
104
- }
105
- return true;
106
- },
107
- }]);
72
+ name: 'actorName',
73
+ message: 'Name of your new Actor:',
74
+ type: 'input',
75
+ validate: (promptText) => {
76
+ try {
77
+ validateActorName(promptText);
78
+ }
79
+ catch (err) {
80
+ return err.message;
81
+ }
82
+ return true;
83
+ },
84
+ }]);
108
85
  return answer.actorName;
109
86
  }
110
-
111
- /**
112
- * @returns {Promise<string>}
113
- */
114
87
  async function promptProgrammingLanguage() {
115
88
  const answer = await inquirer.prompt([{
116
- type: 'list',
117
- name: 'programmingLanguage',
118
- message: 'Choose the programming language of your new Actor:',
119
- default: PROGRAMMING_LANGUAGES[0],
120
- choices: PROGRAMMING_LANGUAGES,
121
- loop: false,
122
- }]);
89
+ type: 'list',
90
+ name: 'programmingLanguage',
91
+ message: 'Choose the programming language of your new Actor:',
92
+ default: PROGRAMMING_LANGUAGES[0],
93
+ choices: PROGRAMMING_LANGUAGES,
94
+ loop: false,
95
+ }]);
123
96
  return answer.programmingLanguage;
124
97
  }
125
-
126
- /**
127
- * @param {object} manifest
128
- * @param {string} programmingLanguage
129
- * @returns {Promise<object>} template definition
130
- */
131
98
  async function promptTemplateDefinition(manifest, programmingLanguage) {
132
- const choices = manifest.templates
133
- .filter((t) => {
99
+ const choices = [
100
+ ...manifest.templates
101
+ .filter((t) => {
134
102
  return t.category.toLowerCase() === programmingLanguage.toLowerCase();
135
103
  })
136
- .map((t) => {
104
+ .map((t) => {
137
105
  return {
138
106
  name: t.label,
139
107
  value: t,
140
108
  };
141
- });
142
-
143
- choices.push(new inquirer.Separator());
144
- choices.push({
145
- name: 'Go back',
146
- value: false,
147
- });
148
-
109
+ }),
110
+ new inquirer.Separator(),
111
+ {
112
+ name: 'Go back',
113
+ value: false,
114
+ },
115
+ ];
149
116
  const answer = await inquirer.prompt([{
150
- type: 'list',
151
- name: 'templateDefinition',
152
- message: 'Choose a template for your new Actor. Detailed information about the template will be shown in the next step.',
153
- default: choices[0],
154
- choices,
155
- loop: false,
156
- pageSize: 8,
157
- }]);
158
-
117
+ type: 'list',
118
+ name: 'templateDefinition',
119
+ message: 'Choose a template for your new Actor. Detailed information about the template will be shown in the next step.',
120
+ default: choices[0],
121
+ choices,
122
+ loop: false,
123
+ pageSize: 8,
124
+ }]);
159
125
  return answer.templateDefinition;
160
126
  }
161
-
162
- /**
163
- * @param {object} templateDefinition
164
- * @returns {Promise<string>}
165
- */
166
127
  async function promptTemplateInstallation(templateDefinition) {
167
- const choices = [{ name: `Install template`, value: true }];
168
- choices.push(new inquirer.Separator());
169
- choices.push({ name: 'Go back', value: false });
170
-
128
+ const choices = [
129
+ { name: `Install template`, value: true },
130
+ new inquirer.Separator(),
131
+ { name: 'Go back', value: false },
132
+ ];
171
133
  const message = 'Do you want to install the following template?';
172
134
  const label = chalk.underline(templateDefinition.label);
173
135
  const description = chalk.dim(templateDefinition.description);
174
136
  const suffix = `\n ${label}:\n ${description}`;
175
-
176
137
  const answer = await inquirer.prompt([{
177
- type: 'list',
178
- name: 'shouldInstall',
179
- message,
180
- suffix,
181
- default: choices[0],
182
- choices,
183
- loop: false,
184
- }]);
185
-
138
+ type: 'list',
139
+ name: 'shouldInstall',
140
+ message,
141
+ suffix,
142
+ default: choices[0],
143
+ choices,
144
+ loop: false,
145
+ }]);
186
146
  return answer.shouldInstall;
187
147
  }
148
+ //# sourceMappingURL=create-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-utils.js","sourceRoot":"","sources":["../../src/lib/create-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,cAAuB,EAAE,EAAE;IAClE,IAAI,cAAc,EAAE,CAAC;QACjB,iBAAiB,CAAC,cAAc,CAAC,CAAC;QAClC,OAAO,cAAc,CAAC;IAC1B,CAAC;IACD,OAAO,eAAe,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,qCAAqC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAE,iBAAqC,EAAE,eAA0C,EAAE,EAAE;IAC7H,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC;IACvC,oDAAoD;IACpD,4DAA4D;IAC5D,IAAI,QAAQ,YAAY,KAAK;QAAE,MAAM,QAAQ,CAAC;IAE9C,IAAI,iBAAiB,EAAE,CAAC;QACpB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAC;QACxF,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,yCAAyC,iBAAiB,4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
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { SpawnOptionsWithoutStdio } from 'node:child_process';
3
+ export declare function execWithLog(cmd: string, args?: string[], opts?: SpawnOptionsWithoutStdio): Promise<void>;
4
+ //# sourceMappingURL=exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/lib/exec.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAS,MAAM,oBAAoB,CAAC;AAiCrE,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAO,EAAE,IAAI,GAAE,wBAA6B,iBAGtG"}
@@ -1,36 +1,35 @@
1
- const { spawn } = require('child_process');
2
-
3
- const outputs = require('./outputs');
4
-
1
+ import { spawn } from 'node:child_process';
2
+ import { run } from './outputs.js';
5
3
  /**
6
4
  * Run child process and returns stdout and stderr to user stout
7
5
  */
8
- const spawnPromised = (cmd, args, opts) => {
6
+ const spawnPromised = async (cmd, args, opts) => {
9
7
  // NOTE: Pipes stderr, stdout to main process
10
- Object.assign(opts, { stdio: 'inherit' });
11
-
12
- const childProcess = spawn(cmd, args, opts);
13
-
8
+ const childProcess = spawn(cmd, args, {
9
+ ...opts,
10
+ stdio: 'inherit',
11
+ });
14
12
  // Catch ctrl-c (SIGINT) and kills child process
15
13
  // NOTE: This fix kills also puppeteer child node process
16
14
  process.on('SIGINT', () => {
17
15
  try {
18
16
  childProcess.kill();
19
- } catch (err) {
17
+ }
18
+ catch {
20
19
  // SIGINT can come after the child process is finished, ignore it
21
20
  }
22
21
  });
23
-
24
22
  return new Promise((resolve, reject) => {
25
23
  childProcess.on('error', reject);
26
24
  childProcess.on('close', (code) => {
27
- if (code !== 0) reject(new Error(`${cmd} exited with code ${code}`));
25
+ if (code !== 0)
26
+ reject(new Error(`${cmd} exited with code ${code}`));
28
27
  resolve();
29
28
  });
30
29
  });
31
30
  };
32
-
33
- module.exports = async (cmd, args = [], opts = {}) => {
34
- outputs.run(`${cmd} ${args.join(' ')}`);
31
+ export async function execWithLog(cmd, args = [], opts = {}) {
32
+ run(`${cmd} ${args.join(' ')}`);
35
33
  await spawnPromised(cmd, args, opts);
36
- };
34
+ }
35
+ //# sourceMappingURL=exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/lib/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,aAAa,GAAG,KAAK,EAAE,GAAW,EAAE,IAAc,EAAE,IAA8B,EAAE,EAAE;IACxF,6CAA6C;IAC7C,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE;QAClC,GAAG,IAAI;QACP,KAAK,EAAE,SAAS;KACnB,CAAC,CAAC;IAEH,gDAAgD;IAChD,yDAAyD;IACzD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,IAAI,CAAC;YACD,YAAY,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACL,iEAAiE;QACrE,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACjC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9B,IAAI,IAAI,KAAK,CAAC;gBAAE,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,GAAG,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAAC;YACrE,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW,EAAE,OAAiB,EAAE,EAAE,OAAiC,EAAE;IACnG,GAAG,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,MAAM,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const updateLocalJson: (jsonFilePath: string, updateAttrs?: Record<string, unknown>, nestedObjectAttr?: null) => Promise<void>;
2
+ /**
3
+ * If you pass /foo/bar as rootPath and /baz/raz as folderPath then it ensures that following folders exists:
4
+ *
5
+ * /foo/bar/baz
6
+ * /foo/bar/baz/raz
7
+ *
8
+ * If you pass only one parameter then rootPath is considered to be '.'
9
+ */
10
+ export declare const ensureFolderExistsSync: (rootPath: string, folderPath?: string) => void;
11
+ export declare const rimrafPromised: (pathToBeRemoved: string | string[]) => Promise<void>;
12
+ export declare const deleteFile: (filePath: string) => Promise<void>;
13
+ export declare const sumFilesSizeInBytes: (pathToFiles: string[], cwd: string) => Promise<number>;
14
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/lib/files.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,iBAAwB,MAAM,gBAAe,OAAO,MAAM,EAAE,OAAO,CAAC,2CAa/F,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,aAAc,MAAM,eAAe,MAAM,SAgB3E,CAAC;AAEF,eAAO,MAAM,cAAc,oBAA2B,MAAM,GAAG,MAAM,EAAE,kBAEtE,CAAC;AAEF,eAAO,MAAM,UAAU,aAAoB,MAAM,kBAKhD,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAAuB,MAAM,EAAE,OAAO,MAAM,oBAQ3E,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { existsSync, mkdirSync } from 'node:fs';
2
+ import { stat, unlink } from 'node:fs/promises';
3
+ import { join, sep } from 'node:path';
4
+ import { loadJsonFile } from 'load-json-file';
5
+ import { rimraf } from 'rimraf';
6
+ import { writeJsonFile } from 'write-json-file';
7
+ export const updateLocalJson = async (jsonFilePath, updateAttrs = {}, nestedObjectAttr = null) => {
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ const currentObject = await loadJsonFile(jsonFilePath);
10
+ let newObject;
11
+ if (nestedObjectAttr) {
12
+ newObject = currentObject;
13
+ newObject[nestedObjectAttr] = { ...currentObject[nestedObjectAttr], ...updateAttrs };
14
+ }
15
+ else {
16
+ newObject = { ...currentObject, ...updateAttrs };
17
+ }
18
+ await writeJsonFile(jsonFilePath, newObject);
19
+ };
20
+ /**
21
+ * If you pass /foo/bar as rootPath and /baz/raz as folderPath then it ensures that following folders exists:
22
+ *
23
+ * /foo/bar/baz
24
+ * /foo/bar/baz/raz
25
+ *
26
+ * If you pass only one parameter then rootPath is considered to be '.'
27
+ */
28
+ export const ensureFolderExistsSync = (rootPath, folderPath) => {
29
+ if (!folderPath) {
30
+ folderPath = rootPath;
31
+ rootPath = '.';
32
+ }
33
+ const parts = folderPath.split(sep);
34
+ parts.reduce((currentPath, currentDir) => {
35
+ currentPath = join(currentPath, currentDir);
36
+ if (!existsSync(currentPath)) {
37
+ mkdirSync(currentPath);
38
+ }
39
+ return currentPath;
40
+ }, rootPath);
41
+ };
42
+ export const rimrafPromised = async (pathToBeRemoved) => {
43
+ await rimraf(pathToBeRemoved);
44
+ };
45
+ export const deleteFile = async (filePath) => {
46
+ const res = await stat(filePath);
47
+ if (res.isFile()) {
48
+ await unlink(filePath);
49
+ }
50
+ };
51
+ export const sumFilesSizeInBytes = async (pathToFiles, cwd) => {
52
+ const filesStats = await Promise.all(pathToFiles.map(async (filePath) => stat(join(cwd, filePath))));
53
+ const filesSizeBytes = filesStats
54
+ .map((stats) => stats.size)
55
+ .reduce((sum, fileSize) => sum + fileSize, 0);
56
+ return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C;IAElD,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Return the input schema from the default location.
3
+ *
4
+ * When the input schema does not exist, null is returned for schema.
5
+ * In such a case, path would be set to the location
6
+ * where the input schema would be expected to be found (and e.g. can be created there).
7
+ */
8
+ export declare const readInputSchema: ({ forcePath, cwd }?: {
9
+ forcePath?: string | undefined;
10
+ cwd: string;
11
+ }) => Promise<{
12
+ inputSchema: Record<string, unknown> | undefined;
13
+ inputSchemaPath: string;
14
+ } | {
15
+ inputSchema: Record<string, unknown>;
16
+ inputSchemaPath: null;
17
+ } | {
18
+ inputSchema: null;
19
+ inputSchemaPath: string;
20
+ }>;
21
+ /**
22
+ * Goes to the Actor directory and creates INPUT.json file from the input schema prefills.
23
+
24
+ */
25
+ export declare const createPrefilledInputFileFromInputSchema: (actorFolderDir: string) => Promise<void>;
26
+ //# sourceMappingURL=input_schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input_schema.d.ts","sourceRoot":"","sources":["../../src/lib/input_schema.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;SAAyD,MAAM;;;;;;;;;;EA6C1F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uCAAuC,mBAA0B,MAAM,kBA2BnF,CAAC"}