@fastly/compute-js-static-publish 8.0.0 → 8.1.0-beta.1

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 (251) hide show
  1. package/DOCUMENTATION.md +1984 -0
  2. package/README.md +11 -4
  3. package/README.short.md +11 -4
  4. package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
  5. package/build/cli/cli/commands/manage/clean.js +12 -7
  6. package/build/cli/cli/commands/manage/collections/delete.d.ts.map +1 -1
  7. package/build/cli/cli/commands/manage/collections/delete.js +29 -13
  8. package/build/cli/cli/commands/manage/collections/index.d.ts.map +1 -1
  9. package/build/cli/cli/commands/manage/collections/index.js +6 -1
  10. package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
  11. package/build/cli/cli/commands/manage/collections/list.js +47 -7
  12. package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
  13. package/build/cli/cli/commands/manage/collections/promote.js +67 -20
  14. package/build/cli/cli/commands/manage/collections/update-expiration.d.ts.map +1 -1
  15. package/build/cli/cli/commands/manage/collections/update-expiration.js +10 -11
  16. package/build/cli/cli/commands/manage/deploy.d.ts +2 -0
  17. package/build/cli/cli/commands/manage/deploy.d.ts.map +1 -0
  18. package/build/cli/cli/commands/manage/deploy.js +194 -0
  19. package/build/cli/cli/commands/manage/dev.d.ts +2 -0
  20. package/build/cli/cli/commands/manage/dev.d.ts.map +1 -0
  21. package/build/cli/cli/commands/manage/dev.js +77 -0
  22. package/build/cli/cli/commands/manage/eject.d.ts +2 -0
  23. package/build/cli/cli/commands/manage/eject.d.ts.map +1 -0
  24. package/build/cli/cli/commands/manage/eject.js +155 -0
  25. package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
  26. package/build/cli/cli/commands/manage/index.js +37 -1
  27. package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
  28. package/build/cli/cli/commands/manage/publish-content.js +85 -35
  29. package/build/cli/cli/commands/manage/status.d.ts +2 -0
  30. package/build/cli/cli/commands/manage/status.d.ts.map +1 -0
  31. package/build/cli/cli/commands/manage/status.js +162 -0
  32. package/build/cli/cli/commands/manage/template/index.d.ts +2 -0
  33. package/build/cli/cli/commands/manage/template/index.d.ts.map +1 -0
  34. package/build/cli/cli/commands/manage/template/index.js +42 -0
  35. package/build/cli/cli/commands/manage/template/init.d.ts +13 -0
  36. package/build/cli/cli/commands/manage/template/init.d.ts.map +1 -0
  37. package/build/cli/cli/commands/manage/template/init.js +172 -0
  38. package/build/cli/cli/commands/manage/upgrade.d.ts +2 -0
  39. package/build/cli/cli/commands/manage/upgrade.d.ts.map +1 -0
  40. package/build/cli/cli/commands/manage/upgrade.js +59 -0
  41. package/build/cli/cli/commands/run-dev-watch.d.ts +8 -0
  42. package/build/cli/cli/commands/run-dev-watch.d.ts.map +1 -0
  43. package/build/cli/cli/commands/run-dev-watch.js +41 -0
  44. package/build/cli/cli/commands/run-template-hook.d.ts +2 -0
  45. package/build/cli/cli/commands/run-template-hook.d.ts.map +1 -0
  46. package/build/cli/cli/commands/run-template-hook.js +28 -0
  47. package/build/cli/cli/commands/scaffold/app-template.d.ts +17 -0
  48. package/build/cli/cli/commands/scaffold/app-template.d.ts.map +1 -0
  49. package/build/cli/cli/commands/scaffold/app-template.js +54 -0
  50. package/build/cli/cli/commands/scaffold/fastly-toml-sections.d.ts +5 -0
  51. package/build/cli/cli/commands/scaffold/fastly-toml-sections.d.ts.map +1 -0
  52. package/build/cli/cli/commands/scaffold/fastly-toml-sections.js +154 -0
  53. package/build/cli/cli/commands/scaffold/generate-app.d.ts +47 -0
  54. package/build/cli/cli/commands/scaffold/generate-app.d.ts.map +1 -0
  55. package/build/cli/cli/commands/scaffold/generate-app.js +164 -0
  56. package/build/cli/cli/commands/scaffold/index.d.ts +6 -0
  57. package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
  58. package/build/cli/cli/commands/scaffold/index.js +239 -300
  59. package/build/cli/cli/commands/scaffold/render.d.ts +7 -0
  60. package/build/cli/cli/commands/scaffold/render.d.ts.map +1 -0
  61. package/build/cli/cli/commands/scaffold/render.js +72 -0
  62. package/build/cli/cli/hono/build.d.ts +43 -0
  63. package/build/cli/cli/hono/build.d.ts.map +1 -0
  64. package/build/cli/cli/hono/build.js +297 -0
  65. package/build/cli/cli/index.js +98 -5
  66. package/build/cli/cli/managed/app.d.ts +21 -0
  67. package/build/cli/cli/managed/app.d.ts.map +1 -0
  68. package/build/cli/cli/managed/app.js +162 -0
  69. package/build/cli/cli/managed/command-helpers.d.ts +6 -0
  70. package/build/cli/cli/managed/command-helpers.d.ts.map +1 -0
  71. package/build/cli/cli/managed/command-helpers.js +81 -0
  72. package/build/cli/cli/managed/eject.d.ts +6 -0
  73. package/build/cli/cli/managed/eject.d.ts.map +1 -0
  74. package/build/cli/cli/managed/eject.js +68 -0
  75. package/build/cli/cli/managed/fastly-service.d.ts +8 -0
  76. package/build/cli/cli/managed/fastly-service.d.ts.map +1 -0
  77. package/build/cli/cli/managed/fastly-service.js +21 -0
  78. package/build/cli/cli/managed/fingerprint.d.ts +13 -0
  79. package/build/cli/cli/managed/fingerprint.d.ts.map +1 -0
  80. package/build/cli/cli/managed/fingerprint.js +60 -0
  81. package/build/cli/cli/managed/lockfile.d.ts +31 -0
  82. package/build/cli/cli/managed/lockfile.d.ts.map +1 -0
  83. package/build/cli/cli/managed/lockfile.js +62 -0
  84. package/build/cli/cli/managed/project-edit.d.ts +3 -0
  85. package/build/cli/cli/managed/project-edit.d.ts.map +1 -0
  86. package/build/cli/cli/managed/project-edit.js +35 -0
  87. package/build/cli/cli/managed/project-file.d.ts +16 -0
  88. package/build/cli/cli/managed/project-file.d.ts.map +1 -0
  89. package/build/cli/cli/managed/project-file.js +119 -0
  90. package/build/cli/cli/managed/template-init.d.ts +12 -0
  91. package/build/cli/cli/managed/template-init.d.ts.map +1 -0
  92. package/build/cli/cli/managed/template-init.js +120 -0
  93. package/build/cli/cli/managed/version-check.d.ts +25 -0
  94. package/build/cli/cli/managed/version-check.d.ts.map +1 -0
  95. package/build/cli/cli/managed/version-check.js +84 -0
  96. package/build/cli/cli/storage/kv-store-local-provider.d.ts +1 -0
  97. package/build/cli/cli/storage/kv-store-local-provider.d.ts.map +1 -1
  98. package/build/cli/cli/storage/kv-store-local-provider.js +6 -3
  99. package/build/cli/cli/storage/kv-store-provider.d.ts +2 -1
  100. package/build/cli/cli/storage/kv-store-provider.d.ts.map +1 -1
  101. package/build/cli/cli/storage/kv-store-provider.js +17 -6
  102. package/build/cli/cli/storage/s3-storage-provider.d.ts +1 -0
  103. package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
  104. package/build/cli/cli/storage/s3-storage-provider.js +8 -2
  105. package/build/cli/cli/storage/storage-provider.d.ts +4 -0
  106. package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
  107. package/build/cli/cli/storage/storage-provider.js +32 -0
  108. package/build/cli/cli/util/api-token.d.ts +2 -1
  109. package/build/cli/cli/util/api-token.d.ts.map +1 -1
  110. package/build/cli/cli/util/api-token.js +38 -3
  111. package/build/cli/cli/util/collection-name.d.ts +3 -0
  112. package/build/cli/cli/util/collection-name.d.ts.map +1 -0
  113. package/build/cli/cli/util/collection-name.js +24 -0
  114. package/build/cli/cli/util/collection-selection-flags.d.ts +13 -0
  115. package/build/cli/cli/util/collection-selection-flags.d.ts.map +1 -0
  116. package/build/cli/cli/util/collection-selection-flags.js +131 -0
  117. package/build/cli/cli/util/config.d.ts +13 -0
  118. package/build/cli/cli/util/config.d.ts.map +1 -1
  119. package/build/cli/cli/util/config.js +172 -38
  120. package/build/cli/cli/util/data.d.ts.map +1 -1
  121. package/build/cli/cli/util/global-options.d.ts +13 -0
  122. package/build/cli/cli/util/global-options.d.ts.map +1 -0
  123. package/build/cli/cli/util/global-options.js +53 -0
  124. package/build/cli/cli/util/kv-store-items.d.ts +1 -0
  125. package/build/cli/cli/util/kv-store-items.d.ts.map +1 -1
  126. package/build/cli/cli/util/kv-store-items.js +16 -40
  127. package/build/cli/cli/util/kv-store-local-server.d.ts +1 -1
  128. package/build/cli/cli/util/kv-store-local-server.d.ts.map +1 -1
  129. package/build/cli/cli/util/kv-store-local-server.js +4 -2
  130. package/build/cli/cli/util/output.d.ts +31 -0
  131. package/build/cli/cli/util/output.d.ts.map +1 -0
  132. package/build/cli/cli/util/output.js +139 -0
  133. package/build/cli/cli/util/package.d.ts +3 -0
  134. package/build/cli/cli/util/package.d.ts.map +1 -1
  135. package/build/cli/cli/util/package.js +12 -0
  136. package/build/cli/cli/util/progress.d.ts +11 -0
  137. package/build/cli/cli/util/progress.d.ts.map +1 -0
  138. package/build/cli/cli/util/progress.js +32 -0
  139. package/build/cli/cli/util/purge.d.ts +15 -3
  140. package/build/cli/cli/util/purge.d.ts.map +1 -1
  141. package/build/cli/cli/util/purge.js +23 -10
  142. package/build/cli/cli/util/resources.d.ts +2 -0
  143. package/build/cli/cli/util/resources.d.ts.map +1 -0
  144. package/build/cli/cli/util/resources.js +8 -0
  145. package/build/cli/cli/util/service-id.d.ts +1 -0
  146. package/build/cli/cli/util/service-id.d.ts.map +1 -1
  147. package/build/cli/cli/util/service-id.js +5 -1
  148. package/build/cli/cli/util/variants.d.ts.map +1 -1
  149. package/build/cli/models/assets/index.d.ts +6 -0
  150. package/build/cli/models/assets/index.d.ts.map +1 -1
  151. package/build/cli/models/assets/index.js +24 -0
  152. package/build/cli/models/collections/index.d.ts +3 -0
  153. package/build/cli/models/collections/index.d.ts.map +1 -0
  154. package/build/cli/models/collections/index.js +15 -0
  155. package/build/cli/models/compression/index.d.ts +1 -1
  156. package/build/cli/models/compression/index.d.ts.map +1 -1
  157. package/build/cli/models/config/collection-selection.d.ts +55 -0
  158. package/build/cli/models/config/collection-selection.d.ts.map +1 -0
  159. package/build/cli/models/config/collection-selection.js +238 -0
  160. package/build/cli/models/config/item-patterns.d.ts +4 -0
  161. package/build/cli/models/config/item-patterns.d.ts.map +1 -0
  162. package/build/cli/models/config/item-patterns.js +43 -0
  163. package/build/cli/models/config/publish-content-config.d.ts +6 -1
  164. package/build/cli/models/config/publish-content-config.d.ts.map +1 -1
  165. package/build/cli/models/config/static-publish-project.d.ts +23 -0
  166. package/build/cli/models/config/static-publish-project.d.ts.map +1 -0
  167. package/build/cli/models/config/static-publish-project.js +11 -0
  168. package/build/cli/models/config/static-publish-rc.d.ts +25 -0
  169. package/build/cli/models/config/static-publish-rc.d.ts.map +1 -1
  170. package/build/cli/models/config/static-publish-rc.js +31 -0
  171. package/build/cli/models/config/template-settings.d.ts +10 -0
  172. package/build/cli/models/config/template-settings.d.ts.map +1 -0
  173. package/build/cli/models/config/template-settings.js +72 -0
  174. package/build/cli/models/server/index.d.ts.map +1 -1
  175. package/build/cli/models/server/index.js +6 -2
  176. package/build/server/hono/extensions.d.ts +48 -0
  177. package/build/server/hono/extensions.d.ts.map +1 -0
  178. package/build/server/hono/extensions.js +65 -0
  179. package/build/server/hono/index.d.ts +30 -0
  180. package/build/server/hono/index.d.ts.map +1 -0
  181. package/build/server/hono/index.js +72 -0
  182. package/build/server/hono/path.d.ts +7 -0
  183. package/build/server/hono/path.d.ts.map +1 -0
  184. package/build/server/hono/path.js +32 -0
  185. package/build/server/models/assets/index.d.ts +6 -0
  186. package/build/server/models/assets/index.d.ts.map +1 -1
  187. package/build/server/models/assets/index.js +24 -0
  188. package/build/server/models/collections/index.d.ts +3 -0
  189. package/build/server/models/collections/index.d.ts.map +1 -0
  190. package/build/server/models/collections/index.js +15 -0
  191. package/build/server/models/compression/index.d.ts +1 -1
  192. package/build/server/models/compression/index.d.ts.map +1 -1
  193. package/build/server/models/config/collection-selection.d.ts +55 -0
  194. package/build/server/models/config/collection-selection.d.ts.map +1 -0
  195. package/build/server/models/config/collection-selection.js +238 -0
  196. package/build/server/models/config/item-patterns.d.ts +4 -0
  197. package/build/server/models/config/item-patterns.d.ts.map +1 -0
  198. package/build/server/models/config/item-patterns.js +43 -0
  199. package/build/server/models/config/publish-content-config.d.ts +6 -1
  200. package/build/server/models/config/publish-content-config.d.ts.map +1 -1
  201. package/build/server/models/config/static-publish-project.d.ts +23 -0
  202. package/build/server/models/config/static-publish-project.d.ts.map +1 -0
  203. package/build/server/models/config/static-publish-project.js +11 -0
  204. package/build/server/models/config/static-publish-rc.d.ts +25 -0
  205. package/build/server/models/config/static-publish-rc.d.ts.map +1 -1
  206. package/build/server/models/config/static-publish-rc.js +31 -0
  207. package/build/server/models/server/index.d.ts.map +1 -1
  208. package/build/server/models/server/index.js +6 -2
  209. package/build/server/server/collection-selection/index.d.ts +11 -0
  210. package/build/server/server/collection-selection/index.d.ts.map +1 -0
  211. package/build/server/server/collection-selection/index.js +192 -0
  212. package/build/server/server/collection-selector/from-cookie.d.ts.map +1 -1
  213. package/build/server/server/collection-selector/from-cookie.js +6 -8
  214. package/build/server/server/collection-selector/from-request.d.ts.map +1 -1
  215. package/build/server/server/index.d.ts +4 -1
  216. package/build/server/server/index.d.ts.map +1 -1
  217. package/build/server/server/index.js +3 -1
  218. package/build/server/server/publisher-server/accept-html.d.ts +2 -0
  219. package/build/server/server/publisher-server/accept-html.d.ts.map +1 -0
  220. package/build/server/server/publisher-server/accept-html.js +50 -0
  221. package/build/server/server/publisher-server/index.d.ts +59 -6
  222. package/build/server/server/publisher-server/index.d.ts.map +1 -1
  223. package/build/server/server/publisher-server/index.js +370 -131
  224. package/build/server/server/publisher-server/response-cache.d.ts +3 -0
  225. package/build/server/server/publisher-server/response-cache.d.ts.map +1 -1
  226. package/build/server/server/publisher-server/response-cache.js +24 -1
  227. package/build/server/server/storage/kv-store-provider.d.ts.map +1 -1
  228. package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
  229. package/build/server/server/storage/storage-provider.d.ts.map +1 -1
  230. package/build/server/server/util/body-length.d.ts.map +1 -1
  231. package/build/server/server/util/server-timing.d.ts.map +1 -1
  232. package/package.json +23 -4
  233. package/resources/app/fastly.toml.njk +58 -0
  234. package/resources/app/gitignore.njk +9 -0
  235. package/resources/app/publish-content.config.from-project.js.njk +9 -0
  236. package/resources/app/publish-content.config.js.njk +35 -0
  237. package/resources/app/static-publish.project.js.njk +83 -0
  238. package/resources/app/static-publish.rc.js.njk +43 -0
  239. package/resources/template-init/hono/_example.ts +22 -0
  240. package/resources/template-init/hono/tsconfig.json +17 -0
  241. package/resources/templates/hono/package-lock.json +4123 -0
  242. package/resources/templates/hono/package.json +15 -0
  243. package/resources/templates/hono/scripts/template_postinstall.js +10 -0
  244. package/resources/templates/hono/scripts/template_prebuild.js +8 -0
  245. package/resources/templates/hono/scripts/template_watch.js +15 -0
  246. package/resources/templates/hono/src/hono-extensions.generated.d.ts +5 -0
  247. package/resources/templates/hono/src/index.ts +53 -0
  248. package/resources/templates/hono/tsconfig.json +17 -0
  249. package/resources/templates/plain/package-lock.json +4088 -0
  250. package/resources/templates/plain/package.json +10 -0
  251. package/resources/templates/plain/src/index.js +34 -0
