@osdk/create-app 0.19.0-beta.6 → 0.19.0-beta.7

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 (224) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/browser/esm-AQEYRLX5.js +383 -0
  3. package/build/browser/esm-AQEYRLX5.js.map +1 -0
  4. package/build/browser/esm-FVYIHZAJ.js +375 -0
  5. package/build/browser/esm-FVYIHZAJ.js.map +1 -0
  6. package/build/browser/esm-NCHOZ6BO.js +1176 -0
  7. package/build/browser/esm-NCHOZ6BO.js.map +1 -0
  8. package/build/browser/esm-NPLFBOV7.js +908 -0
  9. package/build/browser/esm-NPLFBOV7.js.map +1 -0
  10. package/build/browser/esm-SNM7M67J.js +253 -0
  11. package/build/browser/esm-SNM7M67J.js.map +1 -0
  12. package/build/browser/esm-UJCFN4M3.js +456 -0
  13. package/build/browser/esm-UJCFN4M3.js.map +1 -0
  14. package/build/browser/index.js +540 -18
  15. package/build/browser/index.js.map +1 -1
  16. package/build/esm/esm-AQEYRLX5.js +383 -0
  17. package/build/esm/esm-AQEYRLX5.js.map +1 -0
  18. package/build/esm/esm-FVYIHZAJ.js +375 -0
  19. package/build/esm/esm-FVYIHZAJ.js.map +1 -0
  20. package/build/esm/esm-NCHOZ6BO.js +1176 -0
  21. package/build/esm/esm-NCHOZ6BO.js.map +1 -0
  22. package/build/esm/esm-NPLFBOV7.js +908 -0
  23. package/build/esm/esm-NPLFBOV7.js.map +1 -0
  24. package/build/esm/esm-SNM7M67J.js +253 -0
  25. package/build/esm/esm-SNM7M67J.js.map +1 -0
  26. package/build/esm/esm-UJCFN4M3.js +456 -0
  27. package/build/esm/esm-UJCFN4M3.js.map +1 -0
  28. package/build/esm/index.js +540 -18
  29. package/build/esm/index.js.map +1 -1
  30. package/package.json +9 -9
  31. package/build/browser/cli.d.ts +0 -2
  32. package/build/browser/cli.d.ts.map +0 -1
  33. package/build/browser/cli.js +0 -95
  34. package/build/browser/cli.js.map +0 -1
  35. package/build/browser/cli.test.d.ts +0 -2
  36. package/build/browser/cli.test.d.ts.map +0 -1
  37. package/build/browser/cli.test.js +0 -59
  38. package/build/browser/cli.test.js.map +0 -1
  39. package/build/browser/consola.d.ts +0 -3
  40. package/build/browser/consola.d.ts.map +0 -1
  41. package/build/browser/consola.js +0 -28
  42. package/build/browser/consola.js.map +0 -1
  43. package/build/browser/generate/generateEnv.d.ts +0 -13
  44. package/build/browser/generate/generateEnv.d.ts.map +0 -1
  45. package/build/browser/generate/generateEnv.js +0 -50
  46. package/build/browser/generate/generateEnv.js.map +0 -1
  47. package/build/browser/generate/generateEnv.test.d.ts +0 -2
  48. package/build/browser/generate/generateEnv.test.d.ts.map +0 -1
  49. package/build/browser/generate/generateEnv.test.js +0 -70
  50. package/build/browser/generate/generateEnv.test.js.map +0 -1
  51. package/build/browser/generate/generateFoundryConfigJson.d.ts +0 -6
  52. package/build/browser/generate/generateFoundryConfigJson.d.ts.map +0 -1
  53. package/build/browser/generate/generateFoundryConfigJson.js +0 -33
  54. package/build/browser/generate/generateFoundryConfigJson.js.map +0 -1
  55. package/build/browser/generate/generateFoundryConfigJson.test.d.ts +0 -2
  56. package/build/browser/generate/generateFoundryConfigJson.test.d.ts.map +0 -1
  57. package/build/browser/generate/generateFoundryConfigJson.test.js +0 -38
  58. package/build/browser/generate/generateFoundryConfigJson.test.js.map +0 -1
  59. package/build/browser/generate/generateNpmRc.d.ts +0 -5
  60. package/build/browser/generate/generateNpmRc.d.ts.map +0 -1
  61. package/build/browser/generate/generateNpmRc.js +0 -27
  62. package/build/browser/generate/generateNpmRc.js.map +0 -1
  63. package/build/browser/generate/generateNpmRc.test.d.ts +0 -2
  64. package/build/browser/generate/generateNpmRc.test.d.ts.map +0 -1
  65. package/build/browser/generate/generateNpmRc.test.js +0 -28
  66. package/build/browser/generate/generateNpmRc.test.js.map +0 -1
  67. package/build/browser/highlight.d.ts +0 -3
  68. package/build/browser/highlight.d.ts.map +0 -1
  69. package/build/browser/highlight.js +0 -23
  70. package/build/browser/highlight.js.map +0 -1
  71. package/build/browser/index.d.ts +0 -5
  72. package/build/browser/index.d.ts.map +0 -1
  73. package/build/browser/prompts/promptApplicationRid.d.ts +0 -4
  74. package/build/browser/prompts/promptApplicationRid.d.ts.map +0 -1
  75. package/build/browser/prompts/promptApplicationRid.js +0 -31
  76. package/build/browser/prompts/promptApplicationRid.js.map +0 -1
  77. package/build/browser/prompts/promptApplicationRid.test.d.ts +0 -2
  78. package/build/browser/prompts/promptApplicationRid.test.d.ts.map +0 -1
  79. package/build/browser/prompts/promptApplicationRid.test.js +0 -48
  80. package/build/browser/prompts/promptApplicationRid.test.js.map +0 -1
  81. package/build/browser/prompts/promptApplicationUrl.d.ts +0 -5
  82. package/build/browser/prompts/promptApplicationUrl.d.ts.map +0 -1
  83. package/build/browser/prompts/promptApplicationUrl.js +0 -50
  84. package/build/browser/prompts/promptApplicationUrl.js.map +0 -1
  85. package/build/browser/prompts/promptApplicationUrl.test.d.ts +0 -2
  86. package/build/browser/prompts/promptApplicationUrl.test.d.ts.map +0 -1
  87. package/build/browser/prompts/promptApplicationUrl.test.js +0 -68
  88. package/build/browser/prompts/promptApplicationUrl.test.js.map +0 -1
  89. package/build/browser/prompts/promptClientId.d.ts +0 -4
  90. package/build/browser/prompts/promptClientId.d.ts.map +0 -1
  91. package/build/browser/prompts/promptClientId.js +0 -31
  92. package/build/browser/prompts/promptClientId.js.map +0 -1
  93. package/build/browser/prompts/promptClientId.test.d.ts +0 -2
  94. package/build/browser/prompts/promptClientId.test.d.ts.map +0 -1
  95. package/build/browser/prompts/promptClientId.test.js +0 -47
  96. package/build/browser/prompts/promptClientId.test.js.map +0 -1
  97. package/build/browser/prompts/promptCorsProxy.d.ts +0 -4
  98. package/build/browser/prompts/promptCorsProxy.d.ts.map +0 -1
  99. package/build/browser/prompts/promptCorsProxy.js +0 -29
  100. package/build/browser/prompts/promptCorsProxy.js.map +0 -1
  101. package/build/browser/prompts/promptCorsProxy.test.d.ts +0 -2
  102. package/build/browser/prompts/promptCorsProxy.test.d.ts.map +0 -1
  103. package/build/browser/prompts/promptCorsProxy.test.js +0 -44
  104. package/build/browser/prompts/promptCorsProxy.test.js.map +0 -1
  105. package/build/browser/prompts/promptFoundryUrl.d.ts +0 -4
  106. package/build/browser/prompts/promptFoundryUrl.d.ts.map +0 -1
  107. package/build/browser/prompts/promptFoundryUrl.js +0 -31
  108. package/build/browser/prompts/promptFoundryUrl.js.map +0 -1
  109. package/build/browser/prompts/promptFoundryUrl.test.d.ts +0 -2
  110. package/build/browser/prompts/promptFoundryUrl.test.d.ts.map +0 -1
  111. package/build/browser/prompts/promptFoundryUrl.test.js +0 -55
  112. package/build/browser/prompts/promptFoundryUrl.test.js.map +0 -1
  113. package/build/browser/prompts/promptOsdkPackage.d.ts +0 -4
  114. package/build/browser/prompts/promptOsdkPackage.d.ts.map +0 -1
  115. package/build/browser/prompts/promptOsdkPackage.js +0 -31
  116. package/build/browser/prompts/promptOsdkPackage.js.map +0 -1
  117. package/build/browser/prompts/promptOsdkPackage.test.d.ts +0 -2
  118. package/build/browser/prompts/promptOsdkPackage.test.d.ts.map +0 -1
  119. package/build/browser/prompts/promptOsdkPackage.test.js +0 -48
  120. package/build/browser/prompts/promptOsdkPackage.test.js.map +0 -1
  121. package/build/browser/prompts/promptOsdkRegistryUrl.d.ts +0 -4
  122. package/build/browser/prompts/promptOsdkRegistryUrl.d.ts.map +0 -1
  123. package/build/browser/prompts/promptOsdkRegistryUrl.js +0 -31
  124. package/build/browser/prompts/promptOsdkRegistryUrl.js.map +0 -1
  125. package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts +0 -2
  126. package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts.map +0 -1
  127. package/build/browser/prompts/promptOsdkRegistryUrl.test.js +0 -54
  128. package/build/browser/prompts/promptOsdkRegistryUrl.test.js.map +0 -1
  129. package/build/browser/prompts/promptOverwrite.d.ts +0 -5
  130. package/build/browser/prompts/promptOverwrite.d.ts.map +0 -1
  131. package/build/browser/prompts/promptOverwrite.js +0 -53
  132. package/build/browser/prompts/promptOverwrite.js.map +0 -1
  133. package/build/browser/prompts/promptOverwrite.test.d.ts +0 -2
  134. package/build/browser/prompts/promptOverwrite.test.d.ts.map +0 -1
  135. package/build/browser/prompts/promptOverwrite.test.js +0 -55
  136. package/build/browser/prompts/promptOverwrite.test.js.map +0 -1
  137. package/build/browser/prompts/promptProject.d.ts +0 -4
  138. package/build/browser/prompts/promptProject.d.ts.map +0 -1
  139. package/build/browser/prompts/promptProject.js +0 -32
  140. package/build/browser/prompts/promptProject.js.map +0 -1
  141. package/build/browser/prompts/promptProject.test.d.ts +0 -2
  142. package/build/browser/prompts/promptProject.test.d.ts.map +0 -1
  143. package/build/browser/prompts/promptProject.test.js +0 -47
  144. package/build/browser/prompts/promptProject.test.js.map +0 -1
  145. package/build/browser/prompts/promptTemplate.d.ts +0 -6
  146. package/build/browser/prompts/promptTemplate.d.ts.map +0 -1
  147. package/build/browser/prompts/promptTemplate.js +0 -45
  148. package/build/browser/prompts/promptTemplate.js.map +0 -1
  149. package/build/browser/prompts/promptTemplate.test.d.ts +0 -2
  150. package/build/browser/prompts/promptTemplate.test.d.ts.map +0 -1
  151. package/build/browser/prompts/promptTemplate.test.js +0 -48
  152. package/build/browser/prompts/promptTemplate.test.js.map +0 -1
  153. package/build/browser/run.d.ts +0 -16
  154. package/build/browser/run.d.ts.map +0 -1
  155. package/build/browser/run.js +0 -132
  156. package/build/browser/run.js.map +0 -1
  157. package/build/browser/templates.d.ts +0 -23
  158. package/build/browser/templates.d.ts.map +0 -1
  159. package/build/browser/templates.js +0 -56
  160. package/build/browser/templates.js.map +0 -1
  161. package/build/esm/cli.js +0 -95
  162. package/build/esm/cli.js.map +0 -1
  163. package/build/esm/cli.test.js +0 -59
  164. package/build/esm/cli.test.js.map +0 -1
  165. package/build/esm/consola.js +0 -28
  166. package/build/esm/consola.js.map +0 -1
  167. package/build/esm/generate/generateEnv.js +0 -50
  168. package/build/esm/generate/generateEnv.js.map +0 -1
  169. package/build/esm/generate/generateEnv.test.js +0 -70
  170. package/build/esm/generate/generateEnv.test.js.map +0 -1
  171. package/build/esm/generate/generateFoundryConfigJson.js +0 -33
  172. package/build/esm/generate/generateFoundryConfigJson.js.map +0 -1
  173. package/build/esm/generate/generateFoundryConfigJson.test.js +0 -38
  174. package/build/esm/generate/generateFoundryConfigJson.test.js.map +0 -1
  175. package/build/esm/generate/generateNpmRc.js +0 -27
  176. package/build/esm/generate/generateNpmRc.js.map +0 -1
  177. package/build/esm/generate/generateNpmRc.test.js +0 -28
  178. package/build/esm/generate/generateNpmRc.test.js.map +0 -1
  179. package/build/esm/highlight.js +0 -23
  180. package/build/esm/highlight.js.map +0 -1
  181. package/build/esm/prompts/promptApplicationRid.js +0 -31
  182. package/build/esm/prompts/promptApplicationRid.js.map +0 -1
  183. package/build/esm/prompts/promptApplicationRid.test.js +0 -48
  184. package/build/esm/prompts/promptApplicationRid.test.js.map +0 -1
  185. package/build/esm/prompts/promptApplicationUrl.js +0 -50
  186. package/build/esm/prompts/promptApplicationUrl.js.map +0 -1
  187. package/build/esm/prompts/promptApplicationUrl.test.js +0 -68
  188. package/build/esm/prompts/promptApplicationUrl.test.js.map +0 -1
  189. package/build/esm/prompts/promptClientId.js +0 -31
  190. package/build/esm/prompts/promptClientId.js.map +0 -1
  191. package/build/esm/prompts/promptClientId.test.js +0 -47
  192. package/build/esm/prompts/promptClientId.test.js.map +0 -1
  193. package/build/esm/prompts/promptCorsProxy.js +0 -29
  194. package/build/esm/prompts/promptCorsProxy.js.map +0 -1
  195. package/build/esm/prompts/promptCorsProxy.test.js +0 -44
  196. package/build/esm/prompts/promptCorsProxy.test.js.map +0 -1
  197. package/build/esm/prompts/promptFoundryUrl.js +0 -31
  198. package/build/esm/prompts/promptFoundryUrl.js.map +0 -1
  199. package/build/esm/prompts/promptFoundryUrl.test.js +0 -55
  200. package/build/esm/prompts/promptFoundryUrl.test.js.map +0 -1
  201. package/build/esm/prompts/promptOsdkPackage.js +0 -31
  202. package/build/esm/prompts/promptOsdkPackage.js.map +0 -1
  203. package/build/esm/prompts/promptOsdkPackage.test.js +0 -48
  204. package/build/esm/prompts/promptOsdkPackage.test.js.map +0 -1
  205. package/build/esm/prompts/promptOsdkRegistryUrl.js +0 -31
  206. package/build/esm/prompts/promptOsdkRegistryUrl.js.map +0 -1
  207. package/build/esm/prompts/promptOsdkRegistryUrl.test.js +0 -54
  208. package/build/esm/prompts/promptOsdkRegistryUrl.test.js.map +0 -1
  209. package/build/esm/prompts/promptOverwrite.js +0 -53
  210. package/build/esm/prompts/promptOverwrite.js.map +0 -1
  211. package/build/esm/prompts/promptOverwrite.test.js +0 -55
  212. package/build/esm/prompts/promptOverwrite.test.js.map +0 -1
  213. package/build/esm/prompts/promptProject.js +0 -32
  214. package/build/esm/prompts/promptProject.js.map +0 -1
  215. package/build/esm/prompts/promptProject.test.js +0 -47
  216. package/build/esm/prompts/promptProject.test.js.map +0 -1
  217. package/build/esm/prompts/promptTemplate.js +0 -45
  218. package/build/esm/prompts/promptTemplate.js.map +0 -1
  219. package/build/esm/prompts/promptTemplate.test.js +0 -48
  220. package/build/esm/prompts/promptTemplate.test.js.map +0 -1
  221. package/build/esm/run.js +0 -132
  222. package/build/esm/run.js.map +0 -1
  223. package/build/esm/templates.js +0 -56
  224. package/build/esm/templates.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptProject.test.js","names":["afterEach","expect","test","vi","consola","promptProject","mock","restoreAllMocks","mocked","prompt","mockResolvedValueOnce","toEqual","toHaveBeenCalledTimes","project","not","toHaveBeenCalled"],"sources":["promptProject.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { afterEach, expect, test, vi } from \"vitest\";\nimport { consola } from \"../consola.js\";\nimport { promptProject } from \"./promptProject.js\";\nvi.mock(\"../consola.js\");\nafterEach(() => {\n vi.restoreAllMocks();\n});\ntest(\"it accepts valid project from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"my-osdk-app\");\n expect(await promptProject({})).toEqual(\"my-osdk-app\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it prompts again if answered value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"!@#$%^&*()_+\");\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"my-osdk-app\");\n expect(await promptProject({})).toEqual(\"my-osdk-app\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(2);\n});\ntest(\"it accepts valid initial value without prompt\", async () => {\n expect(await promptProject({ project: \"my-osdk-app\" })).toEqual(\"my-osdk-app\");\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\ntest(\"it prompts if initial value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(\"my-osdk-app\");\n expect(await promptProject({ project: \"!@#$%^&*()_+\" })).toEqual(\"my-osdk-app\");\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AACpD,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,aAAa,QAAQ,oBAAoB;AAClDF,EAAE,CAACG,IAAI,CAAC,eAAe,CAAC;AACxBN,SAAS,CAAC,MAAM;EACZG,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AAC,aAAa,CAAC;EAC9DT,MAAM,CAAC,MAAMI,aAAa,CAAC;IAAEQ,OAAO,EAAE;EAAe,CAAC,CAAC,CAAC,CAACF,OAAO,CAAC,aAAa,CAAC;EAC/EV,MAAM,CAACE,EAAE,CAACK,MAAM,CAACJ,OAAO,CAAC,CAACK,MAAM,CAAC,CAACG,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- import { type Template } from "../templates.js";
