Skip to content

Commit

Permalink
feat: add template logic and update readme with instructions for katya
Browse files Browse the repository at this point in the history
  • Loading branch information
dfyz011 committed Jun 12, 2024
1 parent b82bb31 commit b3fdb0e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 30 deletions.
60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Astro Starter Kit: Basics

```sh
npm create astro@latest -- --template basics
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)

## 🚀 Project Structure

Inside of your Astro project, you'll see the following folders and files:
Expand All @@ -30,25 +16,41 @@ Inside of your Astro project, you'll see the following folders and files:
└── package.json
```

Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
## 🧞 Commands

All commands are run from the root of the project, from a terminal:

There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
| Command | Action |
| :------------------------- | :----------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm run astro -- --help` | Get help using the Astro CLI |

Any static assets, like images, can be placed in the `public/` directory.
## 👀 Как Катя будет добавлять новый фильм?

## 🧞 Commands
1. Нам необходимо создать папку со всеми данными для фильма. В терминале необходимо выполнить следующую команду

All commands are run from the root of the project, from a terminal:
```sh
./create-film.sh Название фильма без пробелов на английком
```

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |
2. Создастся папка с "пустыми" данными по пути `src/content/films/Название`
3. Сущность "Фильм" состоит из 3 частей:

## 👀 Want to learn more?
- картинка (вертикальная) preview.jpg (тебе необходимо заменить на нужную картинку, но имя должно быть такое же)
- видео (короткое превью, которое отобразится при наведении) video.mov (тебе необходимо заменить на нужное видео, но имя должно быть такое же)
- описание в виде md файла (мы разговаривали с тобой про md редакторы) Название.md

4. Когда ты заменила preview.jpg и video.mov, открывай md файл
5. Замени youtubeVideoId на нужное видео, которое ты загрузила на youtube
6. Поменяй описание в md файле как хочешь (все что ниже ---) - этот текст отобразиться на странице фильма
7. Чтобы проверить, как все работает

```sh
pnpm dev
```

Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
8. Открывай по ссыылке http://localhost:4321/ и смотри
14 changes: 14 additions & 0 deletions create-film.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Проверка, что передан ровно один параметр
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <название фильма на английском без пробелов>"
exit 1
fi

# Сохранение параметра в переменную
parameter=$1

cp -R src/content/filmTemplateFolder src/content/films/$parameter

mv src/content/films/$parameter/filmTemplate.md src/content/films/$parameter/$parameter.md
2 changes: 1 addition & 1 deletion src/content/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const filmsCollectioon = defineCollection({
z.object({
youtubeVideoId: z.string(),
previewImg: image(),
trailerGif: image(),
trailerGif: image().optional(),
trailerVideo: z.string().optional(),
}),
});
Expand Down
9 changes: 9 additions & 0 deletions src/content/filmTemplateFolder/filmTemplate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
youtubeVideoId: W593Yn9aMMM
previewImg: "./preview.jpg"
trailerVideo: "video.mov"
---

# Заголовок

Текст
Binary file added src/content/filmTemplateFolder/preview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file removed src/content/films/fisher/trailer1.gif
Binary file not shown.

0 comments on commit b3fdb0e

Please sign in to comment.