Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
noam-honig opened this issue Oct 24, 2024 · 3 comments · May be fixed by #165
Open

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

noam-honig opened this issue Oct 24, 2024 · 3 comments · May be fixed by #165
Labels
enhancement New feature or request

Comments

@noam-honig
Copy link
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

@AriPerkkio
Copy link
Member

@AriPerkkio AriPerkkio linked a pull request Oct 25, 2024 that will close this issue
@AriPerkkio AriPerkkio added the enhancement New feature or request label Oct 25, 2024
@noam-honig
Copy link
Contributor Author

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
Copy link
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)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants