@epic-web/workshop-utils 4.9.2 → 4.10.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.server.d.ts","sourceRoot":"","sources":["../../src/apps.server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,4BAA4B,CAAA;AAKnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAiBvB,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAgBtE,KAAK,gBAAgB,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"apps.server.d.ts","sourceRoot":"","sources":["../../src/apps.server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,4BAA4B,CAAA;AAKnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAiBvB,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAgBtE,KAAK,gBAAgB,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AA+ChE,QAAA,MAAM,yBAAyB;IA/B9B,sCAAsC;;IAEtC,qFAAqF;;IAErF,uIAAuI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BtI,CAAA;AAEF,QAAA,MAAM,gBAAgB;IApCrB,sCAAsC;;IAEtC,qFAAqF;;IAErF,uIAAuI;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAU3C;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,UAInD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGpD;AAED,wBAAsB,aAAa,CAClC,MAAM,EAAE,MAAM,EACd,EAAE,KAAK,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0InC;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,2BAgBzC;AA+BD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,UAmB5D;AAED,wBAAsB,gBAAgB,oBAQrC;AAED,wBAAsB,mBAAmB,oBAExC;AAED,wBAAsB,qBAAqB;;;;eAa1C;AAED,wBAAsB,mBAAmB,oBAOxC;AAED,wBAAsB,mBAAmB,2BAOxC;AAED,wBAAgB,eAAe,WAE9B;AAED,wBAAsB,uBAAuB,CAAC,EAC7C,OAAO,GACP,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;;;;;;;;GAc5B;AAED,wBAAsB,mBAAmB,CAAC,EACzC,OAAO,GACP,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;;;;;;;;GAkB5B;AAID,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,UAK/C"}
|
package/dist/esm/apps.server.js
CHANGED
|
@@ -18,6 +18,18 @@ import { getPkgProp } from './utils.server.js';
|
|
|
18
18
|
process.env.NODE_ENV ??= 'development';
|
|
19
19
|
const workshopRoot = getWorkshopRoot();
|
|
20
20
|
const playgroundAppNameInfoPath = path.join(getWorkshopRoot(), 'node_modules', '.cache', 'epicshop', 'playground.json');
|
|
21
|
+
const StackBlitzConfigSchema = z.object({
|
|
22
|
+
// we default this to `${exerciseTitle} (${type})`
|
|
23
|
+
title: z.string().optional(),
|
|
24
|
+
// stackblitz defaults this to dev automatically
|
|
25
|
+
startScript: z.string().optional(),
|
|
26
|
+
// if no value is provided, then stackblitz defaults this to whatever
|
|
27
|
+
// looks best based on the width of the screen
|
|
28
|
+
view: z
|
|
29
|
+
.union([z.literal('editor'), z.literal('preview'), z.literal('both')])
|
|
30
|
+
.optional(),
|
|
31
|
+
file: z.string().optional(),
|
|
32
|
+
});
|
|
21
33
|
const BaseAppSchema = z.object({
|
|
22
34
|
/** a unique identifier for the app */
|
|
23
35
|
name: z.string(),
|
|
@@ -47,6 +59,7 @@ const BaseAppSchema = z.object({
|
|
|
47
59
|
}),
|
|
48
60
|
z.object({ type: z.literal('none') }),
|
|
49
61
|
]),
|
|
62
|
+
stackBlitzUrl: z.string().nullable(),
|
|
50
63
|
});
|
|
51
64
|
const BaseExerciseStepAppSchema = BaseAppSchema.extend({
|
|
52
65
|
exerciseNumber: z.number(),
|
|
@@ -393,7 +406,7 @@ function getAppName(fullPath) {
|
|
|
393
406
|
if (/playground\/?$/.test(fullPath))
|
|
394
407
|
return 'playground';
|
|
395
408
|
if (/examples\/.+\/?$/.test(fullPath)) {
|
|
396
|
-
const restOfPath = fullPath.replace(`${
|
|
409
|
+
const restOfPath = fullPath.replace(`${workshopRoot}${path.sep}examples${path.sep}`, '');
|
|
397
410
|
return `example.${restOfPath.split(path.sep).join('__sep__')}`;
|
|
398
411
|
}
|
|
399
412
|
const appIdInfo = extractNumbersAndTypeFromAppNameOrPath(fullPath);
|
|
@@ -522,6 +535,32 @@ async function getDevInfo({ fullPath, portNumber, }) {
|
|
|
522
535
|
return { type: 'none' };
|
|
523
536
|
}
|
|
524
537
|
}
|
|
538
|
+
export async function getStackBlitzUrl({ fullPath, title, type, }) {
|
|
539
|
+
const Schema = StackBlitzConfigSchema.nullable().optional();
|
|
540
|
+
const appStackBlitzConfig = Schema.parse(
|
|
541
|
+
// if there's no package.json this will throw. If that's the case, we can't use stackblitz
|
|
542
|
+
// https://discord.com/channels/364486390102097930/1260979618240790578
|
|
543
|
+
await getPkgProp(fullPath, 'epicshop.stackBlitzConfig', {}).catch(() => null));
|
|
544
|
+
if (appStackBlitzConfig === null)
|
|
545
|
+
return null;
|
|
546
|
+
const workshopStackBlitzConfig = Schema.parse(await getPkgProp(workshopRoot, 'epicshop.stackBlitzConfig', {}));
|
|
547
|
+
if (workshopStackBlitzConfig === null)
|
|
548
|
+
return null;
|
|
549
|
+
const githubRootUrlString = await getPkgProp(workshopRoot, 'epicshop.githubRoot', '');
|
|
550
|
+
if (!githubRootUrlString)
|
|
551
|
+
return null;
|
|
552
|
+
const githubRootUrl = new URL(githubRootUrlString);
|
|
553
|
+
const githubPart = githubRootUrl.pathname;
|
|
554
|
+
const config = {
|
|
555
|
+
...workshopStackBlitzConfig,
|
|
556
|
+
...appStackBlitzConfig,
|
|
557
|
+
title: appStackBlitzConfig?.title ?? `${title} (${type})`,
|
|
558
|
+
};
|
|
559
|
+
const params = new URLSearchParams(config);
|
|
560
|
+
const relativePath = fullPath.replace(`${workshopRoot}${path.sep}`, '');
|
|
561
|
+
const stackBlitzUrl = new URL(`/github${githubPart}/${relativePath}?${params}`, 'https://stackblitz.com');
|
|
562
|
+
return stackBlitzUrl.toString();
|
|
563
|
+
}
|
|
525
564
|
export async function getPlaygroundApp({ timings, request, } = {}) {
|
|
526
565
|
const playgroundDir = path.join(workshopRoot, 'playground');
|
|
527
566
|
const baseAppName = await getPlaygroundAppName();
|
|
@@ -557,19 +596,26 @@ export async function getPlaygroundApp({ timings, request, } = {}) {
|
|
|
557
596
|
]);
|
|
558
597
|
const appModifiedTime = await getDirModifiedTime(await getFullPathFromAppName(baseAppName));
|
|
559
598
|
const playgroundAppModifiedTime = await getDirModifiedTime(playgroundDir);
|
|
599
|
+
const type = 'playground';
|
|
600
|
+
const title = compiledReadme?.title ?? name;
|
|
560
601
|
return {
|
|
561
602
|
name,
|
|
562
603
|
appName: baseAppName,
|
|
563
|
-
type
|
|
604
|
+
type,
|
|
564
605
|
isUpToDate: appModifiedTime <= playgroundAppModifiedTime,
|
|
565
606
|
fullPath: playgroundDir,
|
|
566
|
-
relativePath: playgroundDir.replace(`${
|
|
567
|
-
title
|
|
607
|
+
relativePath: playgroundDir.replace(`${workshopRoot}${path.sep}`, ''),
|
|
608
|
+
title,
|
|
568
609
|
epicVideoEmbeds: compiledReadme?.epicVideoEmbeds,
|
|
569
610
|
dirName,
|
|
570
611
|
instructionsCode: compiledReadme?.code,
|
|
571
612
|
test,
|
|
572
613
|
dev,
|
|
614
|
+
stackBlitzUrl: await getStackBlitzUrl({
|
|
615
|
+
fullPath: playgroundDir,
|
|
616
|
+
title,
|
|
617
|
+
type,
|
|
618
|
+
}),
|
|
573
619
|
};
|
|
574
620
|
},
|
|
575
621
|
}).catch((error) => {
|
|
@@ -582,17 +628,24 @@ async function getExampleAppFromPath(fullPath, index, request) {
|
|
|
582
628
|
const compiledReadme = await compileMdxIfExists(path.join(fullPath, 'README.mdx'), { request });
|
|
583
629
|
const name = getAppName(fullPath);
|
|
584
630
|
const portNumber = 8000 + index;
|
|
631
|
+
const type = 'example';
|
|
632
|
+
const title = compiledReadme?.title ?? name;
|
|
585
633
|
return {
|
|
586
634
|
name,
|
|
587
|
-
type
|
|
635
|
+
type,
|
|
588
636
|
fullPath,
|
|
589
|
-
relativePath: fullPath.replace(`${
|
|
590
|
-
title
|
|
637
|
+
relativePath: fullPath.replace(`${workshopRoot}${path.sep}`, ''),
|
|
638
|
+
title,
|
|
591
639
|
epicVideoEmbeds: compiledReadme?.epicVideoEmbeds,
|
|
592
640
|
dirName,
|
|
593
641
|
instructionsCode: compiledReadme?.code,
|
|
594
642
|
test: await getTestInfo({ fullPath }),
|
|
595
643
|
dev: await getDevInfo({ fullPath, portNumber }),
|
|
644
|
+
stackBlitzUrl: await getStackBlitzUrl({
|
|
645
|
+
fullPath,
|
|
646
|
+
title,
|
|
647
|
+
type,
|
|
648
|
+
}),
|
|
596
649
|
};
|
|
597
650
|
}
|
|
598
651
|
async function getExampleApps({ timings, request, } = {}) {
|
|
@@ -641,9 +694,10 @@ async function getSolutionAppFromPath(fullPath, request) {
|
|
|
641
694
|
getTestInfo({ fullPath }),
|
|
642
695
|
getDevInfo({ fullPath, portNumber }),
|
|
643
696
|
]);
|
|
697
|
+
const title = compiledReadme?.title ?? name;
|
|
644
698
|
return {
|
|
645
699
|
name,
|
|
646
|
-
title
|
|
700
|
+
title,
|
|
647
701
|
epicVideoEmbeds: compiledReadme?.epicVideoEmbeds,
|
|
648
702
|
type: 'solution',
|
|
649
703
|
problemName,
|
|
@@ -651,10 +705,15 @@ async function getSolutionAppFromPath(fullPath, request) {
|
|
|
651
705
|
stepNumber,
|
|
652
706
|
dirName,
|
|
653
707
|
fullPath,
|
|
654
|
-
relativePath: fullPath.replace(`${
|
|
708
|
+
relativePath: fullPath.replace(`${workshopRoot}${path.sep}`, ''),
|
|
655
709
|
instructionsCode: compiledReadme?.code,
|
|
656
710
|
test,
|
|
657
711
|
dev,
|
|
712
|
+
stackBlitzUrl: await getStackBlitzUrl({
|
|
713
|
+
fullPath,
|
|
714
|
+
title,
|
|
715
|
+
type: 'solution',
|
|
716
|
+
}),
|
|
658
717
|
};
|
|
659
718
|
}
|
|
660
719
|
async function getSolutionApps({ timings, request, } = {}) {
|
|
@@ -701,20 +760,26 @@ async function getProblemAppFromPath(fullPath, request) {
|
|
|
701
760
|
getTestInfo({ fullPath }),
|
|
702
761
|
getDevInfo({ fullPath, portNumber }),
|
|
703
762
|
]);
|
|
763
|
+
const title = compiledReadme?.title ?? name;
|
|
704
764
|
return {
|
|
705
765
|
solutionName,
|
|
706
766
|
name,
|
|
707
|
-
title
|
|
767
|
+
title,
|
|
708
768
|
epicVideoEmbeds: compiledReadme?.epicVideoEmbeds,
|
|
709
769
|
type: 'problem',
|
|
710
770
|
exerciseNumber,
|
|
711
771
|
stepNumber,
|
|
712
772
|
dirName,
|
|
713
773
|
fullPath,
|
|
714
|
-
relativePath: fullPath.replace(`${
|
|
774
|
+
relativePath: fullPath.replace(`${workshopRoot}${path.sep}`, ''),
|
|
715
775
|
instructionsCode: compiledReadme?.code,
|
|
716
776
|
test,
|
|
717
777
|
dev,
|
|
778
|
+
stackBlitzUrl: await getStackBlitzUrl({
|
|
779
|
+
fullPath,
|
|
780
|
+
title,
|
|
781
|
+
type: 'problem',
|
|
782
|
+
}),
|
|
718
783
|
};
|
|
719
784
|
}
|
|
720
785
|
async function getProblemApps({ timings, request, } = {}) {
|
|
@@ -821,7 +886,6 @@ export async function getAppFromFile(filePath) {
|
|
|
821
886
|
}
|
|
822
887
|
export async function setPlayground(srcDir, { reset } = {}) {
|
|
823
888
|
const isIgnored = await isGitIgnored({ cwd: srcDir });
|
|
824
|
-
const workshopRoot = getWorkshopRoot();
|
|
825
889
|
const destDir = path.join(workshopRoot, 'playground');
|
|
826
890
|
const playgroundFiles = path.join(destDir, '**');
|
|
827
891
|
getOptionalWatcher()?.unwatch(playgroundFiles);
|
|
@@ -1023,7 +1087,7 @@ export async function getWorkshopInstructor() {
|
|
|
1023
1087
|
𝕏: z.string().optional(),
|
|
1024
1088
|
})
|
|
1025
1089
|
.optional();
|
|
1026
|
-
const instructor = InstructorSchema.parse(await getPkgProp(
|
|
1090
|
+
const instructor = InstructorSchema.parse(await getPkgProp(workshopRoot, 'epicshop.instructor'));
|
|
1027
1091
|
return instructor;
|
|
1028
1092
|
}
|
|
1029
1093
|
export async function getEpicWorkshopHost() {
|