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