Skip to content

Commit cb4a148

Browse files
committed
Init commit
0 parents  commit cb4a148

27 files changed

+3642
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = LF
5+
indent_style = space
6+
indent_size = 4
7+
charset = utf-8
8+
trim_trailing_whitespace = all
9+
insert_final_newline = true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
.idea
3+
/node_modules

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# История версий
2+
3+
Все основные изменения задокументированы в этом файле.
4+
5+
[1.0.0]: https://github.com/digikid/create-project/releases/tag/1.0.0
6+
7+
## [1.0.0] - 2022-01-22
8+
9+
Первый публичный релиз

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021-present, Alexander Dovlatov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Конфигуратор gulp-проекта
2+
3+
![GitHub release](https://img.shields.io/github/release/digikid/create-project.svg)
4+
5+
Данный конфигуратор позволяет развернуть в текущей директории сборку [gulp-project](https://github.com/digikid/gulp-project) и произвести настройку параметров.
6+
7+
![promo](./promo.png)
8+
9+
## Установка
10+
11+
```shell
12+
npm i -g digikid/create-project
13+
```
14+
15+
## Запуск
16+
17+
Для запуска перейдите в директорию, где нужно создать проект, а затем запустите команду:
18+
19+
```shell
20+
create-project
21+
```
22+
23+
Через командную строку можно сразу же передать название проекта:
24+
25+
```shell
26+
create-project my-project
27+
```
28+
29+
## Изменение значений по умолчанию
30+
31+
Все значения по умолчанию можно переопределить через флаг `--config`.
32+
33+
После запуска команды переопределите параметры, после чего они сохранятся локально и будут обновлены при следующем запуске конфигуратора.
34+
35+
```shell
36+
create-project --config
37+
```
38+
39+
## Сброс значений по умолчанию
40+
41+
Если необходимо восстановить значения по умолчанию, используйте флаг `--restore`.
42+
43+
Запустите команду, после чего дайте согласие на сброс параметров:
44+
45+
```shell
46+
create-project --restore
47+
```
48+
49+
## Быстрая настройка
50+
51+
Переход в режим быстрой настройки осуществляется с помощью флага `--force`.
52+
53+
В этом режиме будут запрошены только обязательные параметры, а для всех остальных будут использованы значения по умолчанию.
54+
55+
```shell
56+
create-project --force
57+
```
58+
59+
## Лицензия
60+
61+
[The MIT License (MIT)](LICENSE)

bin/index.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env node
2+
3+
import init from '#lib/init';
4+
import configurate from '#lib/configurate';
5+
import restore from '#lib/restore';
6+
7+
import { scanDirectory, readFileAsync } from '#lib/utils/fs';
8+
import { isValid } from '#lib/utils/json';
9+
import { arg } from '#lib/utils/args';
10+
import { error } from '#lib/utils/log';
11+
12+
(async () => {
13+
const config = {};
14+
15+
const files = scanDirectory('config', {
16+
extensions: ['json']
17+
});
18+
19+
try {
20+
for (const file of files) {
21+
const { name } = file;
22+
23+
const key = name.replace('.json', '');
24+
25+
const data = await readFileAsync(`config/${name}`);
26+
const value = isValid(data) ? JSON.parse(data) : {};
27+
28+
config[key] = value;
29+
};
30+
31+
if (arg('config')) {
32+
await configurate(config);
33+
} else if (arg('restore')) {
34+
await restore(config);
35+
} else {
36+
await init(config);
37+
};
38+
} catch(e) {
39+
error('DEFAULT_ERROR', e);
40+
};
41+
})();

config/boilerplate.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"animate": {
3+
"install": "animate.css",
4+
"files": [
5+
"styles/vendor/_animate.scss"
6+
],
7+
"exclude": []
8+
},
9+
"datepicker": {
10+
"install": "air-datepicker",
11+
"files": [
12+
"styles/vendor/_datepicker.scss",
13+
"js/jquery/plugins/form/date.js"
14+
],
15+
"exclude": []
16+
},
17+
"bootstrap": {
18+
"install": "bootstrap",
19+
"files": [
20+
"styles/vendor/_bootstrap.scss"
21+
],
22+
"exclude": [
23+
"styles/vendor/_normalize.scss"
24+
]
25+
},
26+
"fancybox": {
27+
"install": "@fancyapps/ui",
28+
"files": [
29+
"styles/vendor/_fancybox.scss",
30+
"js/jquery/plugins/fancybox.js",
31+
"js/jquery/plugins/modal.js"
32+
],
33+
"exclude": []
34+
},
35+
"mask": {
36+
"install": "jquery-mask-plugin",
37+
"files": [
38+
"js/jquery/plugins/form/phone.js"
39+
],
40+
"exclude": []
41+
},
42+
"lozad": {
43+
"install": "lozad",
44+
"files": [
45+
"styles/vendor/_lazy.scss",
46+
"js/jquery/plugins/lazyLoad.js"
47+
],
48+
"exclude": []
49+
},
50+
"simplebar": {
51+
"install": "simplebar",
52+
"files": [
53+
"styles/vendor/_simplebar.scss",
54+
"js/jquery/plugins/simplebar.js"
55+
],
56+
"exclude": []
57+
},
58+
"swiper": {
59+
"install": "swiper",
60+
"files": [
61+
"styles/vendor/_swiper.scss",
62+
"js/jquery/plugins/swiper.js"
63+
],
64+
"exclude": []
65+
},
66+
"tippy": {
67+
"install": [
68+
"@popperjs/core",
69+
"tippy.js"
70+
],
71+
"files": [
72+
"styles/vendor/_tippy.scss",
73+
"js/jquery/plugins/tooltip.js"
74+
],
75+
"exclude": []
76+
}
77+
}

config/messages.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"DEFAULT_SPINNER": "Загрузка...",
3+
"DEFAULT_ERROR": "Произошла ошибка при выполнении скрипта",
4+
"INIT_TITLE": "Настройка проекта",
5+
"INIT_TEXT": "Пожалуйста, заполните все необходимые поля",
6+
"INIT_SUCCESS": "Настройка проекта завершена",
7+
"INIT_MANUAL": "Инструкция по работе со сборкой:",
8+
"CONFIGURATE_TITLE": "Переопределение параметров",
9+
"CONFIGURATE_TEXT": "Пожалуйста, укажите параметры по умолчанию",
10+
"CONFIGURATE_SUCCESS": "Параметры сохранены",
11+
"CONFIGURATE_ERROR": "Произошла ошибка при сохранении параметров",
12+
"RESTORE_TITLE": "Сброс параметров",
13+
"RESTORE_TEXT": "Все пользовательские параметры будут сброшены до начальных значений",
14+
"RESTORE_SUCCESS": "Сброс настроек выполнен",
15+
"RESTORE_ERROR": "Произошла ошибка при сохранении параметров",
16+
"CLONE_REPO_START": "Клонирование репозитория...",
17+
"CLONE_REPO_SUCCESS": "Репозиторий склонирован",
18+
"INSTALL_DEPS_START": "Установка библиотек...",
19+
"INSTALL_DEPS_SUCCESS": "Все библиотеки установлены",
20+
"INSTALL_DEPS_ERROR": "При установке библиотек произошла ошибка",
21+
"ADD_CONFIG_START": "Обновление файлов конфигурации...",
22+
"ADD_CONFIG_SUCCESS": "Файлы конфигурации обновлены",
23+
"ADD_CONFIG_ERROR": "При обновлении файлов конфигурации произошла ошибка",
24+
"COPY_BOILERPLATE_START": "Перемещение дополнительных файлов...",
25+
"COPY_BOILERPLATE_SUCCESS": "Структура проекта подготовлена",
26+
"COPY_BOILERPLATE_ERROR": "При перемещении дополнительных файлов произошла ошибка",
27+
"ENVIRONMENT_ERROR": "Невозможно запустить скрипт в текущем окружении",
28+
"PATH_EXISTS_ERROR": "Папка с таким названием уже существует",
29+
"GIT_COMMAND_NOT_FOUND_ERROR": "Не удалось найти команду, установите git по инструкции:\\nhttps://github.com/git-guides/install-git"
30+
}

0 commit comments

Comments
 (0)