@osdk/create-app 2.2.0-beta.2 → 2.2.0-beta.21
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.
- package/CHANGELOG.md +64 -0
- package/README.md +6 -5
- package/build/esm/{esm-HA4JIHHL.js → esm-JF6OCVHP.js} +30 -22
- package/build/esm/esm-JF6OCVHP.js.map +1 -0
- package/build/esm/{esm-EXZTN5HA.js → esm-KD5U2KOZ.js} +34 -34
- package/build/esm/esm-KD5U2KOZ.js.map +1 -0
- package/build/esm/{esm-ZXMFAUNZ.js → esm-KU5YPQC2.js} +33 -25
- package/build/esm/esm-KU5YPQC2.js.map +1 -0
- package/build/esm/{esm-XWXVWZDN.js → esm-N7ZNHY2Z.js} +33 -25
- package/build/esm/esm-N7ZNHY2Z.js.map +1 -0
- package/build/esm/{esm-FZSV3C5D.js → esm-O6YHTVZC.js} +56 -62
- package/build/esm/esm-O6YHTVZC.js.map +1 -0
- package/build/esm/{esm-ZDKAQEHX.js → esm-S4C4CWK7.js} +43 -41
- package/build/esm/esm-S4C4CWK7.js.map +1 -0
- package/build/esm/{esm-YVNV3MQG.js → esm-SCLZKD46.js} +33 -25
- package/build/esm/esm-SCLZKD46.js.map +1 -0
- package/build/esm/{esm-BFQ5RNHV.js → esm-Z3DTLPV3.js} +16 -16
- package/build/esm/{esm-BFQ5RNHV.js.map → esm-Z3DTLPV3.js.map} +1 -1
- package/build/esm/{esm-WPYEYT7F.js → esm-ZJEGQFW7.js} +43 -41
- package/build/esm/esm-ZJEGQFW7.js.map +1 -0
- package/build/esm/index.js +177 -120
- package/build/esm/index.js.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/consola.d.ts.map +1 -1
- package/build/types/generate/generateEnv.d.ts +4 -2
- package/build/types/generate/generateEnv.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/prompts/promptOntologyRid.d.ts +3 -0
- package/build/types/prompts/promptOntologyRid.d.ts.map +1 -0
- package/build/types/prompts/promptOntologyRid.test.d.ts +1 -0
- package/build/types/prompts/promptOntologyRid.test.d.ts.map +1 -0
- package/build/types/prompts/promptScopes.test.d.ts +1 -0
- package/build/types/prompts/promptScopes.test.d.ts.map +1 -0
- package/build/types/prompts/promptTemplate.d.ts +2 -0
- package/build/types/prompts/promptTemplate.d.ts.map +1 -1
- package/build/types/run.d.ts +2 -1
- package/build/types/run.d.ts.map +1 -1
- package/package.json +13 -15
- package/build/esm/esm-4SFFV2ZK.js +0 -421
- package/build/esm/esm-4SFFV2ZK.js.map +0 -1
- package/build/esm/esm-EXZTN5HA.js.map +0 -1
- package/build/esm/esm-FZSV3C5D.js.map +0 -1
- package/build/esm/esm-HA4JIHHL.js.map +0 -1
- package/build/esm/esm-NFVUE2AE.js +0 -394
- package/build/esm/esm-NFVUE2AE.js.map +0 -1
- package/build/esm/esm-WPYEYT7F.js.map +0 -1
- package/build/esm/esm-XWXVWZDN.js.map +0 -1
- package/build/esm/esm-YVNV3MQG.js.map +0 -1
- package/build/esm/esm-ZDKAQEHX.js.map +0 -1
- package/build/esm/esm-ZXMFAUNZ.js.map +0 -1
package/build/esm/index.js
CHANGED
|
@@ -2,18 +2,21 @@ import yargs from 'yargs';
|
|
|
2
2
|
import { hideBin } from 'yargs/helpers';
|
|
3
3
|
import { createConsola, consola as consola$1 } from 'consola';
|
|
4
4
|
import { colorize } from 'consola/utils';
|
|
5
|
-
import fs2 from 'fs';
|
|
6
|
-
import path2 from 'path';
|
|
5
|
+
import fs2 from 'node:fs';
|
|
6
|
+
import path2 from 'node:path';
|
|
7
7
|
import { findUpSync } from 'find-up';
|
|
8
8
|
import Handlebars from 'handlebars';
|
|
9
|
-
import { fileURLToPath } from 'url';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
10
|
|
|
11
11
|
// src/cli.ts
|
|
12
|
+
var cancelSymbol = Symbol.for("cancel");
|
|
12
13
|
var consola = createConsola({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
async prompt(message, opts) {
|
|
15
|
+
const response = await consola$1.prompt(message, {
|
|
16
|
+
...opts,
|
|
17
|
+
cancel: opts?.cancel ?? "symbol"
|
|
18
|
+
});
|
|
19
|
+
if (response === cancelSymbol) {
|
|
17
20
|
consola$1.fail("Operation cancelled");
|
|
18
21
|
process.exit(0);
|
|
19
22
|
}
|
|
@@ -49,26 +52,21 @@ async function promptApplicationUrl({
|
|
|
49
52
|
applicationUrl
|
|
50
53
|
}) {
|
|
51
54
|
if (skipApplicationUrl) {
|
|
52
|
-
return
|
|
55
|
+
return void 0;
|
|
53
56
|
}
|
|
54
57
|
if (applicationUrl == null) {
|
|
55
|
-
const skip = await consola.prompt(
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}]
|
|
66
|
-
}
|
|
67
|
-
// Types for "select" are wrong the value is returned rather than the option object
|
|
68
|
-
// https://github.com/unjs/consola/pull/238
|
|
69
|
-
);
|
|
58
|
+
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.`, {
|
|
59
|
+
type: "select",
|
|
60
|
+
options: [{
|
|
61
|
+
label: "Yes, let me fill it here",
|
|
62
|
+
value: "yes"
|
|
63
|
+
}, {
|
|
64
|
+
label: "No, I will fill it in later following the instructions in the generated README",
|
|
65
|
+
value: "no"
|
|
66
|
+
}]
|
|
67
|
+
});
|
|
70
68
|
if (skip === "no") {
|
|
71
|
-
return
|
|
69
|
+
return void 0;
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
while (applicationUrl == null || !/^https?:\/\//.test(applicationUrl)) {
|
|
@@ -129,6 +127,22 @@ ${italic("(Example: https://example.palantirfoundry.com)")}`, {
|
|
|
129
127
|
return foundryUrl.replace(/\/$/, "");
|
|
130
128
|
}
|
|
131
129
|
|
|
130
|
+
// src/prompts/promptOntologyRid.ts
|
|
131
|
+
async function promptOntologyRid({
|
|
132
|
+
ontology
|
|
133
|
+
}) {
|
|
134
|
+
while (ontology == null || !/^ri\.ontology\.[^.]+\.ontology\.[^.]+$/.test(ontology)) {
|
|
135
|
+
if (ontology != null) {
|
|
136
|
+
consola.fail("Please enter a valid Ontology resource identifier (rid)");
|
|
137
|
+
}
|
|
138
|
+
ontology = await consola.prompt(`Enter the Ontology resource identifier (rid) associated with your Developer Console:
|
|
139
|
+
${italic("(Example: ri.ontology.main.ontology.1df1ce4c-f9d2-0f78-a316-287f6ac80bb2)")}`, {
|
|
140
|
+
type: "text"
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return ontology;
|
|
144
|
+
}
|
|
145
|
+
|
|
132
146
|
// src/prompts/promptOsdkPackage.ts
|
|
133
147
|
async function promptOsdkPackage({
|
|
134
148
|
osdkPackage
|
|
@@ -170,24 +184,19 @@ async function promptOverwrite({
|
|
|
170
184
|
if (!fs2.existsSync(path2.join(process.cwd(), project))) {
|
|
171
185
|
return true;
|
|
172
186
|
}
|
|
173
|
-
const result = await consola.prompt(
|
|
174
|
-
|
|
175
|
-
{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}]
|
|
187
|
-
}
|
|
188
|
-
// Types for "select" are wrong the value is returned rather than the option object
|
|
189
|
-
// https://github.com/unjs/consola/pull/238
|
|
190
|
-
);
|
|
187
|
+
const result = await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {
|
|
188
|
+
type: "select",
|
|
189
|
+
options: [{
|
|
190
|
+
label: "Remove existing files and continue",
|
|
191
|
+
value: "overwrite"
|
|
192
|
+
}, {
|
|
193
|
+
label: "Ignore files and continue",
|
|
194
|
+
value: "ignore"
|
|
195
|
+
}, {
|
|
196
|
+
label: "Cancel",
|
|
197
|
+
value: "cancel"
|
|
198
|
+
}]
|
|
199
|
+
});
|
|
191
200
|
switch (result) {
|
|
192
201
|
case "overwrite":
|
|
193
202
|
return true;
|
|
@@ -221,18 +230,17 @@ var scopeNameRegex = /^[a-zA-Z-_:]+$/;
|
|
|
221
230
|
async function promptScopes({
|
|
222
231
|
scopes
|
|
223
232
|
}) {
|
|
224
|
-
if (scopes == null) {
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
233
|
while (true) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
if (scopes != null) {
|
|
235
|
+
const invalidScopes = scopes.filter((scope) => !scopeNameRegex.test(scope));
|
|
236
|
+
const allValidScopes = invalidScopes.length === 0;
|
|
237
|
+
if (allValidScopes) {
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
const joinedInvalidScopes = invalidScopes.join(", ");
|
|
241
|
+
consola.fail(`Scopes [ ${joinedInvalidScopes} ] are invalid. Scope names can only contain letters, hyphens, underscores, and colons`);
|
|
232
242
|
}
|
|
233
|
-
const
|
|
234
|
-
consola.fail(`Scopes [ ${joinedInvalidScopes} ] are invalid. Scope names can only contain letters, hyphens, underscores, and colons`);
|
|
235
|
-
const stringScopes = await consola.prompt("Scopes:", {
|
|
243
|
+
const stringScopes = await consola.prompt("Enter the scopes to request during OAuth:", {
|
|
236
244
|
type: "text",
|
|
237
245
|
placeholder: "api:read-data api:write-data",
|
|
238
246
|
default: "api:read-data api:write-data"
|
|
@@ -264,18 +272,13 @@ async function promptSdkVersion({
|
|
|
264
272
|
}
|
|
265
273
|
if (template.files[sdkVersion] == null) {
|
|
266
274
|
consola.fail(`The ${template.label} template does not support a "${sdkVersion}" SDK version.`);
|
|
267
|
-
sdkVersion = await consola.prompt(
|
|
268
|
-
|
|
269
|
-
{
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}))
|
|
275
|
-
}
|
|
276
|
-
// Types for "select" are wrong the value is returned rather than the option object
|
|
277
|
-
// https://github.com/unjs/consola/pull/238
|
|
278
|
-
);
|
|
275
|
+
sdkVersion = await consola.prompt(`Please choose which version of the OSDK you'd like to use for the ${template.label} template:`, {
|
|
276
|
+
type: "select",
|
|
277
|
+
options: Object.keys(template.files).reverse().map((sdkVersion2) => ({
|
|
278
|
+
label: sdkVersion2,
|
|
279
|
+
value: sdkVersion2
|
|
280
|
+
}))
|
|
281
|
+
});
|
|
279
282
|
}
|
|
280
283
|
return sdkVersion;
|
|
281
284
|
}
|
|
@@ -291,9 +294,10 @@ var TEMPLATES = [
|
|
|
291
294
|
label: "React",
|
|
292
295
|
envPrefix: "VITE_",
|
|
293
296
|
buildDirectory: "./dist",
|
|
297
|
+
hidden: false,
|
|
294
298
|
files: {
|
|
295
|
-
"1.x": getPackageFiles(import('./esm-
|
|
296
|
-
"2.x": getPackageFiles(import('./esm-
|
|
299
|
+
"1.x": getPackageFiles(import('./esm-KU5YPQC2.js')),
|
|
300
|
+
"2.x": getPackageFiles(import('./esm-O6YHTVZC.js'))
|
|
297
301
|
}
|
|
298
302
|
},
|
|
299
303
|
// Expo
|
|
@@ -302,8 +306,9 @@ var TEMPLATES = [
|
|
|
302
306
|
label: "Expo",
|
|
303
307
|
envPrefix: "EXPO_PUBLIC_",
|
|
304
308
|
buildDirectory: "./dist",
|
|
309
|
+
hidden: false,
|
|
305
310
|
files: {
|
|
306
|
-
"2.x": getPackageFiles(import('./esm-
|
|
311
|
+
"2.x": getPackageFiles(import('./esm-Z3DTLPV3.js'))
|
|
307
312
|
}
|
|
308
313
|
},
|
|
309
314
|
// Vue
|
|
@@ -312,20 +317,10 @@ var TEMPLATES = [
|
|
|
312
317
|
label: "Vue",
|
|
313
318
|
envPrefix: "VITE_",
|
|
314
319
|
buildDirectory: "./dist",
|
|
320
|
+
hidden: false,
|
|
315
321
|
files: {
|
|
316
|
-
"1.x": getPackageFiles(import('./esm-
|
|
317
|
-
"2.x": getPackageFiles(import('./esm-
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
// Next (static export)
|
|
321
|
-
{
|
|
322
|
-
id: "template-next-static-export",
|
|
323
|
-
label: "Next (static export)",
|
|
324
|
-
envPrefix: "NEXT_PUBLIC_",
|
|
325
|
-
buildDirectory: "./out",
|
|
326
|
-
files: {
|
|
327
|
-
"1.x": getPackageFiles(import('./esm-NFVUE2AE.js')),
|
|
328
|
-
"2.x": getPackageFiles(import('./esm-4SFFV2ZK.js'))
|
|
322
|
+
"1.x": getPackageFiles(import('./esm-JF6OCVHP.js')),
|
|
323
|
+
"2.x": getPackageFiles(import('./esm-KD5U2KOZ.js'))
|
|
329
324
|
}
|
|
330
325
|
},
|
|
331
326
|
// Tutorial: To do App
|
|
@@ -334,9 +329,10 @@ var TEMPLATES = [
|
|
|
334
329
|
label: "Tutorial: To do App",
|
|
335
330
|
envPrefix: "VITE_",
|
|
336
331
|
buildDirectory: "./dist",
|
|
332
|
+
hidden: true,
|
|
337
333
|
files: {
|
|
338
|
-
"1.x": getPackageFiles(import('./esm-
|
|
339
|
-
"2.x": getPackageFiles(import('./esm-
|
|
334
|
+
"1.x": getPackageFiles(import('./esm-N7ZNHY2Z.js')),
|
|
335
|
+
"2.x": getPackageFiles(import('./esm-ZJEGQFW7.js'))
|
|
340
336
|
}
|
|
341
337
|
},
|
|
342
338
|
// Tutorial: To do AIP App
|
|
@@ -345,30 +341,26 @@ var TEMPLATES = [
|
|
|
345
341
|
label: "Tutorial: To do AIP App",
|
|
346
342
|
envPrefix: "VITE_",
|
|
347
343
|
buildDirectory: "./dist",
|
|
344
|
+
hidden: true,
|
|
348
345
|
files: {
|
|
349
|
-
"1.x": getPackageFiles(import('./esm-
|
|
350
|
-
"2.x": getPackageFiles(import('./esm-
|
|
346
|
+
"1.x": getPackageFiles(import('./esm-SCLZKD46.js')),
|
|
347
|
+
"2.x": getPackageFiles(import('./esm-S4C4CWK7.js'))
|
|
351
348
|
}
|
|
352
349
|
}
|
|
353
350
|
];
|
|
354
351
|
|
|
355
352
|
// src/prompts/promptTemplate.ts
|
|
356
353
|
async function promptTemplate(parsed) {
|
|
357
|
-
|
|
354
|
+
const useBeta = parsed.beta ?? false;
|
|
358
355
|
let template = TEMPLATES.find((t) => t.id === parsed.template || t.id === `template-${parsed.template}`);
|
|
359
356
|
if (template == null) {
|
|
360
|
-
const availableTemplates =
|
|
361
|
-
if (availableTemplates.length === 0) {
|
|
362
|
-
throw new Error("No available templates found for the selected options.");
|
|
363
|
-
}
|
|
357
|
+
const availableTemplates = getAvailableTemplatesOrThrow(useBeta);
|
|
364
358
|
const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : "Select a framework:", {
|
|
365
359
|
type: "select",
|
|
366
360
|
options: availableTemplates.map((template2) => ({
|
|
367
361
|
value: template2.id,
|
|
368
362
|
label: template2.label
|
|
369
363
|
}))
|
|
370
|
-
// Types for "select" are wrong the value is returned rather than the option object
|
|
371
|
-
// https://github.com/unjs/consola/pull/238
|
|
372
364
|
});
|
|
373
365
|
template = TEMPLATES.find((t) => t.id === templateId);
|
|
374
366
|
if (template == null) {
|
|
@@ -377,6 +369,13 @@ async function promptTemplate(parsed) {
|
|
|
377
369
|
}
|
|
378
370
|
return template;
|
|
379
371
|
}
|
|
372
|
+
function getAvailableTemplatesOrThrow(useBeta) {
|
|
373
|
+
const availableTemplates = TEMPLATES.filter((template) => !template.hidden && (useBeta ? template.isBeta === true : !template.isBeta));
|
|
374
|
+
if (availableTemplates.length === 0) {
|
|
375
|
+
throw new Error("No available templates found for the selected options.");
|
|
376
|
+
}
|
|
377
|
+
return availableTemplates;
|
|
378
|
+
}
|
|
380
379
|
|
|
381
380
|
// ../generator-utils/build/esm/changeVersionPrefix.js
|
|
382
381
|
function changeVersionPrefix(version, prefix) {
|
|
@@ -398,37 +397,87 @@ function generateEnvDevelopment({
|
|
|
398
397
|
envPrefix,
|
|
399
398
|
foundryUrl,
|
|
400
399
|
clientId,
|
|
401
|
-
corsProxy
|
|
400
|
+
corsProxy,
|
|
401
|
+
ontology
|
|
402
402
|
}) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
403
|
+
const foundryApiUrl = corsProxy ? "http://localhost:8080" : foundryUrl;
|
|
404
|
+
const applicationUrl = "http://localhost:8080";
|
|
405
|
+
return `# This env file is intended for developing on your local computer.
|
|
406
|
+
# To set up development in Foundry's Code Workspaces, see .env.code-workspaces.
|
|
407
|
+
# To deploy your application to production, see .env.production.
|
|
408
|
+
# Note that .env.code-workspaces is only present for projects that were set up
|
|
409
|
+
# using the "Bootstrap in Foundry" option in Developer Console.
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
# This URL is the URL your users will be redirected back to after signing in.
|
|
413
|
+
# This URL must exactly match one of the URLs listed in the "OAuth & scopes"
|
|
414
|
+
# page of Developer Console.
|
|
415
|
+
#
|
|
416
|
+
# If your application in development is not hosted on port 8080, you will need
|
|
417
|
+
# to change this URL here and in Developer Console.
|
|
418
|
+
|
|
419
|
+
${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl}/auth/callback
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
# This URL is the Foundry host that your OSDK will use. It typically does not
|
|
423
|
+
# need to be changed.
|
|
424
|
+
|
|
425
|
+
${envPrefix}FOUNDRY_API_URL=${foundryApiUrl}
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
# This client ID must match the client ID given on the "OAuth & scopes" page of
|
|
429
|
+
# Developer Console. It typically does not need to be changed.
|
|
430
|
+
|
|
431
|
+
${envPrefix}FOUNDRY_CLIENT_ID=${clientId}
|
|
432
|
+
|
|
433
|
+
# This Ontology RID must match the Ontology RID your Developer Console is associated with.
|
|
434
|
+
# You can check the Ontology on the "Data Resources" page of Developer Console.
|
|
435
|
+
# It typically does not need to be changed.
|
|
436
|
+
|
|
437
|
+
${envPrefix}FOUNDRY_ONTOLOGY_RID=${ontology}
|
|
438
|
+
`;
|
|
409
439
|
}
|
|
410
440
|
function generateEnvProduction({
|
|
411
441
|
envPrefix,
|
|
412
442
|
foundryUrl,
|
|
413
443
|
applicationUrl,
|
|
414
|
-
clientId
|
|
415
|
-
|
|
416
|
-
return generateEnv({
|
|
417
|
-
envPrefix,
|
|
418
|
-
foundryUrl,
|
|
419
|
-
applicationUrl,
|
|
420
|
-
clientId
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
function generateEnv({
|
|
424
|
-
envPrefix,
|
|
425
|
-
foundryUrl,
|
|
426
|
-
applicationUrl,
|
|
427
|
-
clientId
|
|
444
|
+
clientId,
|
|
445
|
+
ontology
|
|
428
446
|
}) {
|
|
429
|
-
|
|
430
|
-
|
|
447
|
+
const applicationUrlOrDefault = applicationUrl ?? "<Fill in the domain at which you deploy your application>";
|
|
448
|
+
return `# This env file is intended for deploying your application to production.
|
|
449
|
+
# To set up development on your local computer, see .env.development.
|
|
450
|
+
# To set up development in Foundry's Code Workspaces, see .env.code-workspaces.
|
|
451
|
+
# Note that .env.code-workspaces is only present for projects that were set up
|
|
452
|
+
# using the "Bootstrap in Foundry" option in Developer Console.
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
# This URL is the URL your users will be redirected back to after signing in.
|
|
456
|
+
# This URL must exactly match one of the URLs listed in the "OAuth & scopes"
|
|
457
|
+
# page of Developer Console.
|
|
458
|
+
#
|
|
459
|
+
# If you change where your application is hosted, you will need to change this
|
|
460
|
+
# URL here and in Developer Console.
|
|
461
|
+
|
|
462
|
+
${applicationUrl == null ? "# " : ""}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrlOrDefault}/auth/callback
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
# This URL is the Foundry host that your OSDK will use. It typically does not
|
|
466
|
+
# need to be changed.
|
|
467
|
+
|
|
468
|
+
${envPrefix}FOUNDRY_API_URL=${foundryUrl}
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
# This client ID must match the client ID given on the "OAuth & scopes" page of
|
|
472
|
+
# Developer Console. It typically does not need to be changed.
|
|
473
|
+
|
|
431
474
|
${envPrefix}FOUNDRY_CLIENT_ID=${clientId}
|
|
475
|
+
|
|
476
|
+
# This Ontology RID must match the Ontology RID your Developer Console is associated with.
|
|
477
|
+
# You can check the Ontology on the "Data Resources" page of Developer Console.
|
|
478
|
+
# It typically does not need to be changed.
|
|
479
|
+
|
|
480
|
+
${envPrefix}FOUNDRY_ONTOLOGY_RID=${ontology}
|
|
432
481
|
`;
|
|
433
482
|
}
|
|
434
483
|
|
|
@@ -473,6 +522,7 @@ async function run({
|
|
|
473
522
|
foundryUrl,
|
|
474
523
|
applicationUrl,
|
|
475
524
|
application,
|
|
525
|
+
ontology,
|
|
476
526
|
clientId,
|
|
477
527
|
osdkPackage,
|
|
478
528
|
osdkRegistryUrl,
|
|
@@ -518,8 +568,8 @@ async function run({
|
|
|
518
568
|
const ourPackageJsonPath = findUpSync("package.json", {
|
|
519
569
|
cwd: fileURLToPath(import.meta.url)
|
|
520
570
|
});
|
|
521
|
-
ourPackageJsonPath ? JSON.parse(fs2.readFileSync(ourPackageJsonPath, "utf-8")).version :
|
|
522
|
-
const clientVersion = "2.2.0-beta.
|
|
571
|
+
ourPackageJsonPath ? JSON.parse(fs2.readFileSync(ourPackageJsonPath, "utf-8")).version : void 0;
|
|
572
|
+
const clientVersion = "2.2.0-beta.21";
|
|
523
573
|
const templateContext = {
|
|
524
574
|
project,
|
|
525
575
|
foundryUrl,
|
|
@@ -558,14 +608,16 @@ async function run({
|
|
|
558
608
|
envPrefix: template.envPrefix,
|
|
559
609
|
foundryUrl,
|
|
560
610
|
clientId,
|
|
561
|
-
corsProxy
|
|
611
|
+
corsProxy,
|
|
612
|
+
ontology
|
|
562
613
|
});
|
|
563
614
|
fs2.writeFileSync(path2.join(root, ".env.development"), envDevelopment);
|
|
564
615
|
const envProduction = generateEnvProduction({
|
|
565
616
|
envPrefix: template.envPrefix,
|
|
566
617
|
foundryUrl,
|
|
567
618
|
applicationUrl,
|
|
568
|
-
clientId
|
|
619
|
+
clientId,
|
|
620
|
+
ontology
|
|
569
621
|
});
|
|
570
622
|
fs2.writeFileSync(path2.join(root, ".env.production"), envProduction);
|
|
571
623
|
const foundryConfigJson = generateFoundryConfigJson({
|
|
@@ -593,7 +645,7 @@ async function run({
|
|
|
593
645
|
|
|
594
646
|
// src/cli.ts
|
|
595
647
|
async function cli(args = process.argv) {
|
|
596
|
-
const base = yargs(hideBin(args)).version("2.2.0-beta.
|
|
648
|
+
const base = yargs(hideBin(args)).version("2.2.0-beta.21").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", {
|
|
597
649
|
type: "string",
|
|
598
650
|
describe: "Project name to create"
|
|
599
651
|
}).option("overwrite", {
|
|
@@ -621,6 +673,9 @@ async function cli(args = process.argv) {
|
|
|
621
673
|
}).option("application", {
|
|
622
674
|
type: "string",
|
|
623
675
|
describe: "Application resource identifier (rid)"
|
|
676
|
+
}).option("ontology", {
|
|
677
|
+
type: "string",
|
|
678
|
+
describe: "Ontology resource identifier (rid)"
|
|
624
679
|
}).option("clientId", {
|
|
625
680
|
type: "string",
|
|
626
681
|
describe: "OAuth client ID for application"
|
|
@@ -652,6 +707,7 @@ async function cli(args = process.argv) {
|
|
|
652
707
|
const foundryUrl = await promptFoundryUrl(parsed);
|
|
653
708
|
const applicationUrl = await promptApplicationUrl(parsed);
|
|
654
709
|
const application = await promptApplicationRid(parsed);
|
|
710
|
+
const ontology = await promptOntologyRid(parsed);
|
|
655
711
|
const clientId = await promptClientId(parsed);
|
|
656
712
|
const osdkPackage = await promptOsdkPackage(parsed);
|
|
657
713
|
const osdkRegistryUrl = await promptOsdkRegistryUrl(parsed);
|
|
@@ -669,7 +725,8 @@ async function cli(args = process.argv) {
|
|
|
669
725
|
osdkPackage,
|
|
670
726
|
osdkRegistryUrl,
|
|
671
727
|
corsProxy,
|
|
672
|
-
scopes
|
|
728
|
+
scopes,
|
|
729
|
+
ontology
|
|
673
730
|
});
|
|
674
731
|
}
|
|
675
732
|
|