@epic-web/workshop-utils 5.13.6 → 5.14.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/esm/apps.server.d.ts +9 -2
- package/dist/esm/apps.server.d.ts.map +1 -1
- package/dist/esm/apps.server.js +57 -45
- package/dist/esm/apps.server.js.map +1 -1
- package/dist/esm/config.server.d.ts +1 -1
- package/dist/esm/config.server.d.ts.map +1 -1
- package/dist/esm/config.server.js +6 -6
- package/dist/esm/config.server.js.map +1 -1
- package/dist/esm/diff.server.js +5 -5
- package/dist/esm/diff.server.js.map +1 -1
- package/dist/esm/epic-api.server.d.ts +1 -1
- package/dist/esm/epic-api.server.d.ts.map +1 -1
- package/dist/esm/epic-api.server.js +1 -1
- package/dist/esm/epic-api.server.js.map +1 -1
- package/dist/esm/git.server.d.ts.map +1 -1
- package/dist/esm/git.server.js +6 -2
- package/dist/esm/git.server.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,8 @@ import { type Timings } from './timing.server.js';
|
|
|
5
5
|
declare global {
|
|
6
6
|
var __epicshop_apps_initialized__: boolean | undefined;
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
8
|
+
export declare function setWorkshopRoot(root?: string): void;
|
|
9
|
+
export declare function getWorkshopRoot(): string;
|
|
9
10
|
type CachifiedOptions = {
|
|
10
11
|
timings?: Timings;
|
|
11
12
|
request?: Request;
|
|
@@ -695,6 +696,8 @@ declare const PlaygroundAppSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
695
696
|
epicVideoEmbeds?: string[] | undefined;
|
|
696
697
|
}>;
|
|
697
698
|
declare const ExerciseSchema: z.ZodObject<{
|
|
699
|
+
/** the full path to the exercise directory */
|
|
700
|
+
fullPath: z.ZodString;
|
|
698
701
|
/** a unique identifier for the exercise */
|
|
699
702
|
exerciseNumber: z.ZodNumber;
|
|
700
703
|
/** used when displaying the list of files to match the list of apps in the file system (comes the name of the directory of the app) */
|
|
@@ -1851,6 +1854,7 @@ declare const ExerciseSchema: z.ZodObject<{
|
|
|
1851
1854
|
}, "strip", z.ZodTypeAny, {
|
|
1852
1855
|
title: string;
|
|
1853
1856
|
dirName: string;
|
|
1857
|
+
fullPath: string;
|
|
1854
1858
|
exerciseNumber: number;
|
|
1855
1859
|
steps: ({
|
|
1856
1860
|
stepNumber: number;
|
|
@@ -2072,6 +2076,7 @@ declare const ExerciseSchema: z.ZodObject<{
|
|
|
2072
2076
|
}, {
|
|
2073
2077
|
title: string;
|
|
2074
2078
|
dirName: string;
|
|
2079
|
+
fullPath: string;
|
|
2075
2080
|
exerciseNumber: number;
|
|
2076
2081
|
steps: ({
|
|
2077
2082
|
stepNumber: number;
|
|
@@ -3141,7 +3146,7 @@ export declare function isPlaygroundApp(app: any): app is PlaygroundApp;
|
|
|
3141
3146
|
export declare function isExampleApp(app: any): app is ExampleApp;
|
|
3142
3147
|
export declare function isExerciseStepApp(app: any): app is ExerciseStepApp;
|
|
3143
3148
|
export declare const modifiedTimes: Map<string, number>;
|
|
3144
|
-
export declare function init(): Promise<void>;
|
|
3149
|
+
export declare function init(workshopRoot?: string): Promise<void>;
|
|
3145
3150
|
export declare function setModifiedTimesForAppDirs(...filePaths: Array<string>): void;
|
|
3146
3151
|
export declare function getForceFreshForDir(cacheEntry: CacheEntry | null | undefined, ...dirs: Array<string | undefined | null>): true | undefined;
|
|
3147
3152
|
export declare function getExercises({ timings, request, }?: CachifiedOptions): Promise<Array<Exercise>>;
|
|
@@ -3171,6 +3176,7 @@ export declare function getPlaygroundApp({ timings, request, }?: CachifiedOption
|
|
|
3171
3176
|
export declare function getExercise(exerciseNumber: number | string, { request, timings }?: CachifiedOptions): Promise<{
|
|
3172
3177
|
title: string;
|
|
3173
3178
|
dirName: string;
|
|
3179
|
+
fullPath: string;
|
|
3174
3180
|
exerciseNumber: number;
|
|
3175
3181
|
steps: ({
|
|
3176
3182
|
stepNumber: number;
|
|
@@ -3393,6 +3399,7 @@ export declare function getExercise(exerciseNumber: number | string, { request,
|
|
|
3393
3399
|
export declare function requireExercise(exerciseNumber: number | string, { request, timings }?: CachifiedOptions): Promise<{
|
|
3394
3400
|
title: string;
|
|
3395
3401
|
dirName: string;
|
|
3402
|
+
fullPath: string;
|
|
3396
3403
|
exerciseNumber: number;
|
|
3397
3404
|
steps: ({
|
|
3398
3405
|
stepNumber: number;
|
|
@@ -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;AAKrD,OAAO,4BAA4B,CAAA;AAKnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwBvB,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAI5E,OAAO,CAAC,MAAM,CAAC;IACd,IAAI,6BAA6B,EAAE,OAAO,GAAG,SAAS,CAAA;CACtD;AAGD,
|
|
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;AAKrD,OAAO,4BAA4B,CAAA;AAKnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwBvB,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAI5E,OAAO,CAAC,MAAM,CAAC;IACd,IAAI,6BAA6B,EAAE,OAAO,GAAG,SAAS,CAAA;CACtD;AAGD,wBAAgB,eAAe,CAC9B,IAAI,GAAE,MAA0D,QAGhE;AAED,wBAAgB,eAAe,WAI9B;AAYD,KAAK,gBAAgB,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAkChE,QAAA,MAAM,yBAAyB;IA/B9B,sCAAsC;;IAEtC,qFA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OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,UAmB5D;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;;;;;;;;;;;;GAsB5B;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,UAQ/C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2BtE"}
|
package/dist/esm/apps.server.js
CHANGED
|
@@ -21,9 +21,17 @@ import { getServerTimeHeader, time } from './timing.server.js';
|
|
|
21
21
|
import { getErrorMessage } from './utils.js';
|
|
22
22
|
import { dayjs } from './utils.server.js';
|
|
23
23
|
global.__epicshop_apps_initialized__ ??= false;
|
|
24
|
-
export
|
|
25
|
-
process.env.EPICSHOP_CONTEXT_CWD
|
|
26
|
-
|
|
24
|
+
export function setWorkshopRoot(root = process.env.EPICSHOP_CONTEXT_CWD ?? process.cwd()) {
|
|
25
|
+
process.env.EPICSHOP_CONTEXT_CWD = root;
|
|
26
|
+
}
|
|
27
|
+
export function getWorkshopRoot() {
|
|
28
|
+
if (!process.env.EPICSHOP_CONTEXT_CWD)
|
|
29
|
+
setWorkshopRoot();
|
|
30
|
+
return process.env.EPICSHOP_CONTEXT_CWD;
|
|
31
|
+
}
|
|
32
|
+
function getPlaygroundAppNameInfoPath() {
|
|
33
|
+
return path.join(getWorkshopRoot(), 'node_modules', '.cache', 'epicshop', 'playground.json');
|
|
34
|
+
}
|
|
27
35
|
const BaseAppSchema = z.object({
|
|
28
36
|
/** a unique identifier for the app */
|
|
29
37
|
name: z.string(),
|
|
@@ -76,6 +84,8 @@ const PlaygroundAppSchema = BaseAppSchema.extend({
|
|
|
76
84
|
isUpToDate: z.boolean(),
|
|
77
85
|
});
|
|
78
86
|
const ExerciseSchema = z.object({
|
|
87
|
+
/** the full path to the exercise directory */
|
|
88
|
+
fullPath: z.string(),
|
|
79
89
|
/** a unique identifier for the exercise */
|
|
80
90
|
exerciseNumber: z.number(),
|
|
81
91
|
/** used when displaying the list of files to match the list of apps in the file system (comes the name of the directory of the app) */
|
|
@@ -145,7 +155,8 @@ async function firstToExist(...files) {
|
|
|
145
155
|
return index === -1 ? null : files[index];
|
|
146
156
|
}
|
|
147
157
|
export const modifiedTimes = remember('modified_times', () => new Map());
|
|
148
|
-
export async function init() {
|
|
158
|
+
export async function init(workshopRoot) {
|
|
159
|
+
setWorkshopRoot(workshopRoot);
|
|
149
160
|
if (global.__epicshop_apps_initialized__)
|
|
150
161
|
return;
|
|
151
162
|
global.__epicshop_apps_initialized__ = true;
|
|
@@ -156,11 +167,11 @@ export async function init() {
|
|
|
156
167
|
global.ENV = getEnv();
|
|
157
168
|
if (!ENV.EPICSHOP_DEPLOYED &&
|
|
158
169
|
process.env.EPICSHOP_ENABLE_WATCHER === 'true') {
|
|
159
|
-
const isIgnored = await isGitIgnored({ cwd:
|
|
170
|
+
const isIgnored = await isGitIgnored({ cwd: getWorkshopRoot() });
|
|
160
171
|
// watch the README, FINISHED, and package.json for changes that affect the apps
|
|
161
172
|
const filesToWatch = ['README.mdx', 'FINISHED.mdx', 'package.json'];
|
|
162
173
|
const chok = chokidar.watch(['examples', 'playground', 'exercises'], {
|
|
163
|
-
cwd:
|
|
174
|
+
cwd: getWorkshopRoot(),
|
|
164
175
|
ignoreInitial: true,
|
|
165
176
|
ignored(filePath, stats) {
|
|
166
177
|
if (isIgnored(filePath))
|
|
@@ -190,7 +201,7 @@ export async function init() {
|
|
|
190
201
|
},
|
|
191
202
|
});
|
|
192
203
|
chok.on('all', (_event, filePath) => {
|
|
193
|
-
setModifiedTimesForAppDirs(path.join(
|
|
204
|
+
setModifiedTimesForAppDirs(path.join(getWorkshopRoot(), filePath));
|
|
194
205
|
});
|
|
195
206
|
closeWithGrace(() => chok.close());
|
|
196
207
|
}
|
|
@@ -274,14 +285,14 @@ function extractExerciseNumber(dir) {
|
|
|
274
285
|
}
|
|
275
286
|
export async function getExercises({ timings, request, } = {}) {
|
|
276
287
|
const apps = await getApps({ request, timings });
|
|
277
|
-
const exerciseDirs = await readDir(path.join(
|
|
288
|
+
const exerciseDirs = await readDir(path.join(getWorkshopRoot(), 'exercises'));
|
|
278
289
|
const exercises = [];
|
|
279
290
|
for (const dirName of exerciseDirs) {
|
|
280
291
|
const exerciseNumber = extractExerciseNumber(dirName);
|
|
281
292
|
if (!exerciseNumber)
|
|
282
293
|
continue;
|
|
283
|
-
const compiledReadme = await compileMdxIfExists(path.join(
|
|
284
|
-
const compiledFinished = await compileMdxIfExists(path.join(
|
|
294
|
+
const compiledReadme = await compileMdxIfExists(path.join(getWorkshopRoot(), 'exercises', dirName, 'README.mdx'), { request });
|
|
295
|
+
const compiledFinished = await compileMdxIfExists(path.join(getWorkshopRoot(), 'exercises', dirName, 'FINISHED.mdx'), { request });
|
|
285
296
|
const steps = [];
|
|
286
297
|
const exerciseApps = apps
|
|
287
298
|
.filter(isExerciseStepApp)
|
|
@@ -295,6 +306,7 @@ export async function getExercises({ timings, request, } = {}) {
|
|
|
295
306
|
};
|
|
296
307
|
}
|
|
297
308
|
const exercise = ExerciseSchema.parse({
|
|
309
|
+
fullPath: path.join(getWorkshopRoot(), 'exercises', dirName),
|
|
298
310
|
exerciseNumber,
|
|
299
311
|
dirName,
|
|
300
312
|
instructionsCode: compiledReadme?.code,
|
|
@@ -419,7 +431,7 @@ const AppIdInfoSchema = z.object({
|
|
|
419
431
|
export function extractNumbersAndTypeFromAppNameOrPath(fullPathOrAppName) {
|
|
420
432
|
const info = {};
|
|
421
433
|
if (fullPathOrAppName.includes(path.sep)) {
|
|
422
|
-
const relativePath = fullPathOrAppName.replace(path.join(
|
|
434
|
+
const relativePath = fullPathOrAppName.replace(path.join(getWorkshopRoot(), 'exercises', path.sep), '');
|
|
423
435
|
const [exerciseNumberPart, stepNumberPart] = relativePath.split(path.sep);
|
|
424
436
|
if (!exerciseNumberPart || !stepNumberPart)
|
|
425
437
|
return null;
|
|
@@ -442,7 +454,7 @@ export function extractNumbersAndTypeFromAppNameOrPath(fullPathOrAppName) {
|
|
|
442
454
|
return null;
|
|
443
455
|
}
|
|
444
456
|
async function getProblemDirs() {
|
|
445
|
-
const exercisesDir = path.join(
|
|
457
|
+
const exercisesDir = path.join(getWorkshopRoot(), 'exercises');
|
|
446
458
|
const problemDirs = [];
|
|
447
459
|
const exerciseSubDirs = await readDir(exercisesDir);
|
|
448
460
|
for (const subDir of exerciseSubDirs) {
|
|
@@ -460,7 +472,7 @@ async function getProblemDirs() {
|
|
|
460
472
|
return problemDirs;
|
|
461
473
|
}
|
|
462
474
|
async function getSolutionDirs() {
|
|
463
|
-
const exercisesDir = path.join(
|
|
475
|
+
const exercisesDir = path.join(getWorkshopRoot(), 'exercises');
|
|
464
476
|
const solutionDirs = [];
|
|
465
477
|
const exerciseSubDirs = await readDir(exercisesDir);
|
|
466
478
|
for (const subDir of exerciseSubDirs) {
|
|
@@ -488,7 +500,7 @@ function getAppName(fullPath) {
|
|
|
488
500
|
if (/playground\/?$/.test(fullPath))
|
|
489
501
|
return 'playground';
|
|
490
502
|
if (/examples\/.+\/?$/.test(fullPath)) {
|
|
491
|
-
const restOfPath = fullPath.replace(`${
|
|
503
|
+
const restOfPath = fullPath.replace(`${getWorkshopRoot()}${path.sep}examples${path.sep}`, '');
|
|
492
504
|
return `example.${restOfPath.split(path.sep).join('__sep__')}`;
|
|
493
505
|
}
|
|
494
506
|
const appIdInfo = extractNumbersAndTypeFromAppNameOrPath(fullPath);
|
|
@@ -497,23 +509,23 @@ function getAppName(fullPath) {
|
|
|
497
509
|
return `${exerciseNumber}.${stepNumber}.${type}`;
|
|
498
510
|
}
|
|
499
511
|
else {
|
|
500
|
-
const relativePath = fullPath.replace(`${
|
|
512
|
+
const relativePath = fullPath.replace(`${getWorkshopRoot()}${path.sep}`, '');
|
|
501
513
|
return relativePath.split(path.sep).join('__sep__');
|
|
502
514
|
}
|
|
503
515
|
}
|
|
504
516
|
export async function getFullPathFromAppName(appName) {
|
|
505
517
|
if (appName === 'playground')
|
|
506
|
-
return path.join(
|
|
518
|
+
return path.join(getWorkshopRoot(), 'playground');
|
|
507
519
|
if (appName.startsWith('.example')) {
|
|
508
520
|
const relativePath = appName
|
|
509
521
|
.replace('.example', '')
|
|
510
522
|
.split('__sep__')
|
|
511
523
|
.join(path.sep);
|
|
512
|
-
return path.join(
|
|
524
|
+
return path.join(getWorkshopRoot(), 'examples', relativePath);
|
|
513
525
|
}
|
|
514
526
|
if (appName.includes('__sep__')) {
|
|
515
527
|
const relativePath = appName.replaceAll('__sep__', path.sep);
|
|
516
|
-
return path.join(
|
|
528
|
+
return path.join(getWorkshopRoot(), relativePath);
|
|
517
529
|
}
|
|
518
530
|
const [exerciseNumber, stepNumber, type] = appName.split('.');
|
|
519
531
|
const appDirs = type === 'problem'
|
|
@@ -612,7 +624,7 @@ async function getDevInfo({ fullPath, portNumber, }) {
|
|
|
612
624
|
}
|
|
613
625
|
}
|
|
614
626
|
export async function getPlaygroundApp({ timings, request, } = {}) {
|
|
615
|
-
const playgroundDir = path.join(
|
|
627
|
+
const playgroundDir = path.join(getWorkshopRoot(), 'playground');
|
|
616
628
|
const baseAppName = await getPlaygroundAppName();
|
|
617
629
|
const key = `playground-${baseAppName}`;
|
|
618
630
|
const baseAppFullPath = baseAppName
|
|
@@ -650,7 +662,7 @@ export async function getPlaygroundApp({ timings, request, } = {}) {
|
|
|
650
662
|
type,
|
|
651
663
|
isUpToDate: appModifiedTime <= playgroundAppModifiedTime,
|
|
652
664
|
fullPath: playgroundDir,
|
|
653
|
-
relativePath: playgroundDir.replace(`${
|
|
665
|
+
relativePath: playgroundDir.replace(`${getWorkshopRoot()}${path.sep}`, ''),
|
|
654
666
|
title,
|
|
655
667
|
epicVideoEmbeds: compiledReadme?.epicVideoEmbeds,
|
|
656
668
|
dirName,
|
|
@@ -680,7 +692,7 @@ async function getExampleAppFromPath(fullPath, index, request) {
|
|
|
680
692
|
name,
|
|
681
693
|
type,
|
|
682
694
|
fullPath,
|
|
683
|
-
relativePath: fullPath.replace(`${
|
|
695
|
+
relativePath: fullPath.replace(`${getWorkshopRoot()}${path.sep}`, ''),
|
|
684
696
|
title,
|
|
685
697
|
epicVideoEmbeds: compiledReadme?.epicVideoEmbeds,
|
|
686
698
|
dirName,
|
|
@@ -695,7 +707,7 @@ async function getExampleAppFromPath(fullPath, index, request) {
|
|
|
695
707
|
};
|
|
696
708
|
}
|
|
697
709
|
async function getExampleApps({ timings, request, } = {}) {
|
|
698
|
-
const examplesDir = path.join(
|
|
710
|
+
const examplesDir = path.join(getWorkshopRoot(), 'examples');
|
|
699
711
|
const exampleDirs = (await readDir(examplesDir)).map((p) => path.join(examplesDir, p));
|
|
700
712
|
const exampleApps = [];
|
|
701
713
|
for (const exampleDir of exampleDirs) {
|
|
@@ -753,7 +765,7 @@ async function getSolutionAppFromPath(fullPath, request) {
|
|
|
753
765
|
stepNumber,
|
|
754
766
|
dirName,
|
|
755
767
|
fullPath,
|
|
756
|
-
relativePath: fullPath.replace(`${
|
|
768
|
+
relativePath: fullPath.replace(`${getWorkshopRoot()}${path.sep}`, ''),
|
|
757
769
|
instructionsCode: compiledReadme?.code,
|
|
758
770
|
test,
|
|
759
771
|
dev,
|
|
@@ -765,7 +777,7 @@ async function getSolutionAppFromPath(fullPath, request) {
|
|
|
765
777
|
};
|
|
766
778
|
}
|
|
767
779
|
async function getSolutionApps({ timings, request, } = {}) {
|
|
768
|
-
const exercisesDir = path.join(
|
|
780
|
+
const exercisesDir = path.join(getWorkshopRoot(), 'exercises');
|
|
769
781
|
const solutionDirs = await getSolutionDirs();
|
|
770
782
|
const solutionApps = [];
|
|
771
783
|
for (const solutionDir of solutionDirs) {
|
|
@@ -821,7 +833,7 @@ async function getProblemAppFromPath(fullPath, request) {
|
|
|
821
833
|
stepNumber,
|
|
822
834
|
dirName,
|
|
823
835
|
fullPath,
|
|
824
|
-
relativePath: fullPath.replace(`${
|
|
836
|
+
relativePath: fullPath.replace(`${getWorkshopRoot()}${path.sep}`, ''),
|
|
825
837
|
instructionsCode: compiledReadme?.code,
|
|
826
838
|
test,
|
|
827
839
|
dev,
|
|
@@ -833,7 +845,7 @@ async function getProblemAppFromPath(fullPath, request) {
|
|
|
833
845
|
};
|
|
834
846
|
}
|
|
835
847
|
async function getProblemApps({ timings, request, } = {}) {
|
|
836
|
-
const exercisesDir = path.join(
|
|
848
|
+
const exercisesDir = path.join(getWorkshopRoot(), 'exercises');
|
|
837
849
|
const problemDirs = await getProblemDirs();
|
|
838
850
|
const problemApps = [];
|
|
839
851
|
for (const problemDir of problemDirs) {
|
|
@@ -950,8 +962,8 @@ export async function savePlayground() {
|
|
|
950
962
|
const playgroundApp = await getAppByName('playground');
|
|
951
963
|
invariant(playgroundApp, 'app with name "playground" does not exist');
|
|
952
964
|
invariant(isPlaygroundApp(playgroundApp), 'app with name "playground" exists, but it is not a playground type app');
|
|
953
|
-
const playgroundDir = path.join(
|
|
954
|
-
const savedPlaygroundsDir = path.join(
|
|
965
|
+
const playgroundDir = path.join(getWorkshopRoot(), 'playground');
|
|
966
|
+
const savedPlaygroundsDir = path.join(getWorkshopRoot(), 'saved-playgrounds');
|
|
955
967
|
await fsExtra.ensureDir(savedPlaygroundsDir);
|
|
956
968
|
const now = dayjs();
|
|
957
969
|
// note: the format must be filename safe
|
|
@@ -973,7 +985,7 @@ locally and uncheck "Enable saving playground."
|
|
|
973
985
|
export async function setPlayground(srcDir, { reset } = {}) {
|
|
974
986
|
const preferences = await getPreferences();
|
|
975
987
|
const playgroundApp = await getAppByName('playground');
|
|
976
|
-
const playgroundDir = path.join(
|
|
988
|
+
const playgroundDir = path.join(getWorkshopRoot(), 'playground');
|
|
977
989
|
if (playgroundApp && preferences?.playground?.persist) {
|
|
978
990
|
await savePlayground();
|
|
979
991
|
}
|
|
@@ -987,10 +999,10 @@ export async function setPlayground(srcDir, { reset } = {}) {
|
|
|
987
999
|
}
|
|
988
1000
|
const setPlaygroundTimestamp = Date.now();
|
|
989
1001
|
// run prepare-playground script if it exists
|
|
990
|
-
const preSetPlaygroundPath = await firstToExist(path.join(srcDir, 'epicshop', 'pre-set-playground.js'), path.join(
|
|
1002
|
+
const preSetPlaygroundPath = await firstToExist(path.join(srcDir, 'epicshop', 'pre-set-playground.js'), path.join(getWorkshopRoot(), 'epicshop', 'pre-set-playground.js'));
|
|
991
1003
|
if (preSetPlaygroundPath) {
|
|
992
1004
|
await execa('node', [preSetPlaygroundPath], {
|
|
993
|
-
cwd:
|
|
1005
|
+
cwd: getWorkshopRoot(),
|
|
994
1006
|
stdio: 'inherit',
|
|
995
1007
|
env: {
|
|
996
1008
|
EPICSHOP_PLAYGROUND_TIMESTAMP: setPlaygroundTimestamp.toString(),
|
|
@@ -1063,17 +1075,17 @@ export async function setPlayground(srcDir, { reset } = {}) {
|
|
|
1063
1075
|
await fsExtra.remove(path.join(playgroundDir, fileToDelete));
|
|
1064
1076
|
}
|
|
1065
1077
|
const appName = getAppName(srcDir);
|
|
1066
|
-
await fsExtra.ensureDir(path.dirname(
|
|
1067
|
-
await fsExtra.writeJSON(
|
|
1078
|
+
await fsExtra.ensureDir(path.dirname(getPlaygroundAppNameInfoPath()));
|
|
1079
|
+
await fsExtra.writeJSON(getPlaygroundAppNameInfoPath(), { appName });
|
|
1068
1080
|
const playgroundIsStillRunning = playgroundApp
|
|
1069
1081
|
? isAppRunning(playgroundApp)
|
|
1070
1082
|
: false;
|
|
1071
1083
|
const restartPlayground = playgroundWasRunning && !playgroundIsStillRunning;
|
|
1072
1084
|
// run postSet-playground script if it exists
|
|
1073
|
-
const postSetPlaygroundPath = await firstToExist(path.join(srcDir, 'epicshop', 'post-set-playground.js'), path.join(
|
|
1085
|
+
const postSetPlaygroundPath = await firstToExist(path.join(srcDir, 'epicshop', 'post-set-playground.js'), path.join(getWorkshopRoot(), 'epicshop', 'post-set-playground.js'));
|
|
1074
1086
|
if (postSetPlaygroundPath) {
|
|
1075
1087
|
await execa('node', [postSetPlaygroundPath], {
|
|
1076
|
-
cwd:
|
|
1088
|
+
cwd: getWorkshopRoot(),
|
|
1077
1089
|
stdio: 'inherit',
|
|
1078
1090
|
env: {
|
|
1079
1091
|
EPICSHOP_PLAYGROUND_TIMESTAMP: setPlaygroundTimestamp.toString(),
|
|
@@ -1097,11 +1109,11 @@ export async function setPlayground(srcDir, { reset } = {}) {
|
|
|
1097
1109
|
* is based on.
|
|
1098
1110
|
*/
|
|
1099
1111
|
export async function getPlaygroundAppName() {
|
|
1100
|
-
if (!(await exists(
|
|
1112
|
+
if (!(await exists(getPlaygroundAppNameInfoPath()))) {
|
|
1101
1113
|
return null;
|
|
1102
1114
|
}
|
|
1103
1115
|
try {
|
|
1104
|
-
const jsonString = await fs.promises.readFile(
|
|
1116
|
+
const jsonString = await fs.promises.readFile(getPlaygroundAppNameInfoPath(), 'utf8');
|
|
1105
1117
|
const { appName } = JSON.parse(jsonString);
|
|
1106
1118
|
if (typeof appName !== 'string')
|
|
1107
1119
|
return null;
|
|
@@ -1133,7 +1145,7 @@ export function getAppDisplayName(a, allApps) {
|
|
|
1133
1145
|
return displayName;
|
|
1134
1146
|
}
|
|
1135
1147
|
export async function getWorkshopInstructions({ request, } = {}) {
|
|
1136
|
-
const readmeFilepath = path.join(
|
|
1148
|
+
const readmeFilepath = path.join(getWorkshopRoot(), 'exercises', 'README.mdx');
|
|
1137
1149
|
const compiled = await compileMdx(readmeFilepath, { request }).then((r) => ({ ...r, status: 'success' }), (e) => {
|
|
1138
1150
|
console.error(`There was an error compiling the workshop readme`, readmeFilepath, e);
|
|
1139
1151
|
return { status: 'error', error: getErrorMessage(e) };
|
|
@@ -1141,7 +1153,7 @@ export async function getWorkshopInstructions({ request, } = {}) {
|
|
|
1141
1153
|
return { compiled, file: readmeFilepath, relativePath: 'exercises' };
|
|
1142
1154
|
}
|
|
1143
1155
|
export async function getWorkshopFinished({ request, } = {}) {
|
|
1144
|
-
const finishedFilepath = path.join(
|
|
1156
|
+
const finishedFilepath = path.join(getWorkshopRoot(), 'exercises', 'FINISHED.mdx');
|
|
1145
1157
|
const compiled = await compileMdx(finishedFilepath, { request }).then((r) => ({ ...r, status: 'success' }), (e) => {
|
|
1146
1158
|
console.error(`There was an error compiling the workshop finished.mdx`, finishedFilepath, e);
|
|
1147
1159
|
return { status: 'error', error: getErrorMessage(e) };
|
|
@@ -1152,9 +1164,9 @@ export async function getWorkshopFinished({ request, } = {}) {
|
|
|
1152
1164
|
relativePath: 'exercises/finished.mdx',
|
|
1153
1165
|
};
|
|
1154
1166
|
}
|
|
1155
|
-
const exercisesPath = path.join(workshopRoot, 'exercises/');
|
|
1156
|
-
const playgroundPath = path.join(workshopRoot, 'playground/');
|
|
1157
1167
|
export function getRelativePath(filePath) {
|
|
1168
|
+
const exercisesPath = path.join(getWorkshopRoot(), 'exercises/');
|
|
1169
|
+
const playgroundPath = path.join(getWorkshopRoot(), 'playground/');
|
|
1158
1170
|
return path
|
|
1159
1171
|
.normalize(filePath.replace(/^("|')|("|')$/g, ''))
|
|
1160
1172
|
.replace(playgroundPath, `playground${path.sep}`)
|
|
@@ -1164,7 +1176,7 @@ export function getRelativePath(filePath) {
|
|
|
1164
1176
|
* Given a file path, this will determine the path to the app that file belongs to.
|
|
1165
1177
|
*/
|
|
1166
1178
|
export function getAppPathFromFilePath(filePath) {
|
|
1167
|
-
const [, withinWorkshopRootHalf] = filePath.split(
|
|
1179
|
+
const [, withinWorkshopRootHalf] = filePath.split(getWorkshopRoot());
|
|
1168
1180
|
if (!withinWorkshopRootHalf) {
|
|
1169
1181
|
return null;
|
|
1170
1182
|
}
|
|
@@ -1173,15 +1185,15 @@ export function getAppPathFromFilePath(filePath) {
|
|
|
1173
1185
|
.filter(Boolean);
|
|
1174
1186
|
// Check if the file is in the playground
|
|
1175
1187
|
if (part1 === 'playground') {
|
|
1176
|
-
return path.join(
|
|
1188
|
+
return path.join(getWorkshopRoot(), 'playground');
|
|
1177
1189
|
}
|
|
1178
1190
|
// Check if the file is in an example
|
|
1179
1191
|
if (part1 === 'examples' && part2) {
|
|
1180
|
-
return path.join(
|
|
1192
|
+
return path.join(getWorkshopRoot(), 'examples', part2);
|
|
1181
1193
|
}
|
|
1182
1194
|
// Check if the file is in an exercise
|
|
1183
1195
|
if (part1 === 'exercises' && part2 && part3) {
|
|
1184
|
-
return path.join(
|
|
1196
|
+
return path.join(getWorkshopRoot(), 'exercises', part2, part3);
|
|
1185
1197
|
}
|
|
1186
1198
|
// If we couldn't determine the app path, return null
|
|
1187
1199
|
return null;
|