Skip to content

Ability to include files from other lesson / template in the Files of the current lesson #393

@noam-honig

Description

@noam-honig
Contributor

Is your feature request related to a problem?

Often I have several lessons that coverthe same files. I want these files to appear in the lesson for context to the user - so the result is that I have mutiple files with the same name and same content duplicated among multiple lessons.
Currently I copy them between each lesson - but then I change one of them and forget to update the rest and it becomes hard to maintain.

Describe the solution you'd like.

In the content.md in the front matter - allow to referene files from other lessons, and they'll be included here as well - something like:

---
type: lesson
title: Custom Filter
template: relations
focus: /frontend/Page.tsx
files:
  - ./previous-lesson/_files/shared/Order.ts
---

Describe alternatives you've considered.

Duplicating files - but that's hard to maintain

Additional context

No response

Activity

linked a pull request that will close this issue on Oct 25, 2024
noam-honig

noam-honig commented on Oct 25, 2024

@noam-honig
ContributorAuthor

Hi @AriPerkkio thanks for pointing that out.
I wanted to try it ( and document it) but couldn't get it to wrok.

Is it already released?

When I do:

---
type: lesson
title: Introduction
template:
  name: relations
  visibleFiles: ['/backend/index.ts']
focus: /shared/Customer.ts
---

I get an error

10:42:42 [watch] src/content/tutorial/4-concepts/6-sql-expression/1-introduction/content.md
10:42:43 [ERROR] [InvalidContentEntryFrontmatterError] tutorial → 4-concepts/6-sql-expression/1-introduction/content.md frontmatter does not match collection schema.
Did not match union:
  Hint:
    See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas.
  Error reference:
    https://docs.astro.build/en/reference/errors/invalid-content-entry-frontmatter-error/
  Stack trace:
    at getEntryDataAndImages (file:///C:/repos/radweb/docs/interactive/node_modules/astro/dist/content/utils.js:137:26)
    [...] See full stack trace in the browser, or rerun with --verbose.

Here are the versions I'm using:

  "dependencies": {
    "@iconify-json/ri": "^1.2.2",
    "@tutorialkit/react": "1.1.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1"
  },
  "devDependencies": {
    "@astrojs/check": "^0.7.0",
    "@astrojs/react": "^3.6.0",
    "@tutorialkit/astro": "1.1.1",
    "@tutorialkit/theme": "1.1.1",
    "@tutorialkit/types": "1.1.1",
    "@types/node": "^20.14.6",
    "@types/react": "^18.3.3",
    "astro": "^4.15.0",
    "prettier-plugin-astro": "^0.14.1",
    "typescript": "^5.4.5"
  }
AriPerkkio

AriPerkkio commented on Oct 25, 2024

@AriPerkkio
Member

It's not yet finished or released. We'll need to discuss this with the team a bit more before we know what kind of API we want for it.

This discussion is not yet resolved: #165 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @AriPerkkio@noam-honig

      Issue actions

        Ability to include files from other lesson / template in the `Files` of the current lesson · Issue #393 · stackblitz/tutorialkit