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

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/cli.d.ts +2 -0
  3. package/build/browser/cli.d.ts.map +1 -0
  4. package/build/browser/cli.js +95 -0
  5. package/build/browser/cli.js.map +1 -0
  6. package/build/browser/cli.test.d.ts +2 -0
  7. package/build/browser/cli.test.d.ts.map +1 -0
  8. package/build/browser/cli.test.js +59 -0
  9. package/build/browser/cli.test.js.map +1 -0
  10. package/build/browser/consola.d.ts +3 -0
  11. package/build/browser/consola.d.ts.map +1 -0
  12. package/build/browser/consola.js +28 -0
  13. package/build/browser/consola.js.map +1 -0
  14. package/build/browser/generate/generateEnv.d.ts +13 -0
  15. package/build/browser/generate/generateEnv.d.ts.map +1 -0
  16. package/build/browser/generate/generateEnv.js +50 -0
  17. package/build/browser/generate/generateEnv.js.map +1 -0
  18. package/build/browser/generate/generateEnv.test.d.ts +2 -0
  19. package/build/browser/generate/generateEnv.test.d.ts.map +1 -0
  20. package/build/browser/generate/generateEnv.test.js +70 -0
  21. package/build/browser/generate/generateEnv.test.js.map +1 -0
  22. package/build/browser/generate/generateFoundryConfigJson.d.ts +6 -0
  23. package/build/browser/generate/generateFoundryConfigJson.d.ts.map +1 -0
  24. package/build/browser/generate/generateFoundryConfigJson.js +33 -0
  25. package/build/browser/generate/generateFoundryConfigJson.js.map +1 -0
  26. package/build/browser/generate/generateFoundryConfigJson.test.d.ts +2 -0
  27. package/build/browser/generate/generateFoundryConfigJson.test.d.ts.map +1 -0
  28. package/build/browser/generate/generateFoundryConfigJson.test.js +38 -0
  29. package/build/browser/generate/generateFoundryConfigJson.test.js.map +1 -0
  30. package/build/browser/generate/generateNpmRc.d.ts +5 -0
  31. package/build/browser/generate/generateNpmRc.d.ts.map +1 -0
  32. package/build/browser/generate/generateNpmRc.js +27 -0
  33. package/build/browser/generate/generateNpmRc.js.map +1 -0
  34. package/build/browser/generate/generateNpmRc.test.d.ts +2 -0
  35. package/build/browser/generate/generateNpmRc.test.d.ts.map +1 -0
  36. package/build/browser/generate/generateNpmRc.test.js +28 -0
  37. package/build/browser/generate/generateNpmRc.test.js.map +1 -0
  38. package/build/browser/highlight.d.ts +3 -0
  39. package/build/browser/highlight.d.ts.map +1 -0
  40. package/build/browser/highlight.js +23 -0
  41. package/build/browser/highlight.js.map +1 -0
  42. package/build/browser/index.d.ts +5 -0
  43. package/build/browser/index.d.ts.map +1 -0
  44. package/build/browser/index.js +18 -540
  45. package/build/browser/index.js.map +1 -1
  46. package/build/browser/prompts/promptApplicationRid.d.ts +4 -0
  47. package/build/browser/prompts/promptApplicationRid.d.ts.map +1 -0
  48. package/build/browser/prompts/promptApplicationRid.js +31 -0
  49. package/build/browser/prompts/promptApplicationRid.js.map +1 -0
  50. package/build/browser/prompts/promptApplicationRid.test.d.ts +2 -0
  51. package/build/browser/prompts/promptApplicationRid.test.d.ts.map +1 -0
  52. package/build/browser/prompts/promptApplicationRid.test.js +48 -0
  53. package/build/browser/prompts/promptApplicationRid.test.js.map +1 -0
  54. package/build/browser/prompts/promptApplicationUrl.d.ts +5 -0
  55. package/build/browser/prompts/promptApplicationUrl.d.ts.map +1 -0
  56. package/build/browser/prompts/promptApplicationUrl.js +50 -0
  57. package/build/browser/prompts/promptApplicationUrl.js.map +1 -0
  58. package/build/browser/prompts/promptApplicationUrl.test.d.ts +2 -0
  59. package/build/browser/prompts/promptApplicationUrl.test.d.ts.map +1 -0
  60. package/build/browser/prompts/promptApplicationUrl.test.js +68 -0
  61. package/build/browser/prompts/promptApplicationUrl.test.js.map +1 -0
  62. package/build/browser/prompts/promptClientId.d.ts +4 -0
  63. package/build/browser/prompts/promptClientId.d.ts.map +1 -0
  64. package/build/browser/prompts/promptClientId.js +31 -0
  65. package/build/browser/prompts/promptClientId.js.map +1 -0
  66. package/build/browser/prompts/promptClientId.test.d.ts +2 -0
  67. package/build/browser/prompts/promptClientId.test.d.ts.map +1 -0
  68. package/build/browser/prompts/promptClientId.test.js +47 -0
  69. package/build/browser/prompts/promptClientId.test.js.map +1 -0
  70. package/build/browser/prompts/promptCorsProxy.d.ts +4 -0
  71. package/build/browser/prompts/promptCorsProxy.d.ts.map +1 -0
  72. package/build/browser/prompts/promptCorsProxy.js +29 -0
  73. package/build/browser/prompts/promptCorsProxy.js.map +1 -0
  74. package/build/browser/prompts/promptCorsProxy.test.d.ts +2 -0
  75. package/build/browser/prompts/promptCorsProxy.test.d.ts.map +1 -0
  76. package/build/browser/prompts/promptCorsProxy.test.js +44 -0
  77. package/build/browser/prompts/promptCorsProxy.test.js.map +1 -0
  78. package/build/browser/prompts/promptFoundryUrl.d.ts +4 -0
  79. package/build/browser/prompts/promptFoundryUrl.d.ts.map +1 -0
  80. package/build/browser/prompts/promptFoundryUrl.js +31 -0
  81. package/build/browser/prompts/promptFoundryUrl.js.map +1 -0
  82. package/build/browser/prompts/promptFoundryUrl.test.d.ts +2 -0
  83. package/build/browser/prompts/promptFoundryUrl.test.d.ts.map +1 -0
  84. package/build/browser/prompts/promptFoundryUrl.test.js +55 -0
  85. package/build/browser/prompts/promptFoundryUrl.test.js.map +1 -0
  86. package/build/browser/prompts/promptOsdkPackage.d.ts +4 -0
  87. package/build/browser/prompts/promptOsdkPackage.d.ts.map +1 -0
  88. package/build/browser/prompts/promptOsdkPackage.js +31 -0
  89. package/build/browser/prompts/promptOsdkPackage.js.map +1 -0
  90. package/build/browser/prompts/promptOsdkPackage.test.d.ts +2 -0
  91. package/build/browser/prompts/promptOsdkPackage.test.d.ts.map +1 -0
  92. package/build/browser/prompts/promptOsdkPackage.test.js +48 -0
  93. package/build/browser/prompts/promptOsdkPackage.test.js.map +1 -0
  94. package/build/browser/prompts/promptOsdkRegistryUrl.d.ts +4 -0
  95. package/build/browser/prompts/promptOsdkRegistryUrl.d.ts.map +1 -0
  96. package/build/browser/prompts/promptOsdkRegistryUrl.js +31 -0
  97. package/build/browser/prompts/promptOsdkRegistryUrl.js.map +1 -0
  98. package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts +2 -0
  99. package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts.map +1 -0
  100. package/build/browser/prompts/promptOsdkRegistryUrl.test.js +54 -0
  101. package/build/browser/prompts/promptOsdkRegistryUrl.test.js.map +1 -0
  102. package/build/browser/prompts/promptOverwrite.d.ts +5 -0
  103. package/build/browser/prompts/promptOverwrite.d.ts.map +1 -0
  104. package/build/browser/prompts/promptOverwrite.js +53 -0
  105. package/build/browser/prompts/promptOverwrite.js.map +1 -0
  106. package/build/browser/prompts/promptOverwrite.test.d.ts +2 -0
  107. package/build/browser/prompts/promptOverwrite.test.d.ts.map +1 -0
  108. package/build/browser/prompts/promptOverwrite.test.js +55 -0
  109. package/build/browser/prompts/promptOverwrite.test.js.map +1 -0
  110. package/build/browser/prompts/promptProject.d.ts +4 -0
  111. package/build/browser/prompts/promptProject.d.ts.map +1 -0
  112. package/build/browser/prompts/promptProject.js +32 -0
  113. package/build/browser/prompts/promptProject.js.map +1 -0
  114. package/build/browser/prompts/promptProject.test.d.ts +2 -0
  115. package/build/browser/prompts/promptProject.test.d.ts.map +1 -0
  116. package/build/browser/prompts/promptProject.test.js +47 -0
  117. package/build/browser/prompts/promptProject.test.js.map +1 -0
  118. package/build/browser/prompts/promptTemplate.d.ts +6 -0
  119. package/build/browser/prompts/promptTemplate.d.ts.map +1 -0
  120. package/build/browser/prompts/promptTemplate.js +45 -0
  121. package/build/browser/prompts/promptTemplate.js.map +1 -0
  122. package/build/browser/prompts/promptTemplate.test.d.ts +2 -0
  123. package/build/browser/prompts/promptTemplate.test.d.ts.map +1 -0
  124. package/build/browser/prompts/promptTemplate.test.js +48 -0
  125. package/build/browser/prompts/promptTemplate.test.js.map +1 -0
  126. package/build/browser/run.d.ts +16 -0
  127. package/build/browser/run.d.ts.map +1 -0
  128. package/build/browser/run.js +132 -0
  129. package/build/browser/run.js.map +1 -0
  130. package/build/browser/templates.d.ts +23 -0
  131. package/build/browser/templates.d.ts.map +1 -0
  132. package/build/browser/templates.js +56 -0
  133. package/build/browser/templates.js.map +1 -0
  134. package/build/esm/cli.js +95 -0
  135. package/build/esm/cli.js.map +1 -0
  136. package/build/esm/cli.test.js +59 -0
  137. package/build/esm/cli.test.js.map +1 -0
  138. package/build/esm/consola.js +28 -0
  139. package/build/esm/consola.js.map +1 -0
  140. package/build/esm/generate/generateEnv.js +50 -0
  141. package/build/esm/generate/generateEnv.js.map +1 -0
  142. package/build/esm/generate/generateEnv.test.js +70 -0
  143. package/build/esm/generate/generateEnv.test.js.map +1 -0
  144. package/build/esm/generate/generateFoundryConfigJson.js +33 -0
  145. package/build/esm/generate/generateFoundryConfigJson.js.map +1 -0
  146. package/build/esm/generate/generateFoundryConfigJson.test.js +38 -0
  147. package/build/esm/generate/generateFoundryConfigJson.test.js.map +1 -0
  148. package/build/esm/generate/generateNpmRc.js +27 -0
  149. package/build/esm/generate/generateNpmRc.js.map +1 -0
  150. package/build/esm/generate/generateNpmRc.test.js +28 -0
  151. package/build/esm/generate/generateNpmRc.test.js.map +1 -0
  152. package/build/esm/highlight.js +23 -0
  153. package/build/esm/highlight.js.map +1 -0
  154. package/build/esm/index.js +18 -540
  155. package/build/esm/index.js.map +1 -1
  156. package/build/esm/prompts/promptApplicationRid.js +31 -0
  157. package/build/esm/prompts/promptApplicationRid.js.map +1 -0
  158. package/build/esm/prompts/promptApplicationRid.test.js +48 -0
  159. package/build/esm/prompts/promptApplicationRid.test.js.map +1 -0
  160. package/build/esm/prompts/promptApplicationUrl.js +50 -0
  161. package/build/esm/prompts/promptApplicationUrl.js.map +1 -0
  162. package/build/esm/prompts/promptApplicationUrl.test.js +68 -0
  163. package/build/esm/prompts/promptApplicationUrl.test.js.map +1 -0
  164. package/build/esm/prompts/promptClientId.js +31 -0
  165. package/build/esm/prompts/promptClientId.js.map +1 -0
  166. package/build/esm/prompts/promptClientId.test.js +47 -0
  167. package/build/esm/prompts/promptClientId.test.js.map +1 -0
  168. package/build/esm/prompts/promptCorsProxy.js +29 -0
  169. package/build/esm/prompts/promptCorsProxy.js.map +1 -0
  170. package/build/esm/prompts/promptCorsProxy.test.js +44 -0
  171. package/build/esm/prompts/promptCorsProxy.test.js.map +1 -0
  172. package/build/esm/prompts/promptFoundryUrl.js +31 -0
  173. package/build/esm/prompts/promptFoundryUrl.js.map +1 -0
  174. package/build/esm/prompts/promptFoundryUrl.test.js +55 -0
  175. package/build/esm/prompts/promptFoundryUrl.test.js.map +1 -0
  176. package/build/esm/prompts/promptOsdkPackage.js +31 -0
  177. package/build/esm/prompts/promptOsdkPackage.js.map +1 -0
  178. package/build/esm/prompts/promptOsdkPackage.test.js +48 -0
  179. package/build/esm/prompts/promptOsdkPackage.test.js.map +1 -0
  180. package/build/esm/prompts/promptOsdkRegistryUrl.js +31 -0
  181. package/build/esm/prompts/promptOsdkRegistryUrl.js.map +1 -0
  182. package/build/esm/prompts/promptOsdkRegistryUrl.test.js +54 -0
  183. package/build/esm/prompts/promptOsdkRegistryUrl.test.js.map +1 -0
  184. package/build/esm/prompts/promptOverwrite.js +53 -0
  185. package/build/esm/prompts/promptOverwrite.js.map +1 -0
  186. package/build/esm/prompts/promptOverwrite.test.js +55 -0
  187. package/build/esm/prompts/promptOverwrite.test.js.map +1 -0
  188. package/build/esm/prompts/promptProject.js +32 -0
  189. package/build/esm/prompts/promptProject.js.map +1 -0
  190. package/build/esm/prompts/promptProject.test.js +47 -0
  191. package/build/esm/prompts/promptProject.test.js.map +1 -0
  192. package/build/esm/prompts/promptTemplate.js +45 -0
  193. package/build/esm/prompts/promptTemplate.js.map +1 -0
  194. package/build/esm/prompts/promptTemplate.test.js +48 -0
  195. package/build/esm/prompts/promptTemplate.test.js.map +1 -0
  196. package/build/esm/run.js +132 -0
  197. package/build/esm/run.js.map +1 -0
  198. package/build/esm/templates.js +56 -0
  199. package/build/esm/templates.js.map +1 -0
  200. package/package.json +8 -10
  201. package/build/browser/esm-D3BAJ7G6.js +0 -456
  202. package/build/browser/esm-D3BAJ7G6.js.map +0 -1
  203. package/build/browser/esm-OBQZ3MUJ.js +0 -383
  204. package/build/browser/esm-OBQZ3MUJ.js.map +0 -1
  205. package/build/browser/esm-QBJCFCPI.js +0 -375
  206. package/build/browser/esm-QBJCFCPI.js.map +0 -1
  207. package/build/browser/esm-QPUX3UHH.js +0 -908
  208. package/build/browser/esm-QPUX3UHH.js.map +0 -1
  209. package/build/browser/esm-W6PA7H72.js +0 -1176
  210. package/build/browser/esm-W6PA7H72.js.map +0 -1
  211. package/build/browser/esm-Y4LEDX6D.js +0 -253
  212. package/build/browser/esm-Y4LEDX6D.js.map +0 -1
  213. package/build/esm/esm-D3BAJ7G6.js +0 -456
  214. package/build/esm/esm-D3BAJ7G6.js.map +0 -1
  215. package/build/esm/esm-OBQZ3MUJ.js +0 -383
  216. package/build/esm/esm-OBQZ3MUJ.js.map +0 -1
  217. package/build/esm/esm-QBJCFCPI.js +0 -375
  218. package/build/esm/esm-QBJCFCPI.js.map +0 -1
  219. package/build/esm/esm-QPUX3UHH.js +0 -908
  220. package/build/esm/esm-QPUX3UHH.js.map +0 -1
  221. package/build/esm/esm-W6PA7H72.js +0 -1176
  222. package/build/esm/esm-W6PA7H72.js.map +0 -1
  223. package/build/esm/esm-Y4LEDX6D.js +0 -253
  224. package/build/esm/esm-Y4LEDX6D.js.map +0 -1