2
- export declare function promptTemplate(parsed: {
3
- template?: string;
4
- beta?: boolean;
5
- }): Promise<Template>;
6
- //# sourceMappingURL=promptTemplate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptTemplate.d.ts","sourceRoot":"","sources":["../../../src/prompts/promptTemplate.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,QAAQ,EAAa,MAAM,iBAAiB,CAAC;AAE3D,wBAAsB,cAAc,CAClC,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,OAAO,CAAC,QAAQ,CAAC,CA6CnB"}
@@ -1,45 +0,0 @@
1
- /*
2
- * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { consola } from "../consola.js";
17
- import { green } from "../highlight.js";
18
- import { TEMPLATES } from "../templates.js";
19
- export async function promptTemplate(parsed) {
20
- let useBeta = parsed.beta ?? false;
21
- let template = TEMPLATES.find(t => t.id === parsed.template || t.id === `template-${parsed.template}`);
22
- if (template == null) {
23
- const availableTemplates = TEMPLATES.filter(template => !template.hidden && (useBeta ? template.isBeta === true
24
- // isBeta could be null
25
- : !template.isBeta));
26
- if (availableTemplates.length === 0) {
27
- throw new Error("No available templates found for the selected options.");
28
- }
29
- const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : "Select a framework:", {
30
- type: "select",
31
- options: availableTemplates.map(template => ({
32
- value: template.id,
33
- label: template.label
34
- }))
35
- // Types for "select" are wrong the value is returned rather than the option object
36
- // https://github.com/unjs/consola/pull/238
37
- });
38
- template = TEMPLATES.find(t => t.id === templateId);
39
- if (template == null) {
40
- throw new Error(`Template ${templateId} should be found`);
41
- }
42
- }
43
- return template;
44
- }
45
- //# sourceMappingURL=promptTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptTemplate.js","names":["consola","green","TEMPLATES","promptTemplate","parsed","useBeta","beta","template","find","t","id","availableTemplates","filter","hidden","isBeta","length","Error","templateId","prompt","type","options","map","value","label"],"sources":["promptTemplate.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { consola } from \"../consola.js\";\nimport { green } from \"../highlight.js\";\nimport { TEMPLATES } from \"../templates.js\";\nexport async function promptTemplate(parsed) {\n let useBeta = parsed.beta ?? false;\n let template = TEMPLATES.find((t) => t.id === parsed.template || t.id === `template-${parsed.template}`);\n if (template == null) {\n const availableTemplates = TEMPLATES.filter(template => !template.hidden\n && (useBeta\n ? template.isBeta === true\n // isBeta could be null\n : !template.isBeta));\n if (availableTemplates.length === 0) {\n throw new Error(\"No available templates found for the selected options.\");\n }\n const templateId = (await consola.prompt(parsed.template != null\n ? `The provided template ${green(parsed.template)} is invalid please select a framework:`\n : \"Select a framework:\", {\n type: \"select\",\n options: availableTemplates.map((template) => ({\n value: template.id,\n label: template.label,\n })),\n // Types for \"select\" are wrong the value is returned rather than the option object\n // https://github.com/unjs/consola/pull/238\n }));\n template = TEMPLATES.find((t) => t.id === templateId);\n if (template == null) {\n throw new Error(`Template ${templateId} should be found`);\n }\n }\n return template;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,OAAO,eAAeC,cAAcA,CAACC,MAAM,EAAE;EACzC,IAAIC,OAAO,GAAGD,MAAM,CAACE,IAAI,IAAI,KAAK;EAClC,IAAIC,QAAQ,GAAGL,SAAS,CAACM,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,KAAKN,MAAM,CAACG,QAAQ,IAAIE,CAAC,CAACC,EAAE,KAAK,YAAYN,MAAM,CAACG,QAAQ,EAAE,CAAC;EACxG,IAAIA,QAAQ,IAAI,IAAI,EAAE;IAClB,MAAMI,kBAAkB,GAAGT,SAAS,CAACU,MAAM,CAACL,QAAQ,IAAI,CAACA,QAAQ,CAACM,MAAM,KAChER,OAAO,GACLE,QAAQ,CAACO,MAAM,KAAK;IACtB;IAAA,EACE,CAACP,QAAQ,CAACO,MAAM,CAAC,CAAC;IAC5B,IAAIH,kBAAkB,CAACI,MAAM,KAAK,CAAC,EAAE;MACjC,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;IAC7E;IACA,MAAMC,UAAU,GAAI,MAAMjB,OAAO,CAACkB,MAAM,CAACd,MAAM,CAACG,QAAQ,IAAI,IAAI,GAC1D,yBAAyBN,KAAK,CAACG,MAAM,CAACG,QAAQ,CAAC,wCAAwC,GACvF,qBAAqB,EAAE;MACzBY,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAET,kBAAkB,CAACU,GAAG,CAAEd,QAAQ,KAAM;QAC3Ce,KAAK,EAAEf,QAAQ,CAACG,EAAE;QAClBa,KAAK,EAAEhB,QAAQ,CAACgB;MACpB,CAAC,CAAC;MACF;MACA;IACJ,CAAC,CAAE;IACHhB,QAAQ,GAAGL,SAAS,CAACM,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,KAAKO,UAAU,CAAC;IACrD,IAAIV,QAAQ,IAAI,IAAI,EAAE;MAClB,MAAM,IAAIS,KAAK,CAAC,YAAYC,UAAU,kBAAkB,CAAC;IAC7D;EACJ;EACA,OAAOV,QAAQ;AACnB","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=promptTemplate.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptTemplate.test.d.ts","sourceRoot":"","sources":["../../../src/prompts/promptTemplate.test.ts"],"names":[],"mappings":""}
@@ -1,48 +0,0 @@
1
- /*
2
- * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { afterEach, expect, test, vi } from "vitest";
17
- import { consola } from "../consola.js";
18
- import { TEMPLATES } from "../templates.js";
19
- import { promptTemplate } from "./promptTemplate.js";
20
- vi.mock("../consola.js");
21
- afterEach(() => {
22
- vi.restoreAllMocks();
23
- });
24
- test("it accepts valid template from prompt", async () => {
25
- vi.mocked(consola).prompt.mockResolvedValueOnce(TEMPLATES[0].id);
26
- expect(await promptTemplate({})).toEqual(TEMPLATES[0]);
27
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
28
- });
29
- test("it accepts valid initial template id value without prompt", async () => {
30
- expect(await promptTemplate({
31
- template: TEMPLATES[0].id
32
- })).toEqual(TEMPLATES[0]);
33
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
34
- });
35
- test("it accepts valid initial template id value without 'template-' prefix without prompt", async () => {
36
- expect(await promptTemplate({
37
- template: TEMPLATES[0].id.substring("template-".length)
38
- })).toEqual(TEMPLATES[0]);
39
- expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();
40
- });
41
- test("it prompts if initial value is invalid", async () => {
42
- vi.mocked(consola).prompt.mockResolvedValueOnce(TEMPLATES[0].id);
43
- expect(await promptTemplate({
44
- template: "missing"
45
- })).toEqual(TEMPLATES[0]);
46
- expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);
47
- });
48
- //# sourceMappingURL=promptTemplate.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptTemplate.test.js","names":["afterEach","expect","test","vi","consola","TEMPLATES","promptTemplate","mock","restoreAllMocks","mocked","prompt","mockResolvedValueOnce","id","toEqual","toHaveBeenCalledTimes","template","not","toHaveBeenCalled","substring","length"],"sources":["promptTemplate.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { afterEach, expect, test, vi } from \"vitest\";\nimport { consola } from \"../consola.js\";\nimport { TEMPLATES } from \"../templates.js\";\nimport { promptTemplate } from \"./promptTemplate.js\";\nvi.mock(\"../consola.js\");\nafterEach(() => {\n vi.restoreAllMocks();\n});\ntest(\"it accepts valid template from prompt\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(TEMPLATES[0].id);\n expect(await promptTemplate({})).toEqual(TEMPLATES[0]);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\ntest(\"it accepts valid initial template id value without prompt\", async () => {\n expect(await promptTemplate({ template: TEMPLATES[0].id })).toEqual(TEMPLATES[0]);\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\ntest(\"it accepts valid initial template id value without 'template-' prefix without prompt\", async () => {\n expect(await promptTemplate({\n template: TEMPLATES[0].id.substring(\"template-\".length),\n })).toEqual(TEMPLATES[0]);\n expect(vi.mocked(consola).prompt).not.toHaveBeenCalled();\n});\ntest(\"it prompts if initial value is invalid\", async () => {\n vi.mocked(consola).prompt.mockResolvedValueOnce(TEMPLATES[0].id);\n expect(await promptTemplate({ template: \"missing\" })).toEqual(TEMPLATES[0]);\n expect(vi.mocked(consola).prompt).toHaveBeenCalledTimes(1);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AACpD,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,qBAAqB;AACpDH,EAAE,CAACI,IAAI,CAAC,eAAe,CAAC;AACxBP,SAAS,CAAC,MAAM;EACZG,EAAE,CAACK,eAAe,CAAC,CAAC;AACxB,CAAC,CAAC;AACFN,IAAI,CAAC,uCAAuC,EAAE,YAAY;EACtDC,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAACC,q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AC,CAAC,CAACF,OAAO,CAACR,SAAS,CAAC,CAAC,CAAC,CAAC;EAC3EJ,MAAM,CAACE,EAAE,CAACM,MAAM,CAACL,OAAO,CAAC,CAACM,MAAM,CAAC,CAACI,qBAAqB,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,16 +0,0 @@
1
- import type { Template } from "./templates.js";
2
- interface RunArgs {
3
- project: string;
4
- overwrite: boolean;
5
- template: Template;
6
- foundryUrl: string;
7
- applicationUrl: string | undefined;
8
- application: string;
9
- clientId: string;
10
- osdkPackage: string;
11
- osdkRegistryUrl: string;
12
- corsProxy: boolean;
13
- }
14
- export declare function run({ project, overwrite, template, foundryUrl, applicationUrl, application, clientId, osdkPackage, osdkRegistryUrl, corsProxy, }: RunArgs): Promise<void>;
15
- export {};
16
- //# sourceMappingURL=run.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAEhE,UAAU,OAAO;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,GAAG,CACvB,EACE,OAAO,EACP,SAAS,EACT,QAAQ,EACR,UAAU,EACV,cAAc,EACd,WAAW,EACX,QAAQ,EACR,WAAW,EACX,eAAe,EACf,SAAS,GACV,EAAE,OAAO,GACT,OAAO,CAAC,IAAI,CAAC,CAiHf"}
@@ -1,132 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import Handlebars from "handlebars";
17
- import fs from "node:fs";
18
- import path from "node:path";
19
- import { consola } from "./consola.js";
20
- import { generateEnvDevelopment, generateEnvProduction } from "./generate/generateEnv.js";
21
- import { generateFoundryConfigJson } from "./generate/generateFoundryConfigJson.js";
22
- import { generateNpmRc } from "./generate/generateNpmRc.js";
23
- import { green } from "./highlight.js";
24
- export async function run({
25
- project,
26
- overwrite,
27
- template,
28
- foundryUrl,
29
- applicationUrl,
30
- application,
31
- clientId,
32
- osdkPackage,
33
- osdkRegistryUrl,
34
- corsProxy
35
- }) {
36
- consola.log("");
37
- consola.start(`Creating project ${green(project)} using template ${green(template.id)}`);
38
- const cwd = process.cwd();
39
- const root = path.join(cwd, project);
40
- if (fs.existsSync(root)) {
41
- if (overwrite) {
42
- consola.info(`Overwriting existing project directory`);
43
- fs.rmSync(root, {
44
- recursive: true,
45
- force: true
46
- });
47
- fs.mkdirSync(root, {
48
- recursive: true
49
- });
50
- } else {
51
- consola.info(`Reusing existing project directory`);
52
- }
53
- } else {
54
- consola.info(`Creating project directory`);
55
- fs.mkdirSync(root, {
56
- recursive: true
57
- });
58
- }
59
- consola.info(`Copying files into project directory`);
60
- const files = await template.getFiles();
61
- for (const [filePath, contents] of files) {
62
- const finalPath = path.join(root, filePath);
63
- const dirPath = path.dirname(finalPath);
64
- await fs.promises.mkdir(dirPath, {
65
- recursive: true
66
- });
67
- await fs.promises.writeFile(finalPath, Buffer.from(contents.body, contents.type === "raw" ? "utf-8" : "base64"));
68
- }
69
- const templateContext = {
70
- project,
71
- foundryUrl,
72
- osdkPackage,
73
- corsProxy
74
- };
75
- const processFiles = function (dir) {
76
- fs.readdirSync(dir).forEach(function (file) {
77
- file = dir + "/" + file;
78
- const stat = fs.statSync(file);
79
- if (stat.isDirectory()) {
80
- processFiles(file);
81
- return;
82
- }
83
- if (file.endsWith("/_gitignore")) {
84
- fs.renameSync(file, file.replace(/\/_gitignore$/, "/.gitignore"));
85
- return;
86
- }
87
- if (!file.endsWith(".hbs")) {
88
- return;
89
- }
90
- const templated = Handlebars.compile(fs.readFileSync(file, "utf-8"))(templateContext);
91
- fs.writeFileSync(file.replace(/.hbs$/, ""), templated);
92
- fs.rmSync(file);
93
- });
94
- };
95
- processFiles(root);
96
- const npmRc = generateNpmRc({
97
- osdkPackage,
98
- osdkRegistryUrl
99
- });
100
- fs.writeFileSync(path.join(root, ".npmrc"), npmRc);
101
- const envDevelopment = generateEnvDevelopment({
102
- envPrefix: template.envPrefix,
103
- foundryUrl,
104
- clientId,
105
- corsProxy
106
- });
107
- fs.writeFileSync(path.join(root, ".env.development"), envDevelopment);
108
- const envProduction = generateEnvProduction({
109
- envPrefix: template.envPrefix,
110
- foundryUrl,
111
- applicationUrl,
112
- clientId
113
- });
114
- fs.writeFileSync(path.join(root, ".env.production"), envProduction);
115
- const foundryConfigJson = generateFoundryConfigJson({
116
- foundryUrl,
117
- application,
118
- directory: template.buildDirectory
119
- });
120
- fs.writeFileSync(path.join(root, "foundry.config.json"), foundryConfigJson);
121
- consola.success("Success");
122
- const cdRelative = path.relative(cwd, root);
123
- consola.box({
124
- message: `Done! Run the following commands to get started:\n` + `\n` + ` \`cd ${cdRelative}\`\n` + ` \`export FOUNDRY_TOKEN=<token>\`\n` + ` \`npm install\`\n` + ` \`npm run dev\``,
125
- style: {
126
- padding: 2,
127
- borderColor: "green",
128
- borderStyle: "rounded"
129
- }
130
- });
131
- }
132
- //# sourceMappingURL=run.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.js","names":["Handlebars","fs","path","consola","generateEnvDevelopment","generateEnvProduction","generateFoundryConfigJson","generateNpmRc","green","run","project","overwrite","template","foundryUrl","applicationUrl","application","clientId","osdkPackage","osdkRegistryUrl","corsProxy","log","start","id","cwd","process","root","join","existsSync","info","rmSync","recursive","force","mkdirSync","files","getFiles","filePath","contents","finalPath","dirPath","dirname","promises","mkdir","writeFile","Buffer","from","body","type","templateContext","processFiles","dir","readdirSync","forEach","file","stat","statSync","isDirectory","endsWith","renameSync","replace","templated","compile","readFileSync","writeFileSync","npmRc","envDevelopment","envPrefix","envProduction","foundryConfigJson","directory","buildDirectory","success","cdRelative","relative","box","message","style","padding","borderColor","borderStyle"],"sources":["run.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Handlebars from \"handlebars\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { consola } from \"./consola.js\";\nimport { generateEnvDevelopment, generateEnvProduction, } from \"./generate/generateEnv.js\";\nimport { generateFoundryConfigJson } from \"./generate/generateFoundryConfigJson.js\";\nimport { generateNpmRc } from \"./generate/generateNpmRc.js\";\nimport { green } from \"./highlight.js\";\nexport async function run({ project, overwrite, template, foundryUrl, applicationUrl, application, clientId, osdkPackage, osdkRegistryUrl, corsProxy, }) {\n consola.log(\"\");\n consola.start(`Creating project ${green(project)} using template ${green(template.id)}`);\n const cwd = process.cwd();\n const root = path.join(cwd, project);\n if (fs.existsSync(root)) {\n if (overwrite) {\n consola.info(`Overwriting existing project directory`);\n fs.rmSync(root, { recursive: true, force: true });\n fs.mkdirSync(root, { recursive: true });\n }\n else {\n consola.info(`Reusing existing project directory`);\n }\n }\n else {\n consola.info(`Creating project directory`);\n fs.mkdirSync(root, { recursive: true });\n }\n consola.info(`Copying files into project directory`);\n const files = await template.getFiles();\n for (const [filePath, contents] of files) {\n const finalPath = path.join(root, filePath);\n const dirPath = path.dirname(finalPath);\n await fs.promises.mkdir(dirPath, { recursive: true });\n await fs.promises.writeFile(finalPath, Buffer.from(contents.body, contents.type === \"raw\" ? \"utf-8\" : \"base64\"));\n }\n const templateContext = {\n project,\n foundryUrl,\n osdkPackage,\n corsProxy,\n };\n const processFiles = function (dir) {\n fs.readdirSync(dir).forEach(function (file) {\n file = dir + \"/\" + file;\n const stat = fs.statSync(file);\n if (stat.isDirectory()) {\n processFiles(file);\n return;\n }\n if (file.endsWith(\"/_gitignore\")) {\n fs.renameSync(file, file.replace(/\\/_gitignore$/, \"/.gitignore\"));\n return;\n }\n if (!file.endsWith(\".hbs\")) {\n return;\n }\n const templated = Handlebars.compile(fs.readFileSync(file, \"utf-8\"))(templateContext);\n fs.writeFileSync(file.replace(/.hbs$/, \"\"), templated);\n fs.rmSync(file);\n });\n };\n processFiles(root);\n const npmRc = generateNpmRc({ osdkPackage, osdkRegistryUrl });\n fs.writeFileSync(path.join(root, \".npmrc\"), npmRc);\n const envDevelopment = generateEnvDevelopment({\n envPrefix: template.envPrefix,\n foundryUrl,\n clientId,\n corsProxy,\n });\n fs.writeFileSync(path.join(root, \".env.development\"), envDevelopment);\n const envProduction = generateEnvProduction({\n envPrefix: template.envPrefix,\n foundryUrl,\n applicationUrl,\n clientId,\n });\n fs.writeFileSync(path.join(root, \".env.production\"), envProduction);\n const foundryConfigJson = generateFoundryConfigJson({\n foundryUrl,\n application,\n directory: template.buildDirectory,\n });\n fs.writeFileSync(path.join(root, \"foundry.config.json\"), foundryConfigJson);\n consola.success(\"Success\");\n const cdRelative = path.relative(cwd, root);\n consola.box({\n message: `Done! Run the following commands to get started:\\n`\n + `\\n`\n + ` \\`cd ${cdRelative}\\`\\n`\n + ` \\`export FOUNDRY_TOKEN=<token>\\`\\n`\n + ` \\`npm install\\`\\n`\n + ` \\`npm run dev\\``,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\",\n },\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,EAAE,MAAM,SAAS;AACxB,OAAOC,IAAI,MAAM,WAAW;AAC5B,SAASC,OAAO,QAAQ,cAAc;AACtC,SAASC,sBAAsB,EAAEC,qBAAqB,QAAS,2BAA2B;AAC1F,SAASC,yBAAyB,QAAQ,yCAAyC;AACnF,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,KAAK,QAAQ,gBAAgB;AACtC,OAAO,eAAeC,GAAGA,CAAC;EAAEC,OAAO;EAAEC,SAAS;EAAEC,QAAQ;EAAEC,UAAU;EAAEC,cAAc;EAAEC,WAAW;EAAEC,QAAQ;EAAEC,WAAW;EAAEC,eAAe;EAAEC;AAAW,CAAC,EAAE;EACrJhB,OAAO,CAACiB,GAAG,CAAC,EAAE,CAAC;EACfjB,OAAO,CAACkB,KAAK,CAAC,oBAAoBb,KAAK,CAACE,OAAO,CAAC,mBAAmBF,KAAK,CAACI,QAAQ,CAACU,EAAE,CAAC,EAAE,CAAC;EACxF,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAAG,CAAC,CAAC;EACzB,MAAME,IAAI,GAAGvB,IAAI,CAACwB,IAAI,CAACH,GAAG,EAAEb,OAAO,CAAC;EACpC,IAAIT,EAAE,CAAC0B,UAAU,CAACF,IAAI,CAAC,EAAE;IACrB,IAAId,SAAS,EAAE;MACXR,OAAO,CAACyB,IAAI,CAAC,wCAAwC,CAAC;MACtD3B,EAAE,CAAC4B,MAAM,CAACJ,IAAI,EAAE;QAAEK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BAAqB,CAAC;IACxC4D,SAAS,EAAErD,QAAQ,CAACqD,SAAS;IAC7BpD,UAAU;IACVC,cAAc;IACdE;EACJ,CAAC,CAAC;EACFf,EAAE,CAAC6D,aAAa,CAAC5D,IAAI,CAACwB,IAAI,CAACD,IAAI,EAAE,iBAAiB,CAAC,EAAEyC,aAAa,CAAC;EACnE,MAAMC,iBAAiB,GAAG7D,yBAAyB,CAAC;IAChDO,UAAU;IACVE,WAAW;IACXqD,SAAS,EAAExD,QAAQ,CAACyD;EACxB,CAAC,CAAC;EACFpE,EAAE,CAAC6D,aAAa,CAAC5D,IAAI,CAACwB,IAAI,CAACD,IAAI,EAAE,qBAAqB,CAAC,EAAE0C,iBAAiB,CAAC;EAC3EhE,OAAO,CAACmE,OAAO,CAAC,SAAS,CAAC;EAC1B,MAAMC,UAAU,GAAGrE,IAAI,CAACsE,QAAQ,CAACjD,GAAG,EAAEE,IAAI,CAAC;EAC3CtB,OAAO,CAACsE,GAAG,CAAC;IACRC,OAAO,EAAE,oDAAoD,GACvD,IAAI,GACJ,UAAUH,UAAU,MAAM,GAC1B,sCAAsC,GACtC,qBAAqB,GACrB,mBAAmB;IACzBI,KAAK,EAAE;MACHC,OAAO,EAAE,CAAC;MACVC,WAAW,EAAE,OAAO;MACpBC,WAAW,EAAE;IACjB;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- export interface Template {
2
- id: string;
3
- label: string;
4
- envPrefix: string;
5
- buildDirectory: string;
6
- hidden?: boolean;
7
- isBeta?: boolean;
8
- getFiles: () => Promise<Map<string, {
9
- type: "base64";
10
- body: string;
11
- } | {
12
- type: "raw";
13
- body: string;
14
- }>>;
15
- }
16
- export interface TemplateContext {
17
- project: string;
18
- foundryUrl: string;
19
- osdkPackage: string;
20
- corsProxy: boolean;
21
- }
22
- export declare const TEMPLATES: readonly Template[];
23
- //# sourceMappingURL=templates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/templates.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CACrB,GAAG,CACD,MAAM,EACN;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CACjE,CACF,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,SAAS,QAAQ,EA0DxC,CAAC"}
@@ -1,56 +0,0 @@
1
- /*
2
- * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export const TEMPLATES = [{
17
- id: "template-react",
18
- label: "React",
19
- envPrefix: "VITE_",
20
- buildDirectory: "./dist",
21
- getFiles: async () => (await import(`@osdk/create-app.template.react`)).files
22
- }, {
23
- id: "template-react-beta",
24
- label: "React",
25
- envPrefix: "VITE_",
26
- buildDirectory: "./dist",
27
- isBeta: true,
28
- getFiles: async () => (await import(`@osdk/create-app.template.react.beta`)).files
29
- }, {
30
- id: "template-vue",
31
- label: "Vue",
32
- envPrefix: "VITE_",
33
- buildDirectory: "./dist",
34
- getFiles: async () => (await import(`@osdk/create-app.template.vue`)).files
35
- }, {
36
- id: "template-next-static-export",
37
- label: "Next (static export)",
38
- envPrefix: "NEXT_PUBLIC_",
39
- buildDirectory: "./out",
40
- getFiles: async () => (await import(`@osdk/create-app.template.next-static-export`)).files
41
- }, {
42
- id: "template-tutorial-todo-app",
43
- label: "Tutorial: To do App",
44
- envPrefix: "VITE_",
45
- buildDirectory: "./dist",
46
- hidden: true,
47
- getFiles: async () => (await import(`@osdk/create-app.template.tutorial-todo-app`)).files
48
- }, {
49
- id: "template-tutorial-todo-aip-app",
50
- label: "Tutorial: To do AIP App",
51
- envPrefix: "VITE_",
52
- buildDirectory: "./dist",
53
- hidden: true,
54
- getFiles: async () => (await import(`@osdk/create-app.template.tutorial-todo-aip-app`)).files
55
- }];
56
- //# sourceMappingURL=templates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templates.js","names":["TEMPLATES","id","label","envPrefix","buildDirectory","getFiles","files","isBeta","hidden"],"sources":["templates.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const TEMPLATES = [\n {\n id: \"template-react\",\n label: \"React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n getFiles: async () => ((await import(`@osdk/create-app.template.react`)).files),\n },\n {\n id: \"template-react-beta\",\n label: \"React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n isBeta: true,\n getFiles: async () => ((await import(`@osdk/create-app.template.react.beta`)).files),\n },\n {\n id: \"template-vue\",\n label: \"Vue\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n getFiles: async () => ((await import(`@osdk/create-app.template.vue`)).files),\n },\n {\n id: \"template-next-static-export\",\n label: \"Next (static export)\",\n envPrefix: \"NEXT_PUBLIC_\",\n buildDirectory: \"./out\",\n getFiles: async () => ((await import(`@osdk/create-app.template.next-static-export`)).files),\n },\n {\n id: \"template-tutorial-todo-app\",\n label: \"Tutorial: To do App\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n hidden: true,\n getFiles: async () => ((await import(`@osdk/create-app.template.tutorial-todo-app`)).files),\n },\n {\n id: \"template-tutorial-todo-aip-app\",\n label: \"Tutorial: To do AIP App\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n hidden: true,\n getFiles: async () => ((await import(`@osdk/create-app.template.tutorial-todo-aip-app`)).files),\n },\n];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,CACrB;EACIC,EAAE,EAAE,gBAAgB;EACpBC,KAAK,EAAE,OAAO;EACdC,SAAS,EAAE,OAAO;EAClBC,cAAc,EAAE,QAAQ;EACxBC,QAAQ,EAAE,MAAAA,CAAA,KAAa,CAAC,MAAM,MAAM,CAAC,iCAAiC,CAAC,EAAEC;AAC7E,CAAC,EACD;EACIL,EAAE,EAAE,qBAAqB;EACzBC,KAAK,EAAE,OAAO;EACdC,SAAS,EAAE,OAAO;EAClBC,cAAc,EAAE,QAAQ;EACxBG,MAAM,EAAE,IAAI;EACZF,QAAQ,EAAE,MAAAA,CAAA,KAAa,CAAC,MAAM,MAAM,CAAC,sCAAsC,CAAC,EAAEC;AAClF,CAAC,EACD;EACIL,EAAE,EAAE,cAAc;EAClBC,KAAK,EAAE,KAAK;EACZC,SAAS,EAAE,OAAO;EAClBC,cAAc,EAAE,QAAQ;EACxBC,QAAQ,EAAE,MAAAA,CAAA,KAAa,CAAC,MAAM,MAAM,CAAC,+BAA+B,CAAC,EAAEC;AAC3E,CAAC,EACD;EACIL,EAAE,EAAE,6BAA6B;EACjCC,KAAK,EAAE,sBAAsB;EAC7BC,SAAS,EAAE,cAAc;EACzBC,cAAc,EAAE,OAAO;EACvBC,QAAQ,EAAE,MAAAA,CAAA,KAAa,CAAC,MAAM,MAAM,CAAC,8CAA8C,CAAC,EAAEC;AAC1F,CAAC,EACD;EACIL,EAAE,EAAE,4BAA4B;EAChCC,KAAK,EAAE,qBAAqB;EAC5BC,SAAS,EAAE,OAAO;EAClBC,cAAc,EAAE,QAAQ;EACxBI,MAAM,EAAE,IAAI;EACZH,QAAQ,EAAE,MAAAA,CAAA,KAAa,CAAC,MAAM,MAAM,CAAC,6CAA6C,CAAC,EAAEC;AACzF,CAAC,EACD;EACIL,EAAE,EAAE,gCAAgC;EACpCC,KAAK,EAAE,yBAAyB;EAChCC,SAAS,EAAE,OAAO;EAClBC,cAAc,EAAE,QAAQ;EACxBI,MAAM,EAAE,IAAI;EACZH,QAAQ,EAAE,MAAAA,CAAA,KAAa,CAAC,MAAM,MAAM,CAAC,iDAAiD,CAAC,EAAEC;AAC7F,CAAC,CACJ","ignoreList":[]}
package/build/esm/cli.js DELETED
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import yargs from "yargs";
17
- import { hideBin } from "yargs/helpers";
18
- import { promptApplicationRid } from "./prompts/promptApplicationRid.js";
19
- import { promptApplicationUrl } from "./prompts/promptApplicationUrl.js";
20
- import { promptClientId } from "./prompts/promptClientId.js";
21
- import { promptCorsProxy } from "./prompts/promptCorsProxy.js";
22
- import { promptFoundryUrl } from "./prompts/promptFoundryUrl.js";
23
- import { promptOsdkPackage } from "./prompts/promptOsdkPackage.js";
24
- import { promptOsdkRegistryUrl } from "./prompts/promptOsdkRegistryUrl.js";
25
- import { promptOverwrite } from "./prompts/promptOverwrite.js";
26
- import { promptProject } from "./prompts/promptProject.js";
27
- import { promptTemplate } from "./prompts/promptTemplate.js";
28
- import { run } from "./run.js";
29
- export async function cli(args = process.argv) {
30
- const base = yargs(hideBin(args)).version("0.19.0-beta.6" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", yargs => yargs.positional("project", {
31
- type: "string",
32
- describe: "Project name to create"
33
- }).option("overwrite", {
34
- type: "boolean",
35
- describe: "Overwrite project directory if already exists"
36
- }).option("beta", {
37
- type: "boolean",
38
- describe: "Use templates compatible with the Beta version of the SDK"
39
- }).option("template", {
40
- type: "string",
41
- describe: "Template name to use"
42
- }).option("foundryUrl", {
43
- type: "string",
44
- describe: "URL for the Foundry stack"
45
- }).option("applicationUrl", {
46
- type: "string",
47
- describe: "URL the production application will be hosted on",
48
- conflicts: "skipApplicationUrl"
49
- }).option("skipApplicationUrl", {
50
- type: "boolean",
51
- describe: "Skip filling in URL the production application will be hosted on"
52
- }).option("application", {
53
- type: "string",
54
- describe: "Application resource identifier (rid)"
55
- }).option("clientId", {
56
- type: "string",
57
- describe: "OAuth client ID for application"
58
- }).option("osdkPackage", {
59
- type: "string",
60
- describe: "OSDK package name for application"
61
- }).option("osdkRegistryUrl", {
62
- type: "string",
63
- describe: "URL for NPM registry to install OSDK package"
64
- }).option("corsProxy", {
65
- type: "boolean",
66
- describe: "Include a CORS proxy for Foundry API requests during local development"
67
- }));
68
- const parsed = base.parseSync();
69
- const project = await promptProject(parsed);
70
- const overwrite = await promptOverwrite({
71
- ...parsed,
72
- project
73
- });
74
- const template = await promptTemplate(parsed);
75
- const foundryUrl = await promptFoundryUrl(parsed);
76
- const applicationUrl = await promptApplicationUrl(parsed);
77
- const application = await promptApplicationRid(parsed);
78
- const clientId = await promptClientId(parsed);
79
- const osdkPackage = await promptOsdkPackage(parsed);
80
- const osdkRegistryUrl = await promptOsdkRegistryUrl(parsed);
81
- const corsProxy = await promptCorsProxy(parsed);
82
- await run({
83
- project,
84
- overwrite,
85
- template,
86
- foundryUrl,
87
- applicationUrl,
88
- application,
89
- clientId,
90
- osdkPackage,
91
- osdkRegistryUrl,
92
- corsProxy
93
- });
94
- }
95
- //# sourceMappingURL=cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","names":["yargs","hideBin","promptApplicationRid","promptApplicationUrl","promptClientId","promptCorsProxy","promptFoundryUrl","promptOsdkPackage","promptOsdkRegistryUrl","promptOverwrite","promptProject","promptTemplate","run","cli","args","process","argv","base","version","wrap","Math","min","terminalWidth","strict","help","command","positional","type","describe","option","conflicts","parsed","parseSync","project","overwrite","template","foundryUrl","applicationUrl","application","clientId","osdkPackage","osdkRegistryUrl","corsProxy"],"sources":["cli.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { promptApplicationRid } from \"./prompts/promptApplicationRid.js\";\nimport { promptApplicationUrl } from \"./prompts/promptApplicationUrl.js\";\nimport { promptClientId } from \"./prompts/promptClientId.js\";\nimport { promptCorsProxy } from \"./prompts/promptCorsProxy.js\";\nimport { promptFoundryUrl } from \"./prompts/promptFoundryUrl.js\";\nimport { promptOsdkPackage } from \"./prompts/promptOsdkPackage.js\";\nimport { promptOsdkRegistryUrl } from \"./prompts/promptOsdkRegistryUrl.js\";\nimport { promptOverwrite } from \"./prompts/promptOverwrite.js\";\nimport { promptProject } from \"./prompts/promptProject.js\";\nimport { promptTemplate } from \"./prompts/promptTemplate.js\";\nimport { run } from \"./run.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .command(\"$0 [project] [--<option>]\", \"Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.\", (yargs) => yargs\n .positional(\"project\", {\n type: \"string\",\n describe: \"Project name to create\",\n })\n .option(\"overwrite\", {\n type: \"boolean\",\n describe: \"Overwrite project directory if already exists\",\n })\n .option(\"beta\", {\n type: \"boolean\",\n describe: \"Use templates compatible with the Beta version of the SDK\",\n })\n .option(\"template\", {\n type: \"string\",\n describe: \"Template name to use\",\n })\n .option(\"foundryUrl\", {\n type: \"string\",\n describe: \"URL for the Foundry stack\",\n })\n .option(\"applicationUrl\", {\n type: \"string\",\n describe: \"URL the production application will be hosted on\",\n conflicts: \"skipApplicationUrl\",\n })\n .option(\"skipApplicationUrl\", {\n type: \"boolean\",\n describe: \"Skip filling in URL the production application will be hosted on\",\n })\n .option(\"application\", {\n type: \"string\",\n describe: \"Application resource identifier (rid)\",\n })\n .option(\"clientId\", {\n type: \"string\",\n describe: \"OAuth client ID for application\",\n })\n .option(\"osdkPackage\", {\n type: \"string\",\n describe: \"OSDK package name for application\",\n })\n .option(\"osdkRegistryUrl\", {\n type: \"string\",\n describe: \"URL for NPM registry to install OSDK package\",\n })\n .option(\"corsProxy\", {\n type: \"boolean\",\n describe: \"Include a CORS proxy for Foundry API requests during local development\",\n }));\n const parsed = base.parseSync();\n const project = await promptProject(parsed);\n const overwrite = await promptOverwrite({ ...parsed, project });\n const template = await promptTemplate(parsed);\n const foundryUrl = await promptFoundryUrl(parsed);\n const applicationUrl = await promptApplicationUrl(parsed);\n const application = await promptApplicationRid(parsed);\n const clientId = await promptClientId(parsed);\n const osdkPackage = await promptOsdkPackage(parsed);\n const osdkRegistryUrl = await promptOsdkRegistryUrl(parsed);\n const corsProxy = await promptCorsProxy(parsed);\n await run({\n project,\n overwrite,\n template,\n foundryUrl,\n applicationUrl,\n application,\n clientId,\n osdkPackage,\n osdkRegistryUrl,\n corsProxy,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,GAAG,QAAQ,UAAU;AAC9B,OAAO,eAAeC,GAAGA,CAACC,IAAI,GAAGC,OAAO,CAACC,IAAI,EAAE;EAC3C,MAAMC,IAAI,GAAGjB,KAAK,CAACC,OAAO,CAACa,IAAI,CAAC,CAAC,CAC5BI,OAAO,CAAC,mBAA+B,EAAE,CAAC,CAC1CC,IAAI,CAACC,IAAI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dC,QAAQ,EAAE;EACd,CAAC,CAAC,CACGC,MAAM,CAAC,WAAW,EAAE;IACrBF,IAAI,EAAE,SAAS;IACfC,QAAQ,EAAE;EACd,CAAC,CAAC,CAAC;EACH,MAAMG,MAAM,GAAGd,IAAI,CAACe,SAAS,CAAC,CAAC;EAC/B,MAAMC,OAAO,GAAG,MAAMvB,aAAa,CAACqB,MAAM,CAAC;EAC3C,MAAMG,SAAS,GAAG,MAAMzB,eAAe,CAAC;IAAE,GAAGsB,MAAM;IAAEE;EAAQ,CAAC,CAAC;EAC/D,MAAME,QAAQ,GAAG,MAAMxB,cAAc,CAACoB,MAAM,CAAC;EAC7C,MAAMK,UAAU,GAAG,MAAM9B,gBAAgB,CAACyB,MAAM,CAAC;EACjD,MAAMM,cAAc,GAAG,MAAMlC,oBAAoB,CAAC4B,MAAM,CAAC;EACzD,MAAMO,WAAW,GAAG,MAAMpC,oBAAoB,CAAC6B,MAAM,CAAC;EACtD,MAAMQ,QAAQ,GAAG,MAAMnC,cAAc,CAAC2B,MAAM,CAAC;EAC7C,MAAMS,WAAW,GAAG,MAAMjC,iBAAiB,CAACwB,MAAM,CAAC;EACnD,MAAMU,eAAe,GAAG,MAAMjC,qBAAqB,CAACuB,MAAM,CAAC;EAC3D,MAAMW,SAAS,GAAG,MAAMrC,eAAe,CAAC0B,MAAM,CAAC;EAC/C,MAAMnB,GAAG,CAAC;IACNqB,OAAO;IACPC,SAAS;IACTC,QAAQ;IACRC,UAAU;IACVC,cAAc;IACdC,WAAW;IACXC,QAAQ;IACRC,WAAW;IACXC,eAAe;IACfC;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
@@ -1,59 +0,0 @@
1
- /*
2
- * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import fs from "node:fs";
17
- import path from "node:path";
18
- import { dirSync } from "tmp";
19
- import { beforeEach, expect, test, vi } from "vitest";
20
- import { cli } from "./cli.js";
21
- import { TEMPLATES } from "./templates.js";
22
- beforeEach(() => {
23
- const tmpDir = dirSync({
24
- unsafeCleanup: true
25
- });
26
- const tmpDirName = tmpDir.name;
27
- vi.spyOn(process, "cwd").mockImplementation(() => tmpDirName);
28
- return () => {
29
- vi.restoreAllMocks();
30
- tmpDir?.removeCallback();
31
- };
32
- });
33
- for (const template of TEMPLATES) {
34
- test(`CLI creates ${template.id}`, async () => {
35
- await runTest({
36
- project: `expected-${template.id}`,
37
- template,
38
- corsProxy: false
39
- });
40
- });
41
- test(`CLI creates ${template.id} with CORS proxy`, async () => {
42
- await runTest({
43
- project: `expected-${template.id}-cors-proxy`,
44
- template,
45
- corsProxy: true
46
- });
47
- });
48
- }
49
- async function runTest({
50
- project,
51
- template,
52
- corsProxy
53
- }) {
54
- await cli(["npx", "@osdk/create-app", project, "--overwrite", "--template", template.id, "--foundryUrl", "https://example.palantirfoundry.com", "--applicationUrl", "https://app.example.palantirfoundry.com", "--application", "ri.third-party-applications.main.application.fake", "--clientId", "123", "--osdkPackage", "@fake/sdk", "--osdkRegistryUrl", "https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm", "--corsProxy", corsProxy.toString()]);
55
- expect(fs.readdirSync(path.join(process.cwd(), project)).length).toBeGreaterThan(0);
56
- expect(fs.existsSync(path.join(process.cwd(), project, "package.json"))).toBe(true);
57
- expect(fs.existsSync(path.join(process.cwd(), project, "README.md"))).toBe(true);
58
- }
59
- //# sourceMappingURL=cli.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.test.js","names":["fs","path","dirSync","beforeEach","expect","test","vi","cli","TEMPLATES","tmpDir","unsafeCleanup","tmpDirName","name","spyOn","process","mockImplementation","restoreAllMocks","removeCallback","template","id","runTest","project","corsProxy","toString","readdirSync","join","cwd","length","toBeGreaterThan","existsSync","toBe"],"sources":["cli.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { dirSync } from \"tmp\";\nimport { beforeEach, expect, test, vi } from \"vitest\";\nimport { cli } from \"./cli.js\";\nimport { TEMPLATES } from \"./templates.js\";\nbeforeEach(() => {\n const tmpDir = dirSync({ unsafeCleanup: true });\n const tmpDirName = tmpDir.name;\n vi.spyOn(process, \"cwd\").mockImplementation(() => tmpDirName);\n return () => {\n vi.restoreAllMocks();\n tmpDir?.removeCallback();\n };\n});\nfor (const template of TEMPLATES) {\n test(`CLI creates ${template.id}`, async () => {\n await runTest({\n project: `expected-${template.id}`,\n template,\n corsProxy: false,\n });\n });\n test(`CLI creates ${template.id} with CORS proxy`, async () => {\n await runTest({\n project: `expected-${template.id}-cors-proxy`,\n template,\n corsProxy: true,\n });\n });\n}\nasync function runTest({ project, template, corsProxy }) {\n await cli([\n \"npx\",\n \"@osdk/create-app\",\n project,\n \"--overwrite\",\n \"--template\",\n template.id,\n \"--foundryUrl\",\n \"https://example.palantirfoundry.com\",\n \"--applicationUrl\",\n \"https://app.example.palantirfoundry.com\",\n \"--application\",\n \"ri.third-party-applications.main.application.fake\",\n \"--clientId\",\n \"123\",\n \"--osdkPackage\",\n \"@fake/sdk\",\n \"--osdkRegistryUrl\",\n \"https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm\",\n \"--corsProxy\",\n corsProxy.toString(),\n ]);\n expect(fs.readdirSync(path.join(process.cwd(), project)).length)\n .toBeGreaterThan(0);\n expect(fs.existsSync(path.join(process.cwd(), project, \"package.json\")))\n .toBe(true);\n expect(fs.existsSync(path.join(process.cwd(), project, \"README.md\")))\n .toBe(true);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,EAAE,MAAM,SAAS;AACxB,OAAOC,IAAI,MAAM,WAAW;AAC5B,SAASC,OAAO,QAAQ,KAAK;AAC7B,SAASC,UAAU,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AACrD,SAASC,GAAG,QAAQ,UAAU;AAC9B,SAASC,SAAS,QAAQ,gBAAgB;AAC1CL,UAAU,CAAC,MAAM;EACb,MAAMM,MAAM,GAAGP,OAAO,CAAC;IAAEQ,aAAa,EAAE;EAAK,CAAC,CAAC;EAC/C,MAAMC,UAAU,GAAGF,MAAM,CAACG,IAAI;EAC9BN,EAAE,CAACO,KAAK,CAACC,OAAO,EAAE,KAAK,CAAC,CAACC,kBAAkB,CAAC,MAAMJ,UAAU,CAAC;EAC7D,OAAO,MAAM;IACTL,EAAE,CAACU,eAAe,CAAC,CAAC;IACpBP,MAAM,EAAEQ,cAAc,CAAC,CAAC;EAC5B,CAAC;AACL,CAAC,CAAC;AACF,KAAK,MAAMC,QAAQ,IAAIV,SAAS,EAAE;EAC9BH,IAAI,CAAC,eAAea,QAAQ,CAACC,EAAE,EAAE,EAAE,YAAY;IAC3C,MAAMC,OAAO,CAAC;MACVC,OAAO,EAAE,YAAYH,QAAQ,CAACC,EAAE,EAAE;MAClCD,QAAQ;MACRI,SAAS,EAAE;IACf,CAAC,CAAC;EACN,CAAC,CAAC;EACFj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