@epic-web/workshop-utils 4.21.1 → 4.22.0
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 +0 -15
- package/dist/esm/apps.server.d.ts.map +1 -1
- package/dist/esm/apps.server.js +11 -122
- package/dist/esm/apps.server.js.map +1 -1
- package/dist/esm/config.server.d.ts +172 -0
- package/dist/esm/config.server.d.ts.map +1 -0
- package/dist/esm/config.server.js +193 -0
- package/dist/esm/config.server.js.map +1 -0
- package/dist/esm/db.server.d.ts +7 -7
- package/dist/esm/db.server.d.ts.map +1 -1
- package/dist/esm/db.server.js +13 -4
- package/dist/esm/db.server.js.map +1 -1
- package/dist/esm/git.server.d.ts.map +1 -1
- package/dist/esm/git.server.js +3 -2
- package/dist/esm/git.server.js.map +1 -1
- package/dist/esm/utils.server.d.ts +0 -1
- package/dist/esm/utils.server.d.ts.map +1 -1
- package/dist/esm/utils.server.js +0 -26
- package/dist/esm/utils.server.js.map +1 -1
- package/package.json +33 -25
|
@@ -3157,11 +3157,6 @@ export declare function extractNumbersAndTypeFromAppNameOrPath(fullPathOrAppName
|
|
|
3157
3157
|
exerciseNumber: string;
|
|
3158
3158
|
stepNumber: string;
|
|
3159
3159
|
} | null;
|
|
3160
|
-
export declare function getStackBlitzUrl({ fullPath, title, type, }: {
|
|
3161
|
-
fullPath: string;
|
|
3162
|
-
title: string;
|
|
3163
|
-
type: AppType;
|
|
3164
|
-
}): Promise<string | null>;
|
|
3165
3160
|
export declare function getPlaygroundApp({ timings, request, }?: CachifiedOptions): Promise<PlaygroundApp | null>;
|
|
3166
3161
|
export declare function getExercise(exerciseNumber: number | string, { request, timings }?: CachifiedOptions): Promise<{
|
|
3167
3162
|
title: string;
|
|
@@ -4153,16 +4148,6 @@ export declare function setPlayground(srcDir: string, { reset }?: {
|
|
|
4153
4148
|
*/
|
|
4154
4149
|
export declare function getPlaygroundAppName(): Promise<string | null>;
|
|
4155
4150
|
export declare function getAppDisplayName(a: App, allApps: Array<App>): string;
|
|
4156
|
-
export declare function getWorkshopTitle(): Promise<string>;
|
|
4157
|
-
export declare function getWorkshopSubtitle(): Promise<string>;
|
|
4158
|
-
export declare function getWorkshopInstructor(): Promise<{
|
|
4159
|
-
𝕏: string | undefined;
|
|
4160
|
-
name?: string | undefined;
|
|
4161
|
-
avatar?: string | undefined;
|
|
4162
|
-
xHandle?: string | undefined;
|
|
4163
|
-
} | undefined>;
|
|
4164
|
-
export declare function getEpicWorkshopHost(): Promise<string>;
|
|
4165
|
-
export declare function getEpicWorkshopSlug(): Promise<string | null>;
|
|
4166
4151
|
export declare function getWorkshopInstructions({ request, }?: {
|
|
4167
4152
|
request?: Request;
|
|
4168
4153
|
}): Promise<{
|
|
@@ -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;
|
|
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;AAwBvB,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAKtE,eAAO,MAAM,YAAY,QAC0B,CAAA;AAUnD,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,qFAAqF;;IAErF,uIAAuI;;;;;;;;;;;;;;;;;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EAAE,eAAe,EACpB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAE,gBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAU3C;AAED,wBAAgB,eAAe,CAC9B,GAAG,EAAE,eAAe,EACpB,EACC,QAAQ,EACR,YAAY,GACZ,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,eAAe,CAAA;CAAO,UAO7D;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,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
|
@@ -11,34 +11,15 @@ import { z } from 'zod';
|
|
|
11
11
|
import { appsCache, cachified, exampleAppCache, playgroundAppCache, problemAppCache, solutionAppCache, } from './cache.server.js';
|
|
12
12
|
import { getOptionalWatcher, getWatcher } from './change-tracker.server.js';
|
|
13
13
|
import { compileMdx } from './compile-mdx.server.js';
|
|
14
|
+
import { bustWorkshopConfigCache, getAppConfig, getStackBlitzUrl, getWorkshopConfig, } from './config.server.js';
|
|
14
15
|
import { getEnv, init as initEnv } from './env.server.js';
|
|
15
16
|
import { closeProcess, isAppRunning, runAppDev, waitOnApp, } from './process-manager.server.js';
|
|
16
17
|
import { getServerTimeHeader } from './timing.server.js';
|
|
17
18
|
import { getErrorMessage } from './utils.js';
|
|
18
|
-
import { getPkgProp } from './utils.server.js';
|
|
19
19
|
let initialized = false;
|
|
20
20
|
export const workshopRoot = (process.env.EPICSHOP_CONTEXT_CWD =
|
|
21
21
|
process.env.EPICSHOP_CONTEXT_CWD ?? process.cwd());
|
|
22
|
-
let packageJson;
|
|
23
|
-
try {
|
|
24
|
-
packageJson = JSON.parse(fs.readFileSync(path.join(workshopRoot, 'package.json'), 'utf8'));
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
throw new Error(`Could not find and parse package.json at ${workshopRoot}`);
|
|
28
|
-
}
|
|
29
22
|
const playgroundAppNameInfoPath = path.join(workshopRoot, 'node_modules', '.cache', 'epicshop', 'playground.json');
|
|
30
|
-
const StackBlitzConfigSchema = z.object({
|
|
31
|
-
// we default this to `${exerciseTitle} (${type})`
|
|
32
|
-
title: z.string().optional(),
|
|
33
|
-
// stackblitz defaults this to dev automatically
|
|
34
|
-
startScript: z.string().optional(),
|
|
35
|
-
// if no value is provided, then stackblitz defaults this to whatever
|
|
36
|
-
// looks best based on the width of the screen
|
|
37
|
-
view: z
|
|
38
|
-
.union([z.literal('editor'), z.literal('preview'), z.literal('both')])
|
|
39
|
-
.optional(),
|
|
40
|
-
file: z.string().optional(),
|
|
41
|
-
});
|
|
42
23
|
const BaseAppSchema = z.object({
|
|
43
24
|
/** a unique identifier for the app */
|
|
44
25
|
name: z.string(),
|
|
@@ -164,32 +145,15 @@ export function init() {
|
|
|
164
145
|
if (initialized)
|
|
165
146
|
return;
|
|
166
147
|
initialized = true;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (epicshop.githubRepo) {
|
|
171
|
-
repo = epicshop.githubRepo;
|
|
172
|
-
root = `${repo.replace(/\/$/, '')}/tree/main`;
|
|
173
|
-
}
|
|
174
|
-
else if (epicshop.githubRoot) {
|
|
175
|
-
root = epicshop.githubRoot.replace(/\/$/, '');
|
|
176
|
-
repo = root.replace(/\/(blob|tree)\/.*$/, '');
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
throw new Error(`Please set the URL of your GitHub repo in the "epicshop.githubRepo" property of the package.json.`);
|
|
180
|
-
}
|
|
181
|
-
if (!root.includes('/blob/') && !root.includes('/tree/')) {
|
|
182
|
-
root = `${root.replace(/\/$/, '')}/tree/main`;
|
|
183
|
-
}
|
|
184
|
-
process.env.EPICSHOP_GITHUB_REPO = repo;
|
|
185
|
-
process.env.EPICSHOP_GITHUB_ROOT = root;
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
throw new Error(`Could not set the EPICSHOP_GITHUB_ROOT environment variable. Please set it to the URL of your GitHub repo in the "epicshop.githubRoot" property of the package.json.`, { cause: error });
|
|
189
|
-
}
|
|
148
|
+
const config = getWorkshopConfig();
|
|
149
|
+
process.env.EPICSHOP_GITHUB_REPO = config.githubRepo;
|
|
150
|
+
process.env.EPICSHOP_GITHUB_ROOT = config.githubRoot;
|
|
190
151
|
initEnv();
|
|
191
152
|
global.ENV = getEnv();
|
|
192
153
|
async function handleFileChanges(event, filePath) {
|
|
154
|
+
if (filePath === path.join(workshopRoot, 'package.json')) {
|
|
155
|
+
bustWorkshopConfigCache();
|
|
156
|
+
}
|
|
193
157
|
const apps = await getApps();
|
|
194
158
|
for (const app of apps) {
|
|
195
159
|
if (filePath.startsWith(app.fullPath)) {
|
|
@@ -540,18 +504,9 @@ async function findProblemDir({ fullPath, }) {
|
|
|
540
504
|
return null;
|
|
541
505
|
}
|
|
542
506
|
async function getTestInfo({ fullPath, }) {
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
? await getPkgProp(fullPath, 'epicshop.testTab.enabled', true)
|
|
546
|
-
: true;
|
|
547
|
-
if (testsEnabledLocally === false)
|
|
548
|
-
return { type: 'none' };
|
|
549
|
-
const testsEnabledGlobally = await getPkgProp(workshopRoot, 'epicshop.testTab.enabled', true);
|
|
550
|
-
if (testsEnabledGlobally === false)
|
|
507
|
+
const { testTab: { enabled }, scripts: { test: testScript }, } = await getAppConfig(fullPath);
|
|
508
|
+
if (enabled === false)
|
|
551
509
|
return { type: 'none' };
|
|
552
|
-
const testScript = hasPkgJson
|
|
553
|
-
? await getPkgProp(fullPath, 'epicshop.scripts.test', '')
|
|
554
|
-
: null;
|
|
555
510
|
if (testScript) {
|
|
556
511
|
return { type: 'script', script: testScript };
|
|
557
512
|
}
|
|
@@ -569,14 +524,9 @@ async function getTestInfo({ fullPath, }) {
|
|
|
569
524
|
return { type: 'none' };
|
|
570
525
|
}
|
|
571
526
|
async function getDevInfo({ fullPath, portNumber, }) {
|
|
572
|
-
const
|
|
573
|
-
const hasDevScript =
|
|
574
|
-
? Boolean(await getPkgProp(fullPath, 'scripts.dev', ''))
|
|
575
|
-
: false;
|
|
527
|
+
const { scripts: { dev: devScript }, initialRoute, } = await getAppConfig(fullPath);
|
|
528
|
+
const hasDevScript = Boolean(devScript);
|
|
576
529
|
if (hasDevScript) {
|
|
577
|
-
const initialRoute = (hasPkgJson
|
|
578
|
-
? await getPkgProp(fullPath, 'epicshop.initialRoute', '')
|
|
579
|
-
: '') || (await getPkgProp(workshopRoot, 'epicshop.initialRoute', '/'));
|
|
580
530
|
return { type: 'script', portNumber, initialRoute };
|
|
581
531
|
}
|
|
582
532
|
const indexFiles = (await fsExtra.readdir(fullPath)).filter((file) => file.startsWith('index.'));
|
|
@@ -587,36 +537,6 @@ async function getDevInfo({ fullPath, portNumber, }) {
|
|
|
587
537
|
return { type: 'none' };
|
|
588
538
|
}
|
|
589
539
|
}
|
|
590
|
-
export async function getStackBlitzUrl({ fullPath, title, type, }) {
|
|
591
|
-
const Schema = StackBlitzConfigSchema.nullable().optional();
|
|
592
|
-
const appStackBlitzConfig = Schema.parse(
|
|
593
|
-
// if there's no package.json this will throw. If that's the case, we can't use stackblitz
|
|
594
|
-
// https://discord.com/channels/364486390102097930/1260979618240790578
|
|
595
|
-
await getPkgProp(fullPath, 'epicshop.stackBlitzConfig', {}).catch(() => null));
|
|
596
|
-
if (appStackBlitzConfig === null)
|
|
597
|
-
return null;
|
|
598
|
-
const workshopStackBlitzConfig = Schema.parse(await getPkgProp(workshopRoot, 'epicshop.stackBlitzConfig', {}));
|
|
599
|
-
if (workshopStackBlitzConfig === null)
|
|
600
|
-
return null;
|
|
601
|
-
let githubRootUrlString = ENV.EPICSHOP_GITHUB_REPO;
|
|
602
|
-
if (!githubRootUrlString)
|
|
603
|
-
return null;
|
|
604
|
-
if (!githubRootUrlString.includes('/blob/') ||
|
|
605
|
-
!githubRootUrlString.includes('/tree/')) {
|
|
606
|
-
githubRootUrlString = `${githubRootUrlString.replace(/\/$/, '')}/blob/main`;
|
|
607
|
-
}
|
|
608
|
-
const githubRootUrl = new URL(githubRootUrlString.replace(/\/blob\//, '/tree/'));
|
|
609
|
-
const githubPart = githubRootUrl.pathname;
|
|
610
|
-
const config = {
|
|
611
|
-
...workshopStackBlitzConfig,
|
|
612
|
-
...appStackBlitzConfig,
|
|
613
|
-
title: appStackBlitzConfig?.title ?? `${title} (${type})`,
|
|
614
|
-
};
|
|
615
|
-
const params = new URLSearchParams(config);
|
|
616
|
-
const relativePath = fullPath.replace(`${workshopRoot}${path.sep}`, '');
|
|
617
|
-
const stackBlitzUrl = new URL(`/github${githubPart}/${relativePath}?${params}`, 'https://stackblitz.com');
|
|
618
|
-
return stackBlitzUrl.toString();
|
|
619
|
-
}
|
|
620
540
|
export async function getPlaygroundApp({ timings, request, } = {}) {
|
|
621
541
|
const playgroundDir = path.join(workshopRoot, 'playground');
|
|
622
542
|
const baseAppName = await getPlaygroundAppName();
|
|
@@ -1122,37 +1042,6 @@ export function getAppDisplayName(a, allApps) {
|
|
|
1122
1042
|
}
|
|
1123
1043
|
return displayName;
|
|
1124
1044
|
}
|
|
1125
|
-
export async function getWorkshopTitle() {
|
|
1126
|
-
const title = await getPkgProp(workshopRoot, 'epicshop.title');
|
|
1127
|
-
if (!title) {
|
|
1128
|
-
throw new Error(`Workshop title not found. Make sure the root of the workshop has "epicshop" with a "title" property in the package.json. ${workshopRoot}`);
|
|
1129
|
-
}
|
|
1130
|
-
return title;
|
|
1131
|
-
}
|
|
1132
|
-
export async function getWorkshopSubtitle() {
|
|
1133
|
-
return await getPkgProp(workshopRoot, 'epicshop.subtitle', '');
|
|
1134
|
-
}
|
|
1135
|
-
export async function getWorkshopInstructor() {
|
|
1136
|
-
const InstructorSchema = z
|
|
1137
|
-
.object({
|
|
1138
|
-
name: z.string().optional(),
|
|
1139
|
-
avatar: z.string().optional(),
|
|
1140
|
-
𝕏: z.string().optional(),
|
|
1141
|
-
// alias because 𝕏 is hard to type 😅
|
|
1142
|
-
xHandle: z.string().optional(),
|
|
1143
|
-
})
|
|
1144
|
-
.optional();
|
|
1145
|
-
const instructor = InstructorSchema.parse(await getPkgProp(workshopRoot, 'epicshop.instructor'));
|
|
1146
|
-
return instructor ? { ...instructor, 𝕏: instructor.xHandle } : undefined;
|
|
1147
|
-
}
|
|
1148
|
-
export async function getEpicWorkshopHost() {
|
|
1149
|
-
const epicWorkshopHost = await getPkgProp(workshopRoot, 'epicshop.epicWorkshopHost', 'www.epicweb.dev');
|
|
1150
|
-
return epicWorkshopHost;
|
|
1151
|
-
}
|
|
1152
|
-
export async function getEpicWorkshopSlug() {
|
|
1153
|
-
const epicWorkshopSlug = await getPkgProp(workshopRoot, 'epicshop.epicWorkshopSlug', '');
|
|
1154
|
-
return epicWorkshopSlug || null;
|
|
1155
|
-
}
|
|
1156
1045
|
export async function getWorkshopInstructions({ request, } = {}) {
|
|
1157
1046
|
const readmeFilepath = path.join(workshopRoot, 'exercises', 'README.mdx');
|
|
1158
1047
|
const compiled = await compileMdx(readmeFilepath, { request }).then((r) => ({ ...r, status: 'success' }), (e) => {
|