@mrktg-ost/create-project 0.1.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/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # @mrktg-ost/create-project
2
+
3
+ Генератор лендингов брендов Островка. Тонкая обёртка над движком `@mrktg/project-generator`: бренды — из пакета `@mrktg-ost/brands`,
4
+ здесь только `Layout.astro` под пакет компонентов региона и карта тем.
5
+
6
+ ```bash
7
+ npm create -y @mrktg-ost/project@latest my-landing
8
+ ```
9
+
10
+ Без вопросов: `npm create -y @mrktg-ost/project@latest my-landing -- --brand <id> --path <slug> --no-git`.
11
+ Список брендов и все флаги — `npx @mrktg-ost/create-project --help`. Что спрашивается и как устроен шаблон —
12
+ в README движка.
13
+
14
+ ## Структура
15
+
16
+ ```
17
+ bin/create-project.js main(config) из движка
18
+ src/config.js реестр и регион из @mrktg-ost/brands, папка оверлея, темы брендов
19
+ template/src/layouts/ Layout.astro региона: ThemeProvider пакета компонентов
20
+ ```
21
+
22
+ Новый бренд добавляется в `@mrktg-ost/brands`; здесь при необходимости — тема в `src/config.js`.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import { main } from '@mrktg/project-generator';
3
+ import { config } from '../src/config.js';
4
+
5
+ main(config);
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@mrktg-ost/create-project",
3
+ "version": "0.1.0",
4
+ "description": "Генератор лендингов брендов Островка: npm create @mrktg-ost/project my-landing",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-project": "bin/create-project.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src",
12
+ "template"
13
+ ],
14
+ "scripts": {
15
+ "test": "node --test"
16
+ },
17
+ "engines": {
18
+ "node": ">=22.18"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+ssh://git@gitlab.ostrovok.in/marketing-frontend/project-generator.git"
23
+ },
24
+ "dependencies": {
25
+ "@mrktg/project-generator": "^1.0.1",
26
+ "@mrktg-ost/brands": "^1.0.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ }
31
+ }
package/src/config.js ADDED
@@ -0,0 +1,17 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { REGIONS, registry } from '@mrktg-ost/brands';
3
+
4
+ /**
5
+ * Какую тему пакета компонентов подключать лендингу бренда: `<pkg>/themes/<theme>`.
6
+ * Это знание про наш пакет компонентов, поэтому живёт в генераторе, а не в реестре брендов.
7
+ */
8
+ // В ost-components одна тема
9
+ const brandTheme = () => 'ostrovok';
10
+
11
+ export const config = {
12
+ command: '@mrktg-ost/create-project',
13
+ registry,
14
+ region: REGIONS.ru,
15
+ templateDir: fileURLToPath(new URL('../template/', import.meta.url)),
16
+ brandTheme,
17
+ };
@@ -0,0 +1,51 @@
1
+ ---
2
+ // В README пакета указан импорт из "ost-components/themes", но этого файла в сборке нет —
3
+ // провайдер лежит рядом с темой.
4
+ import { ThemeProvider } from "ost-components/themes/{{THEME}}/index";
5
+ import theme from "ost-components/themes/{{THEME}}";
6
+ import "ost-components/index.css";
7
+ import { SITE } from "../site.config";
8
+
9
+ interface Props {
10
+ title?: string;
11
+ description?: string;
12
+ }
13
+
14
+ const { title = SITE.brandTitle, description = "" } = Astro.props;
15
+ ---
16
+
17
+ <!doctype html>
18
+ <html lang="{{LANG}}">
19
+ <head>
20
+ <meta charset="UTF-8" />
21
+ <meta name="viewport" content="width=device-width" />
22
+ <meta name="generator" content={Astro.generator} />
23
+ <title>{title}</title>
24
+ {description && <meta name="description" content={description} />}
25
+ <link rel="icon" href="{{FAVICON_URL}}" type="{{FAVICON_TYPE}}" />
26
+ <link rel="canonical" href={SITE.prodUrl} />
27
+
28
+ <!-- Флюидная вёрстка: плавающий font-size на html, 1rem = 1px макета (репозиторий clamp-scaling) -->
29
+ <link rel="stylesheet" href="{{CLAMP_SCALING_BASE_URL}}/media.css" />
30
+ <link rel="stylesheet" href="{{CLAMP_SCALING_BASE_URL}}/base.css" />
31
+
32
+ <!-- Аналитика региона {{REGION}} -->
33
+ <script src="{{ANALYTICS_LOADER_URL}}" async is:inline></script>
34
+ </head>
35
+ <body>
36
+ <ThemeProvider theme={theme} fluidMode={true}>
37
+ <slot />
38
+ </ThemeProvider>
39
+ </body>
40
+ </html>
41
+
42
+ <style is:global>
43
+ html,
44
+ body {
45
+ margin: 0;
46
+ width: 100%;
47
+ min-height: 100%;
48
+ -webkit-font-smoothing: antialiased;
49
+ -moz-osx-font-smoothing: grayscale;
50
+ }
51
+ </style>