@@ -1,541 +1,19 @@
1
- import yargs from 'yargs';
2
- import { hideBin } from 'yargs/helpers';
3
- import { createConsola, consola as consola$1 } from 'consola';
4
- import { colorize } from 'consola/utils';
5
- import fs2 from 'fs';
6
- import path2 from 'path';
7
- import Handlebars from 'handlebars';
8
-
9
- // src/cli.ts
10
- var consola = createConsola({
11
- // https://github.com/unjs/consola/issues/251
12
- async prompt(...params) {
13
- const response = await consola$1.prompt(...params);
14
- if (typeof response === "symbol" && response.toString() === "Symbol(clack:cancel)") {
15
- consola$1.fail("Operation cancelled");
16
- process.exit(0);
17
- }
18
- return response;
19
- }
20
- });
21
- function green(text) {
22
- return colorize("green", text);
23
- }
24
- function italic(text) {
25
- return colorize("italic", text);
26
- }
27
-
28
- // src/prompts/promptApplicationRid.ts
29
- async function promptApplicationRid({
30
- application
31
- }) {
32
- while (application == null || !/^ri\.third-party-applications\.[^.]+\.application\.[^.]+$/.test(application)) {
33
- if (application != null) {
34
- consola.fail("Please enter a valid application resource identifier (rid)");
35
- }
36
- application = await consola.prompt(`Enter the application resource identifier (rid) for your application from Developer Console:
37
- ${italic("(Example: ri.third-party-applications.main.application.1c66b352-4e00-40d2-995d-061c9d533ace)")}`, {
38
- type: "text"
39
- });
40
- }
41
- return application;
42
- }
43
-
44
- // src/prompts/promptApplicationUrl.ts
45
- async function promptApplicationUrl({
46
- skipApplicationUrl,
47
- applicationUrl
48
- }) {
49
- if (skipApplicationUrl) {
50
- return void 0;
51
- }
52
- if (applicationUrl == null) {
53
- const skip = await consola.prompt(
54
- `Do you know the URL your production application will be hosted on? This is required to create a production build of your application with the correct OAuth redirect URL.`,
55
- {
56
- type: "select",
57
- options: [{
58
- label: "Yes, let me fill it here",
59
- value: "yes"
60
- }, {
61
- label: "No, I will fill it in later following the instructions in the generated README",
62
- value: "no"
63
- }]
64
- }
65
- // Types for "select" are wrong the value is returned rather than the option object
66
- // https://github.com/unjs/consola/pull/238
67
- );
68
- if (skip === "no") {
69
- return void 0;
70
- }
71
- }
72
- while (applicationUrl == null || !/^https?:\/\//.test(applicationUrl)) {
73
- if (applicationUrl != null) {
74
- consola.fail("Please enter a valid application URL");
75
- }
76
- applicationUrl = await consola.prompt(`Enter the URL your production application will be hosted on:
77
- ${italic("(Example: https://myapp.example.palantirfoundry.com)")}`, {
78
- type: "text"
79
- });
80
- }
81
- return applicationUrl.replace(/\/$/, "");
82
- }
83
-
84
- // src/prompts/promptClientId.ts
85
- async function promptClientId({
86
- clientId
87
- }) {
88
- while (clientId == null || !/^[0-9a-f]+$/.test(clientId)) {
89
- if (clientId != null) {
90
- consola.fail("Please enter a valid OAuth client ID");
91
- }
92
- clientId = await consola.prompt(`Enter the OAuth client ID for your application from Developer Console:
93
- ${italic("(Example: 2650385ab6c5e0df3b44aff776b00a42)")}`, {
94
- type: "text"
95
- });
96
- }
97
- return clientId;
98
- }
99
-
100
- // src/prompts/promptCorsProxy.ts
101
- async function promptCorsProxy({
102
- corsProxy
103
- }) {
104
- if (corsProxy != null) {
105
- return corsProxy;
106
- }
107
- return consola.prompt(`Include a CORS proxy for Foundry API requests during local development?
108
- ${italic("This is required if your enrollment has not allowed localhost for CORS.")}`, {
109
- type: "confirm",
110
- initial: false
111
- });
112
- }
113
-
114
- // src/prompts/promptFoundryUrl.ts
115
- async function promptFoundryUrl({
116
- foundryUrl
117
- }) {
118
- while (foundryUrl == null || !foundryUrl.startsWith("https://")) {
119
- if (foundryUrl != null) {
120
- consola.fail("Please enter a valid Foundry URL");
121
- }
122
- foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:
123
- ${italic("(Example: https://example.palantirfoundry.com)")}`, {
124
- type: "text"
125
- });
126
- }
127
- return foundryUrl.replace(/\/$/, "");
128
- }
129
-
130
- // src/prompts/promptOsdkPackage.ts
131
- async function promptOsdkPackage({
132
- osdkPackage
133
- }) {
134
- while (osdkPackage == null || !/^@[a-z0-9-]+\/sdk$/.test(osdkPackage)) {
135
- if (osdkPackage != null) {
136
- consola.fail("Please enter a valid OSDK package name");
137
- }
138
- osdkPackage = await consola.prompt(`Enter the OSDK package name for your application from Developer Console:
139
- ${italic("(Example: @my-app/sdk)")}`, {
140
- type: "text"
141
- });
142
- }
143
- return osdkPackage;
144
- }
145
-
146
- // src/prompts/promptOsdkRegistryUrl.ts
147
- async function promptOsdkRegistryUrl({
148
- osdkRegistryUrl
149
- }) {
150
- while (osdkRegistryUrl == null || !/^https:\/\/[^/]+\/artifacts\/api\/repositories\/ri\.artifacts\.[^/]+\/contents\/release\/npm\/?$/.test(osdkRegistryUrl)) {
151
- if (osdkRegistryUrl != null) {
152
- consola.fail("Please enter a valid NPM registry URL to install your OSDK package");
153
- }
154
- osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package from Developer Console:
155
- ${italic("(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)")}`, {
156
- type: "text"
157
- });
158
- }
159
- return osdkRegistryUrl.replace(/\/$/, "");
160
- }
161
- async function promptOverwrite({
162
- project,
163
- overwrite
164
- }) {
165
- if (overwrite != null) {
166
- return overwrite;
167
- }
168
- if (!fs2.existsSync(path2.join(process.cwd(), project))) {
169
- return true;
170
- }
171
- const result = await consola.prompt(
172
- `The directory ${green(project)} already exists do you want to overwrite or ignore it?`,
173
- {
174
- type: "select",
175
- options: [{
176
- label: "Remove existing files and continue",
177
- value: "overwrite"
178
- }, {
179
- label: "Ignore files and continue",
180
- value: "ignore"
181
- }, {
182
- label: "Cancel",
183
- value: "cancel"
184
- }]
185
- }
186
- // Types for "select" are wrong the value is returned rather than the option object
187
- // https://github.com/unjs/consola/pull/238
188
- );
189
- switch (result) {
190
- case "overwrite":
191
- return true;
192
- case "ignore":
193
- return false;
194
- case "cancel":
195
- consola.fail("Operation cancelled");
196
- process.exit(0);
197
- }
198
- }
199
-
200
- // src/prompts/promptProject.ts
201
- async function promptProject({
202
- project
203
- }) {
204
- while (project == null || !/^[a-zA-Z0-9-_]+$/.test(project)) {
205
- if (project != null) {
206
- consola.fail("Project name can only contain alphanumeric characters, hyphens and underscores");
207
- }
208
- project = await consola.prompt("Project name:", {
209
- type: "text",
210
- placeholder: "my-osdk-app",
211
- default: "my-osdk-app"
212
- });
213
- }
214
- return project;
215
- }
216
-
217
- // src/templates.ts
218
- var TEMPLATES = [{
219
- id: "template-react",
220
- label: "React",
221
- envPrefix: "VITE_",
222
- buildDirectory: "./dist",
223
- getFiles: async () => (await import('./esm-D3BAJ7G6.js')).files
224
- }, {
225
- id: "template-react-beta",
226
- label: "React",
227
- envPrefix: "VITE_",
228
- buildDirectory: "./dist",
229
- isBeta: true,
230
- getFiles: async () => (await import('./esm-QBJCFCPI.js')).files
231
- }, {
232
- id: "template-vue",
233
- label: "Vue",
234
- envPrefix: "VITE_",
235
- buildDirectory: "./dist",
236
- getFiles: async () => (await import('./esm-Y4LEDX6D.js')).files
237
- }, {
238
- id: "template-next-static-export",
239
- label: "Next (static export)",
240
- envPrefix: "NEXT_PUBLIC_",
241
- buildDirectory: "./out",
242
- getFiles: async () => (await import('./esm-OBQZ3MUJ.js')).files
243
- }, {
244
- id: "template-tutorial-todo-app",
245
- label: "Tutorial: To do App",
246
- envPrefix: "VITE_",
247
- buildDirectory: "./dist",
248
- hidden: true,
249
- getFiles: async () => (await import('./esm-QPUX3UHH.js')).files
250
- }, {
251
- id: "template-tutorial-todo-aip-app",
252
- label: "Tutorial: To do AIP App",
253
- envPrefix: "VITE_",
254
- buildDirectory: "./dist",
255
- hidden: true,
256
- getFiles: async () => (await import('./esm-W6PA7H72.js')).files
257
- }];
258
-
259
- // src/prompts/promptTemplate.ts
260
- async function promptTemplate(parsed) {
261
- let useBeta = parsed.beta ?? false;
262
- let template = TEMPLATES.find((t) => t.id === parsed.template || t.id === `template-${parsed.template}`);
263
- if (template == null) {
264
- const availableTemplates = TEMPLATES.filter((template2) => !template2.hidden && (useBeta ? template2.isBeta === true : !template2.isBeta));
265
- if (availableTemplates.length === 0) {
266
- throw new Error("No available templates found for the selected options.");
267
- }
268
- const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : "Select a framework:", {
269
- type: "select",
270
- options: availableTemplates.map((template2) => ({
271
- value: template2.id,
272
- label: template2.label
273
- }))
274
- // Types for "select" are wrong the value is returned rather than the option object
275
- // https://github.com/unjs/consola/pull/238
276
- });
277
- template = TEMPLATES.find((t) => t.id === templateId);
278
- if (template == null) {
279
- throw new Error(`Template ${templateId} should be found`);
280
- }
281
- }
282
- return template;
283
- }
284
-
285
- // src/generate/generateEnv.ts
286
- function generateEnvDevelopment({
287
- envPrefix,
288
- foundryUrl,
289
- clientId,
290
- corsProxy
291
- }) {
292
- return generateEnv({
293
- envPrefix,
294
- foundryUrl: corsProxy ? "http://localhost:8080" : foundryUrl,
295
- applicationUrl: "http://localhost:8080",
296
- clientId
297
- });
298
- }
299
- function generateEnvProduction({
300
- envPrefix,
301
- foundryUrl,
302
- applicationUrl,
303
- clientId
304
- }) {
305
- return generateEnv({
306
- envPrefix,
307
- foundryUrl,
308
- applicationUrl,
309
- clientId
310
- });
311
- }
312
- function generateEnv({
313
- envPrefix,
314
- foundryUrl,
315
- applicationUrl,
316
- clientId
317
- }) {
318
- return `${envPrefix}FOUNDRY_API_URL=${foundryUrl}
319
- ${applicationUrl == null ? "# " : ""}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl ?? "<Fill in the domain at which you deploy your application>"}/auth/callback
320
- ${envPrefix}FOUNDRY_CLIENT_ID=${clientId}
321
- `;
322
- }
323
-
324
- // src/generate/generateFoundryConfigJson.ts
325
- function generateFoundryConfigJson({
326
- foundryUrl,
327
- application,
328
- directory
329
- }) {
330
- return JSON.stringify({
331
- foundryUrl,
332
- site: {
333
- application,
334
- directory,
335
- autoVersion: {
336
- type: "git-describe",
337
- tagPrefix: ""
338
- }
339
- }
340
- }, null, 2) + "\n";
341
- }
342
-
343
- // src/generate/generateNpmRc.ts
344
- function generateNpmRc({
345
- osdkPackage,
346
- osdkRegistryUrl
347
- }) {
348
- const withTrailingSlash = osdkRegistryUrl.endsWith("/") ? osdkRegistryUrl : osdkRegistryUrl + "/";
349
- const withoutProtocol = withTrailingSlash.replace(/^https:\/\//, "");
350
- const packageScope = osdkPackage.split("/")[0];
351
- return `//${withoutProtocol}:_authToken=\${FOUNDRY_TOKEN}
352
- ${packageScope}:registry=${withTrailingSlash}
353
- `;
354
- }
355
-
356
- // src/run.ts
357
- async function run({
358
- project,
359
- overwrite,
360
- template,
361
- foundryUrl,
362
- applicationUrl,
363
- application,
364
- clientId,
365
- osdkPackage,
366
- osdkRegistryUrl,
367
- corsProxy
368
- }) {
369
- consola.log("");
370
- consola.start(`Creating project ${green(project)} using template ${green(template.id)}`);
371
- const cwd = process.cwd();
372
- const root = path2.join(cwd, project);
373
- if (fs2.existsSync(root)) {
374
- if (overwrite) {
375
- consola.info(`Overwriting existing project directory`);
376
- fs2.rmSync(root, {
377
- recursive: true,
378
- force: true
379
- });
380
- fs2.mkdirSync(root, {
381
- recursive: true
382
- });
383
- } else {
384
- consola.info(`Reusing existing project directory`);
385
- }
386
- } else {
387
- consola.info(`Creating project directory`);
388
- fs2.mkdirSync(root, {
389
- recursive: true
390
- });
391
- }
392
- consola.info(`Copying files into project directory`);
393
- const files = await template.getFiles();
394
- for (const [filePath, contents] of files) {
395
- const finalPath = path2.join(root, filePath);
396
- const dirPath = path2.dirname(finalPath);
397
- await fs2.promises.mkdir(dirPath, {
398
- recursive: true
399
- });
400
- await fs2.promises.writeFile(finalPath, Buffer.from(contents.body, contents.type === "raw" ? "utf-8" : "base64"));
401
- }
402
- const templateContext = {
403
- project,
404
- foundryUrl,
405
- osdkPackage,
406
- corsProxy
407
- };
408
- const processFiles = function(dir) {
409
- fs2.readdirSync(dir).forEach(function(file) {
410
- file = dir + "/" + file;
411
- const stat = fs2.statSync(file);
412
- if (stat.isDirectory()) {
413
- processFiles(file);
414
- return;
415
- }
416
- if (file.endsWith("/_gitignore")) {
417
- fs2.renameSync(file, file.replace(/\/_gitignore$/, "/.gitignore"));
418
- return;
419
- }
420
- if (!file.endsWith(".hbs")) {
421
- return;
422
- }
423
- const templated = Handlebars.compile(fs2.readFileSync(file, "utf-8"))(templateContext);
424
- fs2.writeFileSync(file.replace(/.hbs$/, ""), templated);
425
- fs2.rmSync(file);
426
- });
427
- };
428
- processFiles(root);
429
- const npmRc = generateNpmRc({
430
- osdkPackage,
431
- osdkRegistryUrl
432
- });
433
- fs2.writeFileSync(path2.join(root, ".npmrc"), npmRc);
434
- const envDevelopment = generateEnvDevelopment({
435
- envPrefix: template.envPrefix,
436
- foundryUrl,
437
- clientId,
438
- corsProxy
439
- });
440
- fs2.writeFileSync(path2.join(root, ".env.development"), envDevelopment);
441
- const envProduction = generateEnvProduction({
442
- envPrefix: template.envPrefix,
443
- foundryUrl,
444
- applicationUrl,
445
- clientId
446
- });
447
- fs2.writeFileSync(path2.join(root, ".env.production"), envProduction);
448
- const foundryConfigJson = generateFoundryConfigJson({
449
- foundryUrl,
450
- application,
451
- directory: template.buildDirectory
452
- });
453
- fs2.writeFileSync(path2.join(root, "foundry.config.json"), foundryConfigJson);
454
- consola.success("Success");
455
- const cdRelative = path2.relative(cwd, root);
456
- consola.box({
457
- message: `Done! Run the following commands to get started:
458
-
459
- \`cd ${cdRelative}\`
460
- \`export FOUNDRY_TOKEN=<token>\`
461
- \`npm install\`
462
- \`npm run dev\``,
463
- style: {
464
- padding: 2,
465
- borderColor: "green",
466
- borderStyle: "rounded"
467
- }
468
- });
469
- }
470
-
471
- // src/cli.ts
472
- async function cli(args = process.argv) {
473
- const base = yargs(hideBin(args)).version("0.19.0-beta.5").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.", (yargs2) => yargs2.positional("project", {
474
- type: "string",
475
- describe: "Project name to create"
476
- }).option("overwrite", {
477
- type: "boolean",
478
- describe: "Overwrite project directory if already exists"
479
- }).option("beta", {
480
- type: "boolean",
481
- describe: "Use templates compatible with the Beta version of the SDK"
482
- }).option("template", {
483
- type: "string",
484
- describe: "Template name to use"
485
- }).option("foundryUrl", {
486
- type: "string",
487
- describe: "URL for the Foundry stack"
488
- }).option("applicationUrl", {
489
- type: "string",
490
- describe: "URL the production application will be hosted on",
491
- conflicts: "skipApplicationUrl"
492
- }).option("skipApplicationUrl", {
493
- type: "boolean",
494
- describe: "Skip filling in URL the production application will be hosted on"
495
- }).option("application", {
496
- type: "string",
497
- describe: "Application resource identifier (rid)"
498
- }).option("clientId", {
499
- type: "string",
500
- describe: "OAuth client ID for application"
501
- }).option("osdkPackage", {
502
- type: "string",
503
- describe: "OSDK package name for application"
504
- }).option("osdkRegistryUrl", {
505
- type: "string",
506
- describe: "URL for NPM registry to install OSDK package"
507
- }).option("corsProxy", {
508
- type: "boolean",
509
- describe: "Include a CORS proxy for Foundry API requests during local development"
510
- }));
511
- const parsed = base.parseSync();
512
- const project = await promptProject(parsed);
513
- const overwrite = await promptOverwrite({
514
- ...parsed,
515
- project
516
- });
517
- const template = await promptTemplate(parsed);
518
- const foundryUrl = await promptFoundryUrl(parsed);
519
- const applicationUrl = await promptApplicationUrl(parsed);
520
- const application = await promptApplicationRid(parsed);
521
- const clientId = await promptClientId(parsed);
522
- const osdkPackage = await promptOsdkPackage(parsed);
523
- const osdkRegistryUrl = await promptOsdkRegistryUrl(parsed);
524
- const corsProxy = await promptCorsProxy(parsed);
525
- await run({
526
- project,
527
- overwrite,
528
- template,
529
- foundryUrl,
530
- applicationUrl,
531
- application,
532
- clientId,
533
- osdkPackage,
534
- osdkRegistryUrl,
535
- corsProxy
536
- });
537
- }
538
-
539
- export { TEMPLATES, cli, run };
540
- //# sourceMappingURL=index.js.map
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 { cli } from "./cli.js";
17
+ export { run } from "./run.js";
18
+ export { TEMPLATES } from "./templates.js";
541
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/consola.ts","../../src/highlight.ts","../../src/prompts/promptApplicationRid.ts","../../src/prompts/promptApplicationUrl.ts","../../src/prompts/promptClientId.ts","../../src/prompts/promptCorsProxy.ts","../../src/prompts/promptFoundryUrl.ts","../../src/prompts/promptOsdkPackage.ts","../../src/prompts/promptOsdkRegistryUrl.ts","../../src/prompts/promptOverwrite.ts","../../src/prompts/promptProject.ts","../../src/templates.ts","../../src/prompts/promptTemplate.ts","../../src/generate/generateEnv.ts","../../src/generate/generateFoundryConfigJson.ts","../../src/generate/generateNpmRc.ts","../../src/run.ts","../../src/cli.ts"],"names":["defaultConsola","fs","path","template","yargs"],"mappings":";;;;;;;;;AAiBO,IAAM,UAAU,aAAc,CAAA;AAAA;AAAA,EAEnC,MAAM,UAAU,MAAQ,EAAA;AACtB,IAAA,MAAM,QAAW,GAAA,MAAMA,SAAe,CAAA,MAAA,CAAO,GAAG,MAAM,CAAA,CAAA;AACtD,IAAA,IAAI,OAAO,QAAa,KAAA,QAAA,IAAY,QAAS,CAAA,QAAA,OAAe,sBAAwB,EAAA;AAClF,MAAAA,SAAA,CAAe,KAAK,qBAAqB,CAAA,CAAA;AACzC,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,KAChB;AACA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AACF,CAAC,CAAA,CAAA;ACVM,SAAS,MAAM,IAAM,EAAA;AAC1B,EAAO,OAAA,QAAA,CAAS,SAAS,IAAI,CAAA,CAAA;AAC/B,CAAA;AACO,SAAS,OAAO,IAAM,EAAA;AAC3B,EAAO,OAAA,QAAA,CAAS,UAAU,IAAI,CAAA,CAAA;AAChC,CAAA;;;ACJA,eAAsB,oBAAqB,CAAA;AAAA,EACzC,WAAA;AACF,CAAG,EAAA;AACD,EAAA,OAAO,eAAe,IAAQ,IAAA,CAAC,2DAA4D,CAAA,IAAA,CAAK,WAAW,CAAG,EAAA;AAC5G,IAAA,IAAI,eAAe,IAAM,EAAA;AACvB,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AAA,QAAA,GAAW,MAAM,cAAA,CAAe,MAAM,CAAA,CAAA;AAC5C,EAAM,MAAA,UAAA,GAAa,MAAM,gBAAA,CAAiB,MAAM,CAAA,CAAA;AAChD,EAAM,MAAA,cAAA,GAAiB,MAAM,oBAAA,CAAqB,MAAM,CAAA,CAAA;AACxD,EAAM,MAAA,WAAA,GAAc,MAAM,oBAAA,CAAqB,MAAM,CAAA,CAAA;AACrD,EAAM,MAAA,QAAA,GAAW,MAAM,cAAA,CAAe,MAAM,CAAA,CAAA;AAC5C,EAAM,MAAA,WAAA,GAAc,MAAM,iBAAA,CAAkB,MAAM,CAAA,CAAA;AAClD,EAAM,MAAA,eAAA,GAAkB,MAAM,qBAAA,CAAsB,MAAM,CAAA,CAAA;AAC1D,EAAM,MAAA,SAAA,GAAY,MAAM,eAAA,CAAgB,MAAM,CAAA,CAAA;AAC9C,EAAA,MAAM,GAAI,CAAA;AAAA,IACR,OAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,GACD,CAAA,CAAA;AACH","file":"index.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 */\n\nimport { consola as defaultConsola, createConsola } from \"consola\";\nexport const consola = createConsola({\n // https://github.com/unjs/consola/issues/251\n async prompt(...params) {\n const response = await defaultConsola.prompt(...params);\n if (typeof response === \"symbol\" && response.toString() === \"Symbol(clack:cancel)\") {\n defaultConsola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n return response;\n }\n});","/*\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 */\n\nimport { colorize } from \"consola/utils\";\nexport function green(text) {\n return colorize(\"green\", text);\n}\nexport function italic(text) {\n return colorize(\"italic\", text);\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptApplicationRid({\n application\n}) {\n while (application == null || !/^ri\\.third-party-applications\\.[^.]+\\.application\\.[^.]+$/.test(application)) {\n if (application != null) {\n consola.fail(\"Please enter a valid application resource identifier (rid)\");\n }\n application = await consola.prompt(`Enter the application resource identifier (rid) for your application from Developer Console:\\n${italic(\"(Example: ri.third-party-applications.main.application.1c66b352-4e00-40d2-995d-061c9d533ace)\")}`, {\n type: \"text\"\n });\n }\n return application;\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptApplicationUrl({\n skipApplicationUrl,\n applicationUrl\n}) {\n if (skipApplicationUrl) {\n return undefined;\n }\n if (applicationUrl == null) {\n const skip = await consola.prompt(`Do you know the URL your production application will be hosted on? This is required to create a production build of your application with the correct OAuth redirect URL.`, {\n type: \"select\",\n options: [{\n label: \"Yes, let me fill it here\",\n value: \"yes\"\n }, {\n label: \"No, I will fill it in later following the instructions in the generated README\",\n value: \"no\"\n }]\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 if (skip === \"no\") {\n return undefined;\n }\n }\n while (applicationUrl == null || !/^https?:\\/\\//.test(applicationUrl)) {\n if (applicationUrl != null) {\n consola.fail(\"Please enter a valid application URL\");\n }\n applicationUrl = await consola.prompt(`Enter the URL your production application will be hosted on:\\n${italic(\"(Example: https://myapp.example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return applicationUrl.replace(/\\/$/, \"\");\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptClientId({\n clientId\n}) {\n while (clientId == null || !/^[0-9a-f]+$/.test(clientId)) {\n if (clientId != null) {\n consola.fail(\"Please enter a valid OAuth client ID\");\n }\n clientId = await consola.prompt(`Enter the OAuth client ID for your application from Developer Console:\\n${italic(\"(Example: 2650385ab6c5e0df3b44aff776b00a42)\")}`, {\n type: \"text\"\n });\n }\n return clientId;\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptCorsProxy({\n corsProxy\n}) {\n if (corsProxy != null) {\n return corsProxy;\n }\n return consola.prompt(`Include a CORS proxy for Foundry API requests during local development?\\n${italic(\"This is required if your enrollment has not allowed localhost for CORS.\")}`, {\n type: \"confirm\",\n initial: false\n });\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptFoundryUrl({\n foundryUrl\n}) {\n while (foundryUrl == null || !foundryUrl.startsWith(\"https://\")) {\n if (foundryUrl != null) {\n consola.fail(\"Please enter a valid Foundry URL\");\n }\n foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:\\n${italic(\"(Example: https://example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return foundryUrl.replace(/\\/$/, \"\");\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkPackage({\n osdkPackage\n}) {\n while (osdkPackage == null || !/^@[a-z0-9-]+\\/sdk$/.test(osdkPackage)) {\n if (osdkPackage != null) {\n consola.fail(\"Please enter a valid OSDK package name\");\n }\n osdkPackage = await consola.prompt(`Enter the OSDK package name for your application from Developer Console:\\n${italic(\"(Example: @my-app/sdk)\")}`, {\n type: \"text\"\n });\n }\n return osdkPackage;\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkRegistryUrl({\n osdkRegistryUrl\n}) {\n while (osdkRegistryUrl == null || !/^https:\\/\\/[^/]+\\/artifacts\\/api\\/repositories\\/ri\\.artifacts\\.[^/]+\\/contents\\/release\\/npm\\/?$/.test(osdkRegistryUrl)) {\n if (osdkRegistryUrl != null) {\n consola.fail(\"Please enter a valid NPM registry URL to install your OSDK package\");\n }\n osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package from Developer Console:\\n${italic(\"(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)\")}`, {\n type: \"text\"\n });\n }\n return osdkRegistryUrl.replace(/\\/$/, \"\");\n}","/*\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 */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { consola } from \"../consola.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptOverwrite({\n project,\n overwrite\n}) {\n if (overwrite != null) {\n return overwrite;\n }\n if (!fs.existsSync(path.join(process.cwd(), project))) {\n return true;\n }\n const result = await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {\n type: \"select\",\n options: [{\n label: \"Remove existing files and continue\",\n value: \"overwrite\"\n }, {\n label: \"Ignore files and continue\",\n value: \"ignore\"\n }, {\n label: \"Cancel\",\n value: \"cancel\"\n }]\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 switch (result) {\n case \"overwrite\":\n return true;\n case \"ignore\":\n return false;\n case \"cancel\":\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}","/*\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 */\n\nimport { consola } from \"../consola.js\";\nexport async function promptProject({\n project\n}) {\n while (project == null || !/^[a-zA-Z0-9-_]+$/.test(project)) {\n if (project != null) {\n consola.fail(\"Project name can only contain alphanumeric characters, hyphens and underscores\");\n }\n project = await consola.prompt(\"Project name:\", {\n type: \"text\",\n placeholder: \"my-osdk-app\",\n default: \"my-osdk-app\"\n });\n }\n return project;\n}","/*\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 */\n\nexport const TEMPLATES = [{\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 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 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 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 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 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 * 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 */\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 && (useBeta ? 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 ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : \"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 * 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 */\n\nexport function generateEnvDevelopment({\n envPrefix,\n foundryUrl,\n clientId,\n corsProxy\n}) {\n return generateEnv({\n envPrefix,\n foundryUrl: corsProxy ? \"http://localhost:8080\" : foundryUrl,\n applicationUrl: \"http://localhost:8080\",\n clientId\n });\n}\nexport function generateEnvProduction({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId\n}) {\n return generateEnv({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId\n });\n}\nfunction generateEnv({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId\n}) {\n return `${envPrefix}FOUNDRY_API_URL=${foundryUrl}\\n` + `${applicationUrl == null ? \"# \" : \"\"}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl ?? \"<Fill in the domain at which you deploy your application>\"}/auth/callback\\n` + `${envPrefix}FOUNDRY_CLIENT_ID=${clientId}\\n`;\n}","/*\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 */\n\nexport function generateFoundryConfigJson({\n foundryUrl,\n application,\n directory\n}) {\n return JSON.stringify({\n foundryUrl,\n site: {\n application,\n directory,\n autoVersion: {\n type: \"git-describe\",\n tagPrefix: \"\"\n }\n }\n }, null, 2) + \"\\n\";\n}","/*\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 */\n\nexport function generateNpmRc({\n osdkPackage,\n osdkRegistryUrl\n}) {\n // pnpm requires a trailing slash in .npmrc\n // https://github.com/pnpm/pnpm/issues/5941\n const withTrailingSlash = osdkRegistryUrl.endsWith(\"/\") ? osdkRegistryUrl : osdkRegistryUrl + \"/\";\n const withoutProtocol = withTrailingSlash.replace(/^https:\\/\\//, \"\");\n const packageScope = osdkPackage.split(\"/\")[0];\n return `//${withoutProtocol}:_authToken=\\${FOUNDRY_TOKEN}\\n` + `${packageScope}:registry=${withTrailingSlash}\\n`;\n}","/*\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 */\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({\n project,\n overwrite,\n template,\n foundryUrl,\n applicationUrl,\n application,\n clientId,\n osdkPackage,\n osdkRegistryUrl,\n corsProxy\n}) {\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, {\n recursive: true,\n force: true\n });\n fs.mkdirSync(root, {\n recursive: true\n });\n } else {\n consola.info(`Reusing existing project directory`);\n }\n } else {\n consola.info(`Creating project directory`);\n fs.mkdirSync(root, {\n recursive: true\n });\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, {\n recursive: true\n });\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({\n osdkPackage,\n osdkRegistryUrl\n });\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` + ` \\`cd ${cdRelative}\\`\\n` + ` \\`export FOUNDRY_TOKEN=<token>\\`\\n` + ` \\`npm install\\`\\n` + ` \\`npm run dev\\``,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\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 */\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)).version(process.env.PACKAGE_VERSION ?? \"\").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\", {\n type: \"string\",\n describe: \"Project name to create\"\n }).option(\"overwrite\", {\n type: \"boolean\",\n describe: \"Overwrite project directory if already exists\"\n }).option(\"beta\", {\n type: \"boolean\",\n describe: \"Use templates compatible with the Beta version of the SDK\"\n }).option(\"template\", {\n type: \"string\",\n describe: \"Template name to use\"\n }).option(\"foundryUrl\", {\n type: \"string\",\n describe: \"URL for the Foundry stack\"\n }).option(\"applicationUrl\", {\n type: \"string\",\n describe: \"URL the production application will be hosted on\",\n conflicts: \"skipApplicationUrl\"\n }).option(\"skipApplicationUrl\", {\n type: \"boolean\",\n describe: \"Skip filling in URL the production application will be hosted on\"\n }).option(\"application\", {\n type: \"string\",\n describe: \"Application resource identifier (rid)\"\n }).option(\"clientId\", {\n type: \"string\",\n describe: \"OAuth client ID for application\"\n }).option(\"osdkPackage\", {\n type: \"string\",\n describe: \"OSDK package name for application\"\n }).option(\"osdkRegistryUrl\", {\n type: \"string\",\n describe: \"URL for NPM registry to install OSDK package\"\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({\n ...parsed,\n project\n });\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}"]}
1
+ {"version":3,"file":"index.js","names":["cli","run","TEMPLATES"],"sources":["index.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 { cli } from \"./cli.js\";\nexport { run } from \"./run.js\";\nexport { TEMPLATES } from \"./templates.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,UAAU;AAC9B,SAASC,GAAG,QAAQ,UAAU;AAC9B,SAASC,SAAS,QAAQ,gBAAgB","ignoreList":[]}