@tanstack/cta-engine 0.24.1 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-app.js +1 -1
- package/dist/template-file.js +6 -0
- package/dist/types/custom-add-ons/add-on.d.ts +7 -4
- package/dist/types/types.d.ts +95 -54
- package/dist/types.js +7 -4
- package/package.json +1 -1
- package/src/create-app.ts +1 -1
- package/src/template-file.ts +14 -1
- package/src/types.ts +7 -4
package/dist/create-app.js
CHANGED
|
@@ -35,7 +35,7 @@ async function writeFiles(environment, options) {
|
|
|
35
35
|
await writeFileBundle(options.framework);
|
|
36
36
|
environment.finishStep('write-framework-files', 'Framework files written');
|
|
37
37
|
let wroteAddonFiles = false;
|
|
38
|
-
for (const type of ['add-on', 'example', 'toolchain']) {
|
|
38
|
+
for (const type of ['add-on', 'example', 'toolchain', 'host']) {
|
|
39
39
|
for (const phase of ['setup', 'add-on', 'example']) {
|
|
40
40
|
for (const addOn of options.chosenAddOns.filter((addOn) => addOn.phase === phase && addOn.type === type)) {
|
|
41
41
|
environment.startStep({
|
package/dist/template-file.js
CHANGED
|
@@ -45,6 +45,10 @@ export function createTemplateFile(environment, options) {
|
|
|
45
45
|
return acc;
|
|
46
46
|
}, {});
|
|
47
47
|
return async function templateFile(file, content) {
|
|
48
|
+
const localRelativePath = (path, stripExtension = false) => relativePath(file, path, stripExtension);
|
|
49
|
+
const integrationImportContent = (integration) => integration.import ||
|
|
50
|
+
`import ${integration.jsName} from '${localRelativePath(integration.path || '')}'`;
|
|
51
|
+
const integrationImportCode = (integration) => integration.code || integration.jsName;
|
|
48
52
|
const templateValues = {
|
|
49
53
|
packageManager: options.packageManager,
|
|
50
54
|
projectName: options.projectName,
|
|
@@ -61,6 +65,8 @@ export function createTemplateFile(environment, options) {
|
|
|
61
65
|
getPackageManagerAddScript,
|
|
62
66
|
getPackageManagerRunScript,
|
|
63
67
|
relativePath: (path, stripExtension = false) => relativePath(file, path, stripExtension),
|
|
68
|
+
integrationImportContent,
|
|
69
|
+
integrationImportCode,
|
|
64
70
|
ignoreFile: () => {
|
|
65
71
|
throw new IgnoreFileError();
|
|
66
72
|
},
|
|
@@ -15,7 +15,7 @@ export declare function generateProject(persistedOptions: PersistedOptions): Pro
|
|
|
15
15
|
id: string;
|
|
16
16
|
name: string;
|
|
17
17
|
description: string;
|
|
18
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
18
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
19
19
|
modes: string[];
|
|
20
20
|
phase: "add-on" | "setup";
|
|
21
21
|
command?: {
|
|
@@ -44,10 +44,13 @@ export declare function generateProject(persistedOptions: PersistedOptions): Pro
|
|
|
44
44
|
logo?: string | undefined;
|
|
45
45
|
addOnSpecialSteps?: string[] | undefined;
|
|
46
46
|
createSpecialSteps?: string[] | undefined;
|
|
47
|
+
default?: boolean | undefined;
|
|
47
48
|
integrations?: {
|
|
48
|
-
type
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
type?: string | undefined;
|
|
50
|
+
code?: string | undefined;
|
|
51
|
+
path?: string | undefined;
|
|
52
|
+
jsName?: string | undefined;
|
|
53
|
+
import?: string | undefined;
|
|
51
54
|
}[] | undefined;
|
|
52
55
|
readme?: string | undefined;
|
|
53
56
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const AddOnBaseSchema: z.ZodObject<{
|
|
|
10
10
|
link: z.ZodOptional<z.ZodString>;
|
|
11
11
|
license: z.ZodOptional<z.ZodString>;
|
|
12
12
|
warning: z.ZodOptional<z.ZodString>;
|
|
13
|
-
type: z.ZodEnum<["add-on", "example", "starter", "toolchain"]>;
|
|
13
|
+
type: z.ZodEnum<["add-on", "example", "starter", "toolchain", "host"]>;
|
|
14
14
|
command: z.ZodOptional<z.ZodObject<{
|
|
15
15
|
command: z.ZodString;
|
|
16
16
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -56,11 +56,12 @@ export declare const AddOnBaseSchema: z.ZodObject<{
|
|
|
56
56
|
logo: z.ZodOptional<z.ZodString>;
|
|
57
57
|
addOnSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
58
58
|
createSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
59
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
59
60
|
}, "strip", z.ZodTypeAny, {
|
|
60
61
|
id: string;
|
|
61
62
|
name: string;
|
|
62
63
|
description: string;
|
|
63
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
64
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
64
65
|
command?: {
|
|
65
66
|
command: string;
|
|
66
67
|
args?: string[] | undefined;
|
|
@@ -87,11 +88,12 @@ export declare const AddOnBaseSchema: z.ZodObject<{
|
|
|
87
88
|
logo?: string | undefined;
|
|
88
89
|
addOnSpecialSteps?: string[] | undefined;
|
|
89
90
|
createSpecialSteps?: string[] | undefined;
|
|
91
|
+
default?: boolean | undefined;
|
|
90
92
|
}, {
|
|
91
93
|
id: string;
|
|
92
94
|
name: string;
|
|
93
95
|
description: string;
|
|
94
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
96
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
95
97
|
command?: {
|
|
96
98
|
command: string;
|
|
97
99
|
args?: string[] | undefined;
|
|
@@ -118,6 +120,7 @@ export declare const AddOnBaseSchema: z.ZodObject<{
|
|
|
118
120
|
logo?: string | undefined;
|
|
119
121
|
addOnSpecialSteps?: string[] | undefined;
|
|
120
122
|
createSpecialSteps?: string[] | undefined;
|
|
123
|
+
default?: boolean | undefined;
|
|
121
124
|
}>;
|
|
122
125
|
export declare const StarterSchema: z.ZodObject<{
|
|
123
126
|
id: z.ZodString;
|
|
@@ -128,7 +131,7 @@ export declare const StarterSchema: z.ZodObject<{
|
|
|
128
131
|
link: z.ZodOptional<z.ZodString>;
|
|
129
132
|
license: z.ZodOptional<z.ZodString>;
|
|
130
133
|
warning: z.ZodOptional<z.ZodString>;
|
|
131
|
-
type: z.ZodEnum<["add-on", "example", "starter", "toolchain"]>;
|
|
134
|
+
type: z.ZodEnum<["add-on", "example", "starter", "toolchain", "host"]>;
|
|
132
135
|
command: z.ZodOptional<z.ZodObject<{
|
|
133
136
|
command: z.ZodString;
|
|
134
137
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -174,6 +177,7 @@ export declare const StarterSchema: z.ZodObject<{
|
|
|
174
177
|
logo: z.ZodOptional<z.ZodString>;
|
|
175
178
|
addOnSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
176
179
|
createSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
180
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
177
181
|
} & {
|
|
178
182
|
framework: z.ZodString;
|
|
179
183
|
mode: z.ZodString;
|
|
@@ -184,7 +188,7 @@ export declare const StarterSchema: z.ZodObject<{
|
|
|
184
188
|
id: string;
|
|
185
189
|
name: string;
|
|
186
190
|
description: string;
|
|
187
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
191
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
188
192
|
framework: string;
|
|
189
193
|
mode: string;
|
|
190
194
|
typescript: boolean;
|
|
@@ -215,12 +219,13 @@ export declare const StarterSchema: z.ZodObject<{
|
|
|
215
219
|
logo?: string | undefined;
|
|
216
220
|
addOnSpecialSteps?: string[] | undefined;
|
|
217
221
|
createSpecialSteps?: string[] | undefined;
|
|
222
|
+
default?: boolean | undefined;
|
|
218
223
|
banner?: string | undefined;
|
|
219
224
|
}, {
|
|
220
225
|
id: string;
|
|
221
226
|
name: string;
|
|
222
227
|
description: string;
|
|
223
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
228
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
224
229
|
framework: string;
|
|
225
230
|
mode: string;
|
|
226
231
|
typescript: boolean;
|
|
@@ -251,6 +256,7 @@ export declare const StarterSchema: z.ZodObject<{
|
|
|
251
256
|
logo?: string | undefined;
|
|
252
257
|
addOnSpecialSteps?: string[] | undefined;
|
|
253
258
|
createSpecialSteps?: string[] | undefined;
|
|
259
|
+
default?: boolean | undefined;
|
|
254
260
|
banner?: string | undefined;
|
|
255
261
|
}>;
|
|
256
262
|
export declare const StarterCompiledSchema: z.ZodObject<{
|
|
@@ -262,7 +268,7 @@ export declare const StarterCompiledSchema: z.ZodObject<{
|
|
|
262
268
|
link: z.ZodOptional<z.ZodString>;
|
|
263
269
|
license: z.ZodOptional<z.ZodString>;
|
|
264
270
|
warning: z.ZodOptional<z.ZodString>;
|
|
265
|
-
type: z.ZodEnum<["add-on", "example", "starter", "toolchain"]>;
|
|
271
|
+
type: z.ZodEnum<["add-on", "example", "starter", "toolchain", "host"]>;
|
|
266
272
|
command: z.ZodOptional<z.ZodObject<{
|
|
267
273
|
command: z.ZodString;
|
|
268
274
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -308,6 +314,7 @@ export declare const StarterCompiledSchema: z.ZodObject<{
|
|
|
308
314
|
logo: z.ZodOptional<z.ZodString>;
|
|
309
315
|
addOnSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
310
316
|
createSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
317
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
311
318
|
} & {
|
|
312
319
|
framework: z.ZodString;
|
|
313
320
|
mode: z.ZodString;
|
|
@@ -321,7 +328,7 @@ export declare const StarterCompiledSchema: z.ZodObject<{
|
|
|
321
328
|
id: string;
|
|
322
329
|
name: string;
|
|
323
330
|
description: string;
|
|
324
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
331
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
325
332
|
framework: string;
|
|
326
333
|
mode: string;
|
|
327
334
|
typescript: boolean;
|
|
@@ -354,12 +361,13 @@ export declare const StarterCompiledSchema: z.ZodObject<{
|
|
|
354
361
|
logo?: string | undefined;
|
|
355
362
|
addOnSpecialSteps?: string[] | undefined;
|
|
356
363
|
createSpecialSteps?: string[] | undefined;
|
|
364
|
+
default?: boolean | undefined;
|
|
357
365
|
banner?: string | undefined;
|
|
358
366
|
}, {
|
|
359
367
|
id: string;
|
|
360
368
|
name: string;
|
|
361
369
|
description: string;
|
|
362
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
370
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
363
371
|
framework: string;
|
|
364
372
|
mode: string;
|
|
365
373
|
typescript: boolean;
|
|
@@ -392,20 +400,27 @@ export declare const StarterCompiledSchema: z.ZodObject<{
|
|
|
392
400
|
logo?: string | undefined;
|
|
393
401
|
addOnSpecialSteps?: string[] | undefined;
|
|
394
402
|
createSpecialSteps?: string[] | undefined;
|
|
403
|
+
default?: boolean | undefined;
|
|
395
404
|
banner?: string | undefined;
|
|
396
405
|
}>;
|
|
397
406
|
export declare const IntegrationSchema: z.ZodObject<{
|
|
398
|
-
type: z.ZodString
|
|
399
|
-
path: z.ZodString
|
|
400
|
-
jsName: z.ZodString
|
|
407
|
+
type: z.ZodOptional<z.ZodString>;
|
|
408
|
+
path: z.ZodOptional<z.ZodString>;
|
|
409
|
+
jsName: z.ZodOptional<z.ZodString>;
|
|
410
|
+
import: z.ZodOptional<z.ZodString>;
|
|
411
|
+
code: z.ZodOptional<z.ZodString>;
|
|
401
412
|
}, "strip", z.ZodTypeAny, {
|
|
402
|
-
type
|
|
403
|
-
|
|
404
|
-
|
|
413
|
+
type?: string | undefined;
|
|
414
|
+
code?: string | undefined;
|
|
415
|
+
path?: string | undefined;
|
|
416
|
+
jsName?: string | undefined;
|
|
417
|
+
import?: string | undefined;
|
|
405
418
|
}, {
|
|
406
|
-
type
|
|
407
|
-
|
|
408
|
-
|
|
419
|
+
type?: string | undefined;
|
|
420
|
+
code?: string | undefined;
|
|
421
|
+
path?: string | undefined;
|
|
422
|
+
jsName?: string | undefined;
|
|
423
|
+
import?: string | undefined;
|
|
409
424
|
}>;
|
|
410
425
|
export declare const AddOnInfoSchema: z.ZodObject<{
|
|
411
426
|
id: z.ZodString;
|
|
@@ -416,7 +431,7 @@ export declare const AddOnInfoSchema: z.ZodObject<{
|
|
|
416
431
|
link: z.ZodOptional<z.ZodString>;
|
|
417
432
|
license: z.ZodOptional<z.ZodString>;
|
|
418
433
|
warning: z.ZodOptional<z.ZodString>;
|
|
419
|
-
type: z.ZodEnum<["add-on", "example", "starter", "toolchain"]>;
|
|
434
|
+
type: z.ZodEnum<["add-on", "example", "starter", "toolchain", "host"]>;
|
|
420
435
|
command: z.ZodOptional<z.ZodObject<{
|
|
421
436
|
command: z.ZodString;
|
|
422
437
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -462,20 +477,27 @@ export declare const AddOnInfoSchema: z.ZodObject<{
|
|
|
462
477
|
logo: z.ZodOptional<z.ZodString>;
|
|
463
478
|
addOnSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
464
479
|
createSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
480
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
465
481
|
} & {
|
|
466
482
|
modes: z.ZodArray<z.ZodString, "many">;
|
|
467
483
|
integrations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
468
|
-
type: z.ZodString
|
|
469
|
-
path: z.ZodString
|
|
470
|
-
jsName: z.ZodString
|
|
484
|
+
type: z.ZodOptional<z.ZodString>;
|
|
485
|
+
path: z.ZodOptional<z.ZodString>;
|
|
486
|
+
jsName: z.ZodOptional<z.ZodString>;
|
|
487
|
+
import: z.ZodOptional<z.ZodString>;
|
|
488
|
+
code: z.ZodOptional<z.ZodString>;
|
|
471
489
|
}, "strip", z.ZodTypeAny, {
|
|
472
|
-
type
|
|
473
|
-
|
|
474
|
-
|
|
490
|
+
type?: string | undefined;
|
|
491
|
+
code?: string | undefined;
|
|
492
|
+
path?: string | undefined;
|
|
493
|
+
jsName?: string | undefined;
|
|
494
|
+
import?: string | undefined;
|
|
475
495
|
}, {
|
|
476
|
-
type
|
|
477
|
-
|
|
478
|
-
|
|
496
|
+
type?: string | undefined;
|
|
497
|
+
code?: string | undefined;
|
|
498
|
+
path?: string | undefined;
|
|
499
|
+
jsName?: string | undefined;
|
|
500
|
+
import?: string | undefined;
|
|
479
501
|
}>, "many">>;
|
|
480
502
|
phase: z.ZodEnum<["setup", "add-on"]>;
|
|
481
503
|
readme: z.ZodOptional<z.ZodString>;
|
|
@@ -483,7 +505,7 @@ export declare const AddOnInfoSchema: z.ZodObject<{
|
|
|
483
505
|
id: string;
|
|
484
506
|
name: string;
|
|
485
507
|
description: string;
|
|
486
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
508
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
487
509
|
modes: string[];
|
|
488
510
|
phase: "add-on" | "setup";
|
|
489
511
|
command?: {
|
|
@@ -512,17 +534,20 @@ export declare const AddOnInfoSchema: z.ZodObject<{
|
|
|
512
534
|
logo?: string | undefined;
|
|
513
535
|
addOnSpecialSteps?: string[] | undefined;
|
|
514
536
|
createSpecialSteps?: string[] | undefined;
|
|
537
|
+
default?: boolean | undefined;
|
|
515
538
|
integrations?: {
|
|
516
|
-
type
|
|
517
|
-
|
|
518
|
-
|
|
539
|
+
type?: string | undefined;
|
|
540
|
+
code?: string | undefined;
|
|
541
|
+
path?: string | undefined;
|
|
542
|
+
jsName?: string | undefined;
|
|
543
|
+
import?: string | undefined;
|
|
519
544
|
}[] | undefined;
|
|
520
545
|
readme?: string | undefined;
|
|
521
546
|
}, {
|
|
522
547
|
id: string;
|
|
523
548
|
name: string;
|
|
524
549
|
description: string;
|
|
525
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
550
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
526
551
|
modes: string[];
|
|
527
552
|
phase: "add-on" | "setup";
|
|
528
553
|
command?: {
|
|
@@ -551,10 +576,13 @@ export declare const AddOnInfoSchema: z.ZodObject<{
|
|
|
551
576
|
logo?: string | undefined;
|
|
552
577
|
addOnSpecialSteps?: string[] | undefined;
|
|
553
578
|
createSpecialSteps?: string[] | undefined;
|
|
579
|
+
default?: boolean | undefined;
|
|
554
580
|
integrations?: {
|
|
555
|
-
type
|
|
556
|
-
|
|
557
|
-
|
|
581
|
+
type?: string | undefined;
|
|
582
|
+
code?: string | undefined;
|
|
583
|
+
path?: string | undefined;
|
|
584
|
+
jsName?: string | undefined;
|
|
585
|
+
import?: string | undefined;
|
|
558
586
|
}[] | undefined;
|
|
559
587
|
readme?: string | undefined;
|
|
560
588
|
}>;
|
|
@@ -567,7 +595,7 @@ export declare const AddOnCompiledSchema: z.ZodObject<{
|
|
|
567
595
|
link: z.ZodOptional<z.ZodString>;
|
|
568
596
|
license: z.ZodOptional<z.ZodString>;
|
|
569
597
|
warning: z.ZodOptional<z.ZodString>;
|
|
570
|
-
type: z.ZodEnum<["add-on", "example", "starter", "toolchain"]>;
|
|
598
|
+
type: z.ZodEnum<["add-on", "example", "starter", "toolchain", "host"]>;
|
|
571
599
|
command: z.ZodOptional<z.ZodObject<{
|
|
572
600
|
command: z.ZodString;
|
|
573
601
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -613,20 +641,27 @@ export declare const AddOnCompiledSchema: z.ZodObject<{
|
|
|
613
641
|
logo: z.ZodOptional<z.ZodString>;
|
|
614
642
|
addOnSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
615
643
|
createSpecialSteps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
644
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
616
645
|
} & {
|
|
617
646
|
modes: z.ZodArray<z.ZodString, "many">;
|
|
618
647
|
integrations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
619
|
-
type: z.ZodString
|
|
620
|
-
path: z.ZodString
|
|
621
|
-
jsName: z.ZodString
|
|
648
|
+
type: z.ZodOptional<z.ZodString>;
|
|
649
|
+
path: z.ZodOptional<z.ZodString>;
|
|
650
|
+
jsName: z.ZodOptional<z.ZodString>;
|
|
651
|
+
import: z.ZodOptional<z.ZodString>;
|
|
652
|
+
code: z.ZodOptional<z.ZodString>;
|
|
622
653
|
}, "strip", z.ZodTypeAny, {
|
|
623
|
-
type
|
|
624
|
-
|
|
625
|
-
|
|
654
|
+
type?: string | undefined;
|
|
655
|
+
code?: string | undefined;
|
|
656
|
+
path?: string | undefined;
|
|
657
|
+
jsName?: string | undefined;
|
|
658
|
+
import?: string | undefined;
|
|
626
659
|
}, {
|
|
627
|
-
type
|
|
628
|
-
|
|
629
|
-
|
|
660
|
+
type?: string | undefined;
|
|
661
|
+
code?: string | undefined;
|
|
662
|
+
path?: string | undefined;
|
|
663
|
+
jsName?: string | undefined;
|
|
664
|
+
import?: string | undefined;
|
|
630
665
|
}>, "many">>;
|
|
631
666
|
phase: z.ZodEnum<["setup", "add-on"]>;
|
|
632
667
|
readme: z.ZodOptional<z.ZodString>;
|
|
@@ -637,7 +672,7 @@ export declare const AddOnCompiledSchema: z.ZodObject<{
|
|
|
637
672
|
id: string;
|
|
638
673
|
name: string;
|
|
639
674
|
description: string;
|
|
640
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
675
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
641
676
|
files: Record<string, string>;
|
|
642
677
|
deletedFiles: string[];
|
|
643
678
|
modes: string[];
|
|
@@ -668,17 +703,20 @@ export declare const AddOnCompiledSchema: z.ZodObject<{
|
|
|
668
703
|
logo?: string | undefined;
|
|
669
704
|
addOnSpecialSteps?: string[] | undefined;
|
|
670
705
|
createSpecialSteps?: string[] | undefined;
|
|
706
|
+
default?: boolean | undefined;
|
|
671
707
|
integrations?: {
|
|
672
|
-
type
|
|
673
|
-
|
|
674
|
-
|
|
708
|
+
type?: string | undefined;
|
|
709
|
+
code?: string | undefined;
|
|
710
|
+
path?: string | undefined;
|
|
711
|
+
jsName?: string | undefined;
|
|
712
|
+
import?: string | undefined;
|
|
675
713
|
}[] | undefined;
|
|
676
714
|
readme?: string | undefined;
|
|
677
715
|
}, {
|
|
678
716
|
id: string;
|
|
679
717
|
name: string;
|
|
680
718
|
description: string;
|
|
681
|
-
type: "add-on" | "example" | "starter" | "toolchain";
|
|
719
|
+
type: "add-on" | "example" | "starter" | "toolchain" | "host";
|
|
682
720
|
files: Record<string, string>;
|
|
683
721
|
deletedFiles: string[];
|
|
684
722
|
modes: string[];
|
|
@@ -709,10 +747,13 @@ export declare const AddOnCompiledSchema: z.ZodObject<{
|
|
|
709
747
|
logo?: string | undefined;
|
|
710
748
|
addOnSpecialSteps?: string[] | undefined;
|
|
711
749
|
createSpecialSteps?: string[] | undefined;
|
|
750
|
+
default?: boolean | undefined;
|
|
712
751
|
integrations?: {
|
|
713
|
-
type
|
|
714
|
-
|
|
715
|
-
|
|
752
|
+
type?: string | undefined;
|
|
753
|
+
code?: string | undefined;
|
|
754
|
+
path?: string | undefined;
|
|
755
|
+
jsName?: string | undefined;
|
|
756
|
+
import?: string | undefined;
|
|
716
757
|
}[] | undefined;
|
|
717
758
|
readme?: string | undefined;
|
|
718
759
|
}>;
|
package/dist/types.js
CHANGED
|
@@ -8,7 +8,7 @@ export const AddOnBaseSchema = z.object({
|
|
|
8
8
|
link: z.string().optional(),
|
|
9
9
|
license: z.string().optional(),
|
|
10
10
|
warning: z.string().optional(),
|
|
11
|
-
type: z.enum(['add-on', 'example', 'starter', 'toolchain']),
|
|
11
|
+
type: z.enum(['add-on', 'example', 'starter', 'toolchain', 'host']),
|
|
12
12
|
command: z
|
|
13
13
|
.object({
|
|
14
14
|
command: z.string(),
|
|
@@ -36,6 +36,7 @@ export const AddOnBaseSchema = z.object({
|
|
|
36
36
|
logo: z.string().optional(),
|
|
37
37
|
addOnSpecialSteps: z.array(z.string()).optional(),
|
|
38
38
|
createSpecialSteps: z.array(z.string()).optional(),
|
|
39
|
+
default: z.boolean().optional(),
|
|
39
40
|
});
|
|
40
41
|
export const StarterSchema = AddOnBaseSchema.extend({
|
|
41
42
|
framework: z.string(),
|
|
@@ -49,9 +50,11 @@ export const StarterCompiledSchema = StarterSchema.extend({
|
|
|
49
50
|
deletedFiles: z.array(z.string()),
|
|
50
51
|
});
|
|
51
52
|
export const IntegrationSchema = z.object({
|
|
52
|
-
type: z.string(),
|
|
53
|
-
path: z.string(),
|
|
54
|
-
jsName: z.string(),
|
|
53
|
+
type: z.string().optional(),
|
|
54
|
+
path: z.string().optional(),
|
|
55
|
+
jsName: z.string().optional(),
|
|
56
|
+
import: z.string().optional(),
|
|
57
|
+
code: z.string().optional(),
|
|
55
58
|
});
|
|
56
59
|
export const AddOnInfoSchema = AddOnBaseSchema.extend({
|
|
57
60
|
modes: z.array(z.string()),
|
package/package.json
CHANGED
package/src/create-app.ts
CHANGED
|
@@ -48,7 +48,7 @@ async function writeFiles(environment: Environment, options: Options) {
|
|
|
48
48
|
environment.finishStep('write-framework-files', 'Framework files written')
|
|
49
49
|
|
|
50
50
|
let wroteAddonFiles = false
|
|
51
|
-
for (const type of ['add-on', 'example', 'toolchain']) {
|
|
51
|
+
for (const type of ['add-on', 'example', 'toolchain', 'host']) {
|
|
52
52
|
for (const phase of ['setup', 'add-on', 'example']) {
|
|
53
53
|
for (const addOn of options.chosenAddOns.filter(
|
|
54
54
|
(addOn) => addOn.phase === phase && addOn.type === type,
|
package/src/template-file.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from './package-manager.js'
|
|
10
10
|
import { relativePath } from './file-helpers.js'
|
|
11
11
|
|
|
12
|
-
import type { AddOn, Environment, Options } from './types.js'
|
|
12
|
+
import type { AddOn, Environment, Integration, Options } from './types.js'
|
|
13
13
|
|
|
14
14
|
function convertDotFilesAndPaths(path: string) {
|
|
15
15
|
return path
|
|
@@ -75,6 +75,16 @@ export function createTemplateFile(environment: Environment, options: Options) {
|
|
|
75
75
|
)
|
|
76
76
|
|
|
77
77
|
return async function templateFile(file: string, content: string) {
|
|
78
|
+
const localRelativePath = (path: string, stripExtension: boolean = false) =>
|
|
79
|
+
relativePath(file, path, stripExtension)
|
|
80
|
+
|
|
81
|
+
const integrationImportContent = (integration: Integration) =>
|
|
82
|
+
integration.import ||
|
|
83
|
+
`import ${integration.jsName} from '${localRelativePath(integration.path || '')}'`
|
|
84
|
+
|
|
85
|
+
const integrationImportCode = (integration: Integration) =>
|
|
86
|
+
integration.code || integration.jsName
|
|
87
|
+
|
|
78
88
|
const templateValues = {
|
|
79
89
|
packageManager: options.packageManager,
|
|
80
90
|
projectName: options.projectName,
|
|
@@ -95,6 +105,9 @@ export function createTemplateFile(environment: Environment, options: Options) {
|
|
|
95
105
|
relativePath: (path: string, stripExtension: boolean = false) =>
|
|
96
106
|
relativePath(file, path, stripExtension),
|
|
97
107
|
|
|
108
|
+
integrationImportContent,
|
|
109
|
+
integrationImportCode,
|
|
110
|
+
|
|
98
111
|
ignoreFile: () => {
|
|
99
112
|
throw new IgnoreFileError()
|
|
100
113
|
},
|
package/src/types.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const AddOnBaseSchema = z.object({
|
|
|
18
18
|
link: z.string().optional(),
|
|
19
19
|
license: z.string().optional(),
|
|
20
20
|
warning: z.string().optional(),
|
|
21
|
-
type: z.enum(['add-on', 'example', 'starter', 'toolchain']),
|
|
21
|
+
type: z.enum(['add-on', 'example', 'starter', 'toolchain', 'host']),
|
|
22
22
|
command: z
|
|
23
23
|
.object({
|
|
24
24
|
command: z.string(),
|
|
@@ -48,6 +48,7 @@ export const AddOnBaseSchema = z.object({
|
|
|
48
48
|
logo: z.string().optional(),
|
|
49
49
|
addOnSpecialSteps: z.array(z.string()).optional(),
|
|
50
50
|
createSpecialSteps: z.array(z.string()).optional(),
|
|
51
|
+
default: z.boolean().optional(),
|
|
51
52
|
})
|
|
52
53
|
|
|
53
54
|
export const StarterSchema = AddOnBaseSchema.extend({
|
|
@@ -64,9 +65,11 @@ export const StarterCompiledSchema = StarterSchema.extend({
|
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
export const IntegrationSchema = z.object({
|
|
67
|
-
type: z.string(),
|
|
68
|
-
path: z.string(),
|
|
69
|
-
jsName: z.string(),
|
|
68
|
+
type: z.string().optional(),
|
|
69
|
+
path: z.string().optional(),
|
|
70
|
+
jsName: z.string().optional(),
|
|
71
|
+
import: z.string().optional(),
|
|
72
|
+
code: z.string().optional(),
|
|
70
73
|
})
|
|
71
74
|
|
|
72
75
|
export const AddOnInfoSchema = AddOnBaseSchema.extend({
|