@@ -0,0 +1,172 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import readline from 'node:readline/promises';
8
+ import { MANAGED_APP_DIR, PROJECT_FILE_NAME, RC_FILE_NAME } from '../../../../models/config/static-publish-project.js';
9
+ import { DEFAULT_APP_TEMPLATE_NAME } from '../../scaffold/app-template.js';
10
+ import { DEFAULT_HONO_EXTENSIONS_DIR } from '../../../hono/build.js';
11
+ import { loadManagedProject } from '../../../managed/command-helpers.js';
12
+ import { applyTemplateInit, planTemplateInit, providedVersions, templateHasInit } from '../../../managed/template-init.js';
13
+ import { parseCommandLine } from '../../../util/args.js';
14
+ import { LoadConfigError, detectProjectMode, loadStaticPublisherRcFile } from '../../../util/config.js';
15
+ import { rootRelative } from '../../../util/files.js';
16
+ import { fail, isNonInteractive, recordFailure } from '../../../util/output.js';
17
+ import { getOwnVersion } from '../../../util/package.js';
18
+ function help() {
19
+ console.log(`\
20
+
21
+ Usage:
22
+ npx @fastly/compute-js-static-publish template init [options]
23
+
24
+ Description:
25
+ Makes or updates the folder of the app's template: for the hono template,
26
+ the extensions folder (build.hono.extensionsDir, default ./hono-extensions).
27
+ The template is managed.template in ${PROJECT_FILE_NAME}, or
28
+ generatedFrom.template in ${RC_FILE_NAME}.
29
+
30
+ A new folder gets package.json, tsconfig.json, and inactive examples. In a
31
+ folder that exists, it updates only the peer dependencies on the packages
32
+ that the app provides, and adds the starter files that are missing. It never
33
+ changes your modules. Then run npm install in the folder.
34
+
35
+ Options:
36
+ --reset Also write the starter files again (tsconfig.json
37
+ and the examples). Asks before it replaces a file,
38
+ or needs --force in non-interactive mode.
39
+ --force With --reset: replace without a question.
40
+ --check Change nothing. Fail (template-init-needed) if
41
+ the folder is out of date. For CI.
42
+
43
+ Global Options:
44
+ -h, --help Show this help message and exit.
45
+ `);
46
+ }
47
+ // The folder of a template.
48
+ function templateFolderDir(templateName, rc, baseDir) {
49
+ // Only the hono template has a folder.
50
+ return path.resolve(baseDir, rc.build?.hono?.extensionsDir ?? DEFAULT_HONO_EXTENSIONS_DIR);
51
+ }
52
+ // template init for a template and a folder. scaffold also runs it.
53
+ export async function runTemplateInit(params) {
54
+ const { templateName, rc, baseDir, appNodeModulesDir, reset = false, force = false, check = false } = params;
55
+ if (!templateHasInit(templateName)) {
56
+ console.log(`✔️ The template '${templateName}' has no folder to initialize.`);
57
+ return;
58
+ }
59
+ const folderDir = templateFolderDir(templateName, rc, baseDir);
60
+ const folderName = rootRelative(folderDir);
61
+ const provided = providedVersions(templateName, appNodeModulesDir, getOwnVersion());
62
+ const plan = planTemplateInit(templateName, folderDir, provided, { reset });
63
+ if (check) {
64
+ if (plan.outOfDate.length > 0) {
65
+ fail('template-init-needed', `${folderName} is out of date. Run: npx @fastly/compute-js-static-publish template init`);
66
+ for (const reason of plan.outOfDate) {
67
+ console.error(` * ${reason}`);
68
+ }
69
+ return;
70
+ }
71
+ console.log(`✅ ${folderName} is up to date.`);
72
+ return;
73
+ }
74
+ if (plan.replace.length > 0 && !force) {
75
+ console.log(`template init --reset replaces these files in ${folderName}:`);
76
+ for (const file of plan.replace) {
77
+ console.log(` * ${file}`);
78
+ }
79
+ if (isNonInteractive()) {
80
+ fail('usage', 'In non-interactive mode, template init --reset needs --force to replace files.');
81
+ return;
82
+ }
83
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
84
+ const answer = await rl.question('Replace them? (y/N) ');
85
+ rl.close();
86
+ if (!/^y(es)?$/i.test(answer.trim())) {
87
+ console.log('Nothing changed.');
88
+ return;
89
+ }
90
+ }
91
+ const isNew = !fs.existsSync(folderDir);
92
+ const files = Object.keys(plan.write);
93
+ if (files.length === 0) {
94
+ console.log(`✅ ${folderName} is up to date. Nothing changed.`);
95
+ return;
96
+ }
97
+ applyTemplateInit(folderDir, plan);
98
+ console.log(`✅ ${isNew ? 'Made' : 'Updated'} ${folderName}: ${files.join(', ')}`);
99
+ if (isNew || 'package.json' in plan.write) {
100
+ console.log(` * Run npm install in ${folderName}.`);
101
+ }
102
+ }
103
+ export async function action(actionArgs) {
104
+ const optionDefinitions = [
105
+ { name: 'reset', type: Boolean },
106
+ { name: 'force', type: Boolean },
107
+ { name: 'check', type: Boolean },
108
+ ];
109
+ const parsed = parseCommandLine(actionArgs, optionDefinitions);
110
+ if (parsed.needHelp) {
111
+ if (parsed.error != null) {
112
+ console.error(String(parsed.error));
113
+ console.error();
114
+ recordFailure('usage', String(parsed.error));
115
+ }
116
+ help();
117
+ return;
118
+ }
119
+ const { reset, force, check } = parsed.commandLineOptions;
120
+ if (check && (reset || force)) {
121
+ fail('usage', '--check cannot be used with --reset or --force.');
122
+ return;
123
+ }
124
+ if (force && !reset) {
125
+ fail('usage', '--force is only for --reset.');
126
+ return;
127
+ }
128
+ let templateName;
129
+ let rc;
130
+ let appNodeModulesDir;
131
+ if (detectProjectMode() === 'managed') {
132
+ const project = await loadManagedProject('template init', '');
133
+ if (project == null) {
134
+ return;
135
+ }
136
+ templateName = project.managed.template ?? DEFAULT_APP_TEMPLATE_NAME;
137
+ rc = project.rc;
138
+ appNodeModulesDir = path.resolve(MANAGED_APP_DIR, 'node_modules');
139
+ }
140
+ else {
141
+ try {
142
+ rc = await loadStaticPublisherRcFile();
143
+ }
144
+ catch (err) {
145
+ console.error(`❌ Can't load ${RC_FILE_NAME}`);
146
+ if (err instanceof LoadConfigError) {
147
+ for (const error of err.errors) {
148
+ console.error(error);
149
+ }
150
+ }
151
+ recordFailure('config-invalid', `Can't load ${RC_FILE_NAME}.`);
152
+ return;
153
+ }
154
+ templateName = rc.generatedFrom?.template;
155
+ if (templateName == null) {
156
+ fail('config-invalid', `${RC_FILE_NAME} has no generatedFrom, so the template of the app is not known.`);
157
+ console.error(` * Add it by hand, for example:`);
158
+ console.error(` generatedFrom: { template: 'hono', staticPublishVersion: '${getOwnVersion()}', generatedAt: 'YYYY-MM-DD' },`);
159
+ return;
160
+ }
161
+ appNodeModulesDir = path.resolve('node_modules');
162
+ }
163
+ await runTemplateInit({
164
+ templateName,
165
+ rc,
166
+ baseDir: path.resolve(),
167
+ appNodeModulesDir,
168
+ reset,
169
+ force,
170
+ check,
171
+ });
172
+ }
@@ -0,0 +1,2 @@
1
+ export declare function action(actionArgs: string[]): Promise<void>;
2
+ //# sourceMappingURL=upgrade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/upgrade.ts"],"names":[],"mappings":"AAiCA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAiChD"}
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ import { loadManagedProject, writeProjectVersion } from '../../managed/command-helpers.js';
6
+ import { checkProjectVersion } from '../../managed/version-check.js';
7
+ import { parseCommandLine } from '../../util/args.js';
8
+ import { getOwnVersion } from '../../util/package.js';
9
+ import { PROJECT_FILE_NAME } from '../../../models/config/static-publish-project.js';
10
+ import { fail, recordFailure } from '../../util/output.js';
11
+ function help() {
12
+ console.log(`\
13
+
14
+ Usage:
15
+ npx @fastly/compute-js-static-publish upgrade
16
+
17
+ Description:
18
+ Moves a managed project to the version of @fastly/compute-js-static-publish
19
+ that runs: sets managed.staticPublishVersion in ${PROJECT_FILE_NAME}.
20
+ dev and deploy stop when this version is not the version that runs.
21
+ The next deploy then deploys the app of the new version.
22
+
23
+ Commit the change of ${PROJECT_FILE_NAME}.
24
+
25
+ Global Options:
26
+ -h, --help Show this help message and exit.
27
+ `);
28
+ }
29
+ export async function action(actionArgs) {
30
+ const optionDefinitions = [];
31
+ const parsed = parseCommandLine(actionArgs, optionDefinitions);
32
+ if (parsed.needHelp) {
33
+ if (parsed.error != null) {
34
+ console.error(String(parsed.error));
35
+ console.error();
36
+ recordFailure('usage', String(parsed.error));
37
+ }
38
+ help();
39
+ return;
40
+ }
41
+ const project = await loadManagedProject('upgrade', 'An ejected app has no recorded version.');
42
+ if (project == null) {
43
+ return;
44
+ }
45
+ const running = getOwnVersion();
46
+ const check = checkProjectVersion(project.managed.staticPublishVersion, running);
47
+ if (check.result === 'same') {
48
+ console.log(`✅ The project already uses ${running}.`);
49
+ return;
50
+ }
51
+ if (check.result === 'older-cli') {
52
+ fail('version-mismatch', `The project uses ${check.recorded}, which is newer than the version that runs (${running}). 'upgrade' does not move a project to an older version.`);
53
+ return;
54
+ }
55
+ if (!writeProjectVersion(running)) {
56
+ return;
57
+ }
58
+ console.log(`✅ The project now uses ${running}${check.recorded != null ? ` (was ${check.recorded})` : ''}. Commit ${PROJECT_FILE_NAME}.`);
59
+ }
@@ -0,0 +1,8 @@
1
+ export type ServeResult = {
2
+ status: number | null;
3
+ signal: NodeJS.Signals | null;
4
+ error?: Error;
5
+ };
6
+ export declare function serveApp(appDir: string, serveArgs: string[]): Promise<ServeResult>;
7
+ export declare function runDevWatch(args: string[]): Promise<number>;
8
+ //# sourceMappingURL=run-dev-watch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-dev-watch.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run-dev-watch.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAOF,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAiBxF;AAKD,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAQjE"}
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ import * as child_process from 'node:child_process';
6
+ import * as fs from 'node:fs';
7
+ import * as path from 'node:path';
8
+ import { TEMPLATE_WATCH_SCRIPT } from './scaffold/generate-app.js';
9
+ // Runs `fastly compute serve` in the app dir. With --watch, the watch script
10
+ // (if the app has one) runs next to it, until the Fastly CLI stops. The script
11
+ // can watch files outside the app dir: when they change, it writes a file in
12
+ // the app dir, and then the Fastly CLI builds the app again. The Fastly CLI of
13
+ // the app is used, if it has one.
14
+ export async function serveApp(appDir, serveArgs) {
15
+ const appFastly = path.resolve(appDir, 'node_modules/.bin/fastly');
16
+ const fastly = fs.existsSync(appFastly) ? appFastly : 'fastly';
17
+ const watchScript = path.resolve(appDir, TEMPLATE_WATCH_SCRIPT);
18
+ const watcher = serveArgs.includes('--watch') && fs.existsSync(watchScript) ?
19
+ child_process.spawn(process.execPath, [watchScript], { cwd: appDir, stdio: 'inherit' }) :
20
+ undefined;
21
+ console.log(`▶️ fastly compute serve ${serveArgs.join(' ')}`);
22
+ const result = await new Promise(resolve => {
23
+ const child = child_process.spawn(fastly, ['compute', 'serve', ...serveArgs], { cwd: appDir, stdio: 'inherit' });
24
+ child.on('error', error => resolve({ status: null, signal: null, error }));
25
+ child.on('exit', (status, signal) => resolve({ status, signal }));
26
+ });
27
+ watcher?.kill();
28
+ return result;
29
+ }
30
+ // The dev:watch script of every app calls this: `fastly compute serve --watch`
31
+ // in the current directory, with the watch script of the app. The arguments
32
+ // go to `fastly compute serve`. Returns the exit code.
33
+ export async function runDevWatch(args) {
34
+ const serveArgs = args.includes('--watch') ? args : ['--watch', ...args];
35
+ const result = await serveApp(path.resolve(), serveArgs);
36
+ if (result.error != null) {
37
+ console.error(`❌ Could not run 'fastly compute serve': ${String(result.error)}`);
38
+ return 1;
39
+ }
40
+ return result.status ?? (result.signal != null ? 0 : 1);
41
+ }
@@ -0,0 +1,2 @@
1
+ export declare function runTemplateHook(name: string | undefined): number;
2
+ //# sourceMappingURL=run-template-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-template-hook.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run-template-hook.ts"],"names":[],"mappings":"AAeA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAiBhE"}
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ import * as child_process from 'node:child_process';
6
+ import * as fs from 'node:fs';
7
+ import * as path from 'node:path';
8
+ import { TEMPLATE_HOOKS } from './scaffold/generate-app.js';
9
+ // Runs scripts/template_<name>.js of the app in the current directory, if it
10
+ // exists. The npm scripts prebuild, postbuild, and postinstall of every
11
+ // scaffolded app call this, so a template, or the customer, can add a hook by
12
+ // adding the file. Returns the exit code.
13
+ export function runTemplateHook(name) {
14
+ if (name == null || !TEMPLATE_HOOKS.includes(name)) {
15
+ console.error(`❌ run-template-hook: the hook must be one of: ${TEMPLATE_HOOKS.join(', ')}.`);
16
+ return 1;
17
+ }
18
+ const hookFile = path.resolve(`scripts/template_${name}.js`);
19
+ if (!fs.existsSync(hookFile)) {
20
+ return 0;
21
+ }
22
+ const result = child_process.spawnSync(process.execPath, [hookFile], { stdio: 'inherit' });
23
+ if (result.error != null) {
24
+ console.error(`❌ run-template-hook: could not run ${hookFile}: ${String(result.error)}`);
25
+ return 1;
26
+ }
27
+ return result.status ?? 1;
28
+ }
@@ -0,0 +1,17 @@
1
+ export type AppTemplate = {
2
+ name: string;
3
+ files: Record<string, string>;
4
+ entry: string;
5
+ dependencies: Record<string, string>;
6
+ devDependencies: Record<string, string>;
7
+ supports: AppTemplateSupports;
8
+ gitignore: string[];
9
+ };
10
+ export type AppTemplateSupports = {
11
+ collectionSelection?: boolean;
12
+ };
13
+ export declare const APP_TEMPLATE_NAMES: string[];
14
+ export declare const DEFAULT_APP_TEMPLATE_NAME = "plain";
15
+ export declare function isAppTemplateName(name: string): boolean;
16
+ export declare function loadAppTemplate(name: string): AppTemplate;
17
+ //# sourceMappingURL=app-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-template.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/app-template.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG9B,KAAK,EAAE,MAAM,CAAC;IAEd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,EAAE,mBAAmB,CAAC;IAG9B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG;IAGhC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AASF,eAAO,MAAM,kBAAkB,UAA6B,CAAC;AAE7D,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAKjD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,WAE7C;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAmCzD"}
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import { resourcesDir } from '../../util/resources.js';
8
+ // The templates in resources/templates/: what each one supports, and the lines
9
+ // that it adds to the .gitignore of the app.
10
+ const APP_TEMPLATES = {
11
+ plain: { supports: { collectionSelection: true }, gitignore: [] },
12
+ hono: { supports: { collectionSelection: true }, gitignore: ['/src/hono-extensions.generated.js'] },
13
+ };
14
+ export const APP_TEMPLATE_NAMES = Object.keys(APP_TEMPLATES);
15
+ export const DEFAULT_APP_TEMPLATE_NAME = 'plain';
16
+ // The files in a template directory that are not files of the app.
17
+ const TEMPLATE_PACKAGE_FILES = ['package.json', 'package-lock.json'];
18
+ export function isAppTemplateName(name) {
19
+ return APP_TEMPLATE_NAMES.includes(name);
20
+ }
21
+ // Reads resources/templates/<name>/.
22
+ export function loadAppTemplate(name) {
23
+ if (!isAppTemplateName(name)) {
24
+ throw new Error(`Unknown template '${name}'. Valid templates: ${APP_TEMPLATE_NAMES.join(', ')}.`);
25
+ }
26
+ const templateDir = path.resolve(resourcesDir, 'templates', name);
27
+ const files = {};
28
+ const walk = (sub) => {
29
+ for (const entry of fs.readdirSync(path.resolve(templateDir, sub), { withFileTypes: true })) {
30
+ const rel = path.posix.join(sub, entry.name);
31
+ if (entry.isDirectory()) {
32
+ if (entry.name !== 'node_modules') {
33
+ walk(rel);
34
+ }
35
+ continue;
36
+ }
37
+ if (sub === '' && TEMPLATE_PACKAGE_FILES.includes(entry.name)) {
38
+ continue;
39
+ }
40
+ files[rel] = fs.readFileSync(path.resolve(templateDir, rel), 'utf-8');
41
+ }
42
+ };
43
+ walk('');
44
+ const packageJson = JSON.parse(fs.readFileSync(path.resolve(templateDir, 'package.json'), 'utf-8'));
45
+ return {
46
+ name,
47
+ files,
48
+ entry: packageJson.main ?? 'src/index.js',
49
+ dependencies: packageJson.dependencies ?? {},
50
+ devDependencies: packageJson.devDependencies ?? {},
51
+ supports: APP_TEMPLATES[name].supports,
52
+ gitignore: APP_TEMPLATES[name].gitignore,
53
+ };
54
+ }
@@ -0,0 +1,5 @@
1
+ import { type FastlyTomlSections } from '../../../models/config/static-publish-project.js';
2
+ export declare const FASTLY_TOML_SECTIONS: readonly ['local_server', 'setup'];
3
+ export declare function checkFastlyTomlSections(value: unknown, errors: string[]): value is FastlyTomlSections;
4
+ export declare function addFastlyTomlSections(fastlyToml: string, sections: FastlyTomlSections | undefined): string;
5
+ //# sourceMappingURL=fastly-toml-sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastly-toml-sections.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/fastly-toml-sections.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAI3F,eAAO,MAAM,oBAAoB,YAAK,cAAc,EAAE,OAAO,CAAW,CAAC;AAWzE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,kBAAkB,CAkDrG;AAmDD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAsC1G"}
@@ -0,0 +1,154 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ // managed.fastlyToml of a managed project: the local_server and setup sections
6
+ // that the customer adds to the fastly.toml of the app, for example a local
7
+ // Secret Store for fastly compute serve.
8
+ import toml from 'toml';
9
+ import { ConfigError } from '../../util/output.js';
10
+ import { tomlFilter, tomlKeyFilter } from './render.js';
11
+ export const FASTLY_TOML_SECTIONS = ['local_server', 'setup'];
12
+ const isPlainObject = (value) => value != null && typeof value === 'object' && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
13
+ const isTableArray = (value) => Array.isArray(value) && value.length > 0 && value.every(isPlainObject);
14
+ // Checks managed.fastlyToml. Each section is an object of resource types (for
15
+ // example secret_stores), and each value can be written as TOML: a string, a
16
+ // finite number, a boolean, an array, or a plain object.
17
+ export function checkFastlyTomlSections(value, errors) {
18
+ const start = errors.length;
19
+ if (!isPlainObject(value)) {
20
+ errors.push('managed.fastlyToml, if specified, must be an object.');
21
+ return false;
22
+ }
23
+ const checkValue = (item, at) => {
24
+ if (typeof item === 'string' || typeof item === 'boolean' || (typeof item === 'number' && Number.isFinite(item))) {
25
+ return;
26
+ }
27
+ if (Array.isArray(item)) {
28
+ if (item.length > 0 && item.some(isPlainObject) && !item.every(isPlainObject)) {
29
+ errors.push(`${at}: an array must have only objects, or no objects.`);
30
+ return;
31
+ }
32
+ item.forEach((x, i) => checkValue(x, `${at}[${i}]`));
33
+ return;
34
+ }
35
+ if (isPlainObject(item)) {
36
+ for (const [key, x] of Object.entries(item)) {
37
+ if (x !== undefined) {
38
+ checkValue(x, `${at}.${key}`);
39
+ }
40
+ }
41
+ return;
42
+ }
43
+ errors.push(`${at}: the value cannot be written to fastly.toml. Use a string, a number, a boolean, an array, or an object.`);
44
+ };
45
+ for (const [section, content] of Object.entries(value)) {
46
+ const at = `managed.fastlyToml.${section}`;
47
+ if (!FASTLY_TOML_SECTIONS.includes(section)) {
48
+ errors.push(`${at}: only ${FASTLY_TOML_SECTIONS.join(' and ')} can be added to fastly.toml.`);
49
+ continue;
50
+ }
51
+ if (content === undefined) {
52
+ continue;
53
+ }
54
+ if (!isPlainObject(content)) {
55
+ errors.push(`${at} must be an object, for example { secret_stores: { … } }.`);
56
+ continue;
57
+ }
58
+ for (const [type, tables] of Object.entries(content)) {
59
+ if (tables !== undefined && !isPlainObject(tables)) {
60
+ errors.push(`${at}.${type} must be an object.`);
61
+ continue;
62
+ }
63
+ checkValue(tables, `${at}.${type}`);
64
+ }
65
+ }
66
+ return errors.length === start;
67
+ }
68
+ function tomlValue(value) {
69
+ if (typeof value === 'string') {
70
+ return tomlFilter(value);
71
+ }
72
+ if (typeof value === 'number' || typeof value === 'boolean') {
73
+ return String(value);
74
+ }
75
+ if (Array.isArray(value)) {
76
+ return `[ ${value.map(tomlValue).join(', ')} ]`;
77
+ }
78
+ if (isPlainObject(value)) {
79
+ const entries = Object.entries(value).filter(([, x]) => x !== undefined);
80
+ return `{ ${entries.map(([key, x]) => `${tomlKeyFilter(key)} = ${tomlValue(x)}`).join(', ')} }`;
81
+ }
82
+ throw new Error(`This value cannot be written to fastly.toml: ${String(value)}`);
83
+ }
84
+ // Writes the tables of an object with the full path in each header, so that the
85
+ // text can come after the sections that the CLI writes. A table gets a header
86
+ // only if it has values, or if it is a resource (for example
87
+ // [setup.kv_stores.name]) and has nothing else; the tables above it are made
88
+ // implicitly, and are never declared a second time.
89
+ function writeTables(lines, keys, table, header) {
90
+ const entries = Object.entries(table).filter(([, x]) => x !== undefined);
91
+ const values = entries.filter(([, x]) => !isPlainObject(x) && !isTableArray(x));
92
+ const tables = entries.filter(([, x]) => isPlainObject(x));
93
+ const tableArrays = entries.filter(([, x]) => isTableArray(x));
94
+ const name = keys.map(tomlKeyFilter).join('.');
95
+ const isResource = keys.length >= 3;
96
+ if (header === '[[' || values.length > 0 || (isResource && tables.length === 0 && tableArrays.length === 0)) {
97
+ lines.push(header === '[[' ? `[[${name}]]` : `[${name}]`);
98
+ for (const [key, x] of values) {
99
+ lines.push(`${tomlKeyFilter(key)} = ${tomlValue(x)}`);
100
+ }
101
+ }
102
+ for (const [key, x] of tables) {
103
+ writeTables(lines, [...keys, key], x, '[');
104
+ }
105
+ for (const [key, items] of tableArrays) {
106
+ for (const item of items) {
107
+ writeTables(lines, [...keys, key], item, '[[');
108
+ }
109
+ }
110
+ }
111
+ // Adds managed.fastlyToml to the text of a fastly.toml that the CLI made.
112
+ // Throws a ConfigError if a resource has the name of one that the CLI writes
113
+ // (for example the KV Store of the content), or if the result is not valid
114
+ // TOML.
115
+ export function addFastlyTomlSections(fastlyToml, sections) {
116
+ if (sections == null) {
117
+ return fastlyToml;
118
+ }
119
+ const base = toml.parse(fastlyToml);
120
+ const lines = [];
121
+ for (const section of FASTLY_TOML_SECTIONS) {
122
+ const content = sections[section];
123
+ if (content == null) {
124
+ continue;
125
+ }
126
+ for (const [type, tables] of Object.entries(content)) {
127
+ if (!isPlainObject(tables)) {
128
+ continue;
129
+ }
130
+ const baseType = base[section]?.[type];
131
+ for (const name of Object.keys(tables)) {
132
+ if (baseType?.[name] !== undefined) {
133
+ throw new ConfigError(`managed.fastlyToml.${section}.${type}.${name}: the CLI writes this entry. Use another name.`);
134
+ }
135
+ }
136
+ const hasValues = Object.values(tables).some(x => x !== undefined && !isPlainObject(x) && !isTableArray(x));
137
+ if (baseType != null && hasValues) {
138
+ throw new ConfigError(`managed.fastlyToml.${section}.${type}: the CLI writes this table. Add only new entries to it.`);
139
+ }
140
+ writeTables(lines, [section, type], tables, '[');
141
+ }
142
+ }
143
+ if (lines.length === 0) {
144
+ return fastlyToml;
145
+ }
146
+ const result = `${fastlyToml.trimEnd()}\n\n# From managed.fastlyToml in the project file.\n${lines.join('\n')}\n`;
147
+ try {
148
+ toml.parse(result);
149
+ }
150
+ catch (err) {
151
+ throw new ConfigError(`managed.fastlyToml does not give a valid fastly.toml: ${String(err instanceof Error ? err.message : err)}`);
152
+ }
153
+ return result;
154
+ }
@@ -0,0 +1,47 @@
1
+ import { type CollectionSelection } from '../../../models/config/collection-selection.js';
2
+ import { type FastlyTomlSections } from '../../../models/config/static-publish-project.js';
3
+ import { type GeneratedFrom, type StaticPublishTemplateOptions } from '../../../models/config/static-publish-rc.js';
4
+ import { type AppTemplate } from './app-template.js';
5
+ export type AppConfig = {
6
+ appDir: string;
7
+ name: string | undefined;
8
+ author: string | undefined;
9
+ description: string | undefined;
10
+ serviceId: string | undefined;
11
+ storage: {
12
+ mode: 'kv-store';
13
+ kvStoreName: string;
14
+ } | {
15
+ mode: 's3';
16
+ region: string;
17
+ bucket: string;
18
+ endpointUrl: string;
19
+ endpointGenerated: boolean;
20
+ };
21
+ publishId: string;
22
+ defaultCollectionName: string;
23
+ staticPublisherWorkingDir: string;
24
+ rootDir: string;
25
+ publicDir: string;
26
+ staticDirs: string[];
27
+ spaFilename: string | undefined;
28
+ notFoundPageFilename: string | undefined;
29
+ autoIndex: string[];
30
+ autoExt: string[];
31
+ staticPublishVersionSpec: string;
32
+ template: AppTemplate;
33
+ generatedFrom: GeneratedFrom | undefined;
34
+ collectionSelection?: CollectionSelection;
35
+ fastlyToml?: FastlyTomlSections;
36
+ build?: {
37
+ hono?: {
38
+ extensionsDir: string;
39
+ };
40
+ };
41
+ templateOptions?: StaticPublishTemplateOptions;
42
+ packageLock?: string;
43
+ };
44
+ export declare const TEMPLATE_HOOKS: readonly ['prebuild', 'postbuild', 'postinstall'];
45
+ export declare const TEMPLATE_WATCH_SCRIPT = "scripts/template_watch.js";
46
+ export declare function generateApp(config: AppConfig): Record<string, string>;
47
+ //# sourceMappingURL=generate-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-app.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/generate-app.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAGpH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EACH;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACzC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,OAAO,CAAA;KAAE,CAAC;IACpG,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,wBAAwB,EAAE,MAAM,CAAC;IAEjC,QAAQ,EAAE,WAAW,CAAC;IAEtB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAEzC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAE1C,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAGhC,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE;YAAE,aAAa,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAG7C,eAAe,CAAC,EAAE,4BAA4B,CAAC;IAE/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,eAAO,MAAM,cAAc,YAAK,UAAU,EAAE,WAAW,EAAE,aAAa,CAAW,CAAC;AAKlF,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAKjE,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsLrE"}