epicshop 6.84.7 → 6.84.8

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.
@@ -59,9 +59,11 @@ function parseEpicLessonSlugFromEmbedUrl(urlString) {
59
59
  return parseSegments(segments);
60
60
  }
61
61
  }
62
- function formatProductLessonUrl({ productHost, productSlug, lessonSlug, }) {
62
+ function formatProductLessonUrl({ productHost, productSlug, lessonSlug, sectionSlug, }) {
63
63
  // The product site will typically redirect to a section-specific path when needed.
64
- return `https://${productHost}/workshops/${productSlug}/${lessonSlug}`;
64
+ return sectionSlug
65
+ ? `https://${productHost}/workshops/${productSlug}/${sectionSlug}/${lessonSlug}`
66
+ : `https://${productHost}/workshops/${productSlug}/${lessonSlug}`;
65
67
  }
66
68
  function formatIssue(issue, workshopRoot) {
67
69
  const icon = issue.level === 'error' ? chalk.red('❌') : chalk.yellow('⚠️ ');
@@ -316,7 +318,7 @@ async function fetchRemoteWorkshopLessonSlugs({ productHost, workshopSlug, }) {
316
318
  message: `Product API response did not include an array "resources" field`,
317
319
  };
318
320
  }
319
- const lessonSlugs = [];
321
+ const lessons = [];
320
322
  for (const resource of resources) {
321
323
  if (!resource || typeof resource !== 'object')
322
324
  continue;
@@ -324,24 +326,28 @@ async function fetchRemoteWorkshopLessonSlugs({ productHost, workshopSlug, }) {
324
326
  if (r._type === 'lesson') {
325
327
  const slug = r.slug;
326
328
  if (typeof slug === 'string')
327
- lessonSlugs.push(slug);
329
+ lessons.push({ slug, sectionSlug: null });
328
330
  continue;
329
331
  }
330
332
  if (r._type === 'section') {
331
- const lessons = r.lessons;
332
- if (!Array.isArray(lessons))
333
+ const sectionSlug = typeof r.slug === 'string' && r.slug.trim().length > 0
334
+ ? r.slug.trim()
335
+ : null;
336
+ const sectionLessons = r.lessons;
337
+ if (!Array.isArray(sectionLessons))
333
338
  continue;
334
- for (const lesson of lessons) {
339
+ for (const lesson of sectionLessons) {
335
340
  if (!lesson || typeof lesson !== 'object')
336
341
  continue;
337
342
  const l = lesson;
338
343
  const slug = l.slug;
339
- if (typeof slug === 'string')
340
- lessonSlugs.push(slug);
344
+ if (typeof slug === 'string') {
345
+ lessons.push({ slug, sectionSlug });
346
+ }
341
347
  }
342
348
  }
343
349
  }
344
- return { status: 'success', lessonSlugs };
350
+ return { status: 'success', lessons };
345
351
  }
346
352
  async function checkMinContentLength({ fullPath, minChars, }) {
347
353
  try {
@@ -850,7 +856,21 @@ export async function launchReadiness(options = {}) {
850
856
  });
851
857
  }
852
858
  else {
853
- const remoteLessonSlugs = Array.from(new Set(remote.lessonSlugs.map(stripEpicAiSlugSuffix)));
859
+ const remoteLessons = remote.lessons
860
+ .map((l) => ({
861
+ slug: stripEpicAiSlugSuffix(l.slug),
862
+ sectionSlug: l.sectionSlug
863
+ ? stripEpicAiSlugSuffix(l.sectionSlug)
864
+ : null,
865
+ }))
866
+ .filter((l) => l.slug.trim().length > 0);
867
+ // Preserve the first sectionSlug seen for a given lesson slug.
868
+ const remoteLessonBySlug = new Map();
869
+ for (const l of remoteLessons) {
870
+ if (!remoteLessonBySlug.has(l.slug))
871
+ remoteLessonBySlug.set(l.slug, l);
872
+ }
873
+ const remoteLessonSlugs = [...remoteLessonBySlug.keys()];
854
874
  if (remoteLessonSlugs.length === 0) {
855
875
  issues.push({
856
876
  level: 'error',
@@ -862,11 +882,15 @@ export async function launchReadiness(options = {}) {
862
882
  if (missing.length) {
863
883
  const formatted = missing
864
884
  .sort()
865
- .map((slug) => `- ${slug}: ${formatProductLessonUrl({
866
- productHost,
867
- productSlug,
868
- lessonSlug: slug,
869
- })}`)
885
+ .map((slug) => {
886
+ const remoteLesson = remoteLessonBySlug.get(slug);
887
+ return `- ${slug}: ${formatProductLessonUrl({
888
+ productHost,
889
+ productSlug,
890
+ lessonSlug: slug,
891
+ sectionSlug: remoteLesson?.sectionSlug ?? null,
892
+ })}`;
893
+ })
870
894
  .join('\n');
871
895
  issues.push({
872
896
  level: 'error',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epicshop",
3
- "version": "6.84.7",
3
+ "version": "6.84.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -105,7 +105,7 @@
105
105
  "build:watch": "nx watch --projects=epicshop -- nx run \\$NX_PROJECT_NAME:build"
106
106
  },
107
107
  "dependencies": {
108
- "@epic-web/workshop-utils": "6.84.7",
108
+ "@epic-web/workshop-utils": "6.84.8",
109
109
  "@inquirer/prompts": "^8.2.0",
110
110
  "@sentry/node": "^10.38.0",
111
111
  "chalk": "^5.6.2",