Skip to content

Commit 5d39563

Browse files
committed
Version 2.1.0: JS --> TS, Bugfixes
1 parent 0beb81f commit 5d39563

23 files changed

+4255
-662
lines changed

.eslintrc

Lines changed: 0 additions & 18 deletions
This file was deleted.

.gitignore

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Created by https://www.gitignore.io/api/node,sass,visualstudiocode
2-
31
### Node ###
42
# Logs
53
logs
@@ -73,8 +71,114 @@ typings/
7371
!.vscode/extensions.json
7472
.history/
7573

74+
### PhpStorm ###
75+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
76+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
77+
78+
# User-specific stuff:
79+
.idea/**/workspace.xml
80+
.idea/**/tasks.xml
81+
.idea/dictionaries
82+
83+
# Sensitive or high-churn files:
84+
.idea/**/dataSources/
85+
.idea/**/dataSources.ids
86+
.idea/**/dataSources.xml
87+
.idea/**/dataSources.local.xml
88+
.idea/**/sqlDataSources.xml
89+
.idea/**/dynamic.xml
90+
.idea/**/uiDesigner.xml
91+
92+
# Gradle:
93+
.idea/**/gradle.xml
94+
.idea/**/libraries
95+
96+
# CMake
97+
cmake-build-debug/
98+
99+
# Mongo Explorer plugin:
100+
.idea/**/mongoSettings.xml
101+
102+
## File-based project format:
103+
*.iws
104+
105+
## Plugin-specific files:
106+
107+
# IntelliJ
108+
/out/
109+
110+
# mpeltonen/sbt-idea plugin
111+
.idea_modules/
112+
113+
# JIRA plugin
114+
atlassian-ide-plugin.xml
115+
116+
# Cursive Clojure plugin
117+
.idea/replstate.xml
118+
119+
# Ruby plugin and RubyMine
120+
/.rakeTasks
121+
122+
# Crashlytics plugin (for Android Studio and IntelliJ)
123+
com_crashlytics_export_strings.xml
124+
crashlytics.properties
125+
crashlytics-build.properties
126+
fabric.properties
127+
128+
### PhpStorm Patch ###
129+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
130+
131+
# *.iml
132+
# modules.xml
133+
# .idea/misc.xml
134+
# *.ipr
135+
136+
# Sonarlint plugin
137+
.idea/sonarlint
138+
139+
### WebStorm ###
140+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
141+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
142+
143+
# User-specific stuff:
144+
145+
# Sensitive or high-churn files:
146+
147+
# Gradle:
148+
149+
# CMake
150+
151+
# Mongo Explorer plugin:
152+
153+
## File-based project format:
154+
155+
## Plugin-specific files:
156+
157+
# IntelliJ
158+
159+
# mpeltonen/sbt-idea plugin
160+
161+
# JIRA plugin
162+
163+
# Cursive Clojure plugin
164+
165+
# Ruby plugin and RubyMine
166+
167+
# Crashlytics plugin (for Android Studio and IntelliJ)
168+
169+
### WebStorm Patch ###
170+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
171+
172+
# *.iml
173+
# modules.xml
174+
# .idea/misc.xml
175+
# *.ipr
176+
177+
# Sonarlint plugin
178+
76179
# Other
77180
debug.log
78181
undefined/
79182

80-
# End of https://www.gitignore.io/api/node,sass,visualstudiocode
183+
### Compile ###
184+
dist/

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
![](https://fontmeme.com/permalink/170617/1dcc71d7d21a1883084b89138a19b268.png)
22

3-
# Версия 2.0.0
3+
Проект представляет собой предопределённую базовую структуру со всеми необходимыми файлами и настроенными процессами для создания web-проекта.
44

5-
В новой редакции отказался от ~~Yeoman~~.
5+
# Версия 2.1.0
66

7-
Теперь проект представляет собой предопределённую базовую структуру с необходимыми файлами.
7+
- В новой редакции JavaScript заменён на TypeScript.
88

99
## Технологии
1010

1111
- Для HTML используется препроцессор **[Pug](https://pugjs.org/api/getting-started.html)** (*Jade*)
1212
- Для CSS используется препроцессор **[Sass](https://sass-scss.ru/)** (*Scss*)
13-
- JS транспилируется с помощью **[Babel](https://babeljs.io/)** и **[Browserify](http://browserify.org/)** из ES2015 в ES5.
13+
- ~~JS транспилируется с помощью **[Babel](https://babeljs.io/)** и **[Browserify](http://browserify.org/)** из ES2015 в ES5~~.
1414
- Подключена библиотека **Modernizr** (необходимые проверки, модули настраиваются в файле `modernizr-config.json`)
1515

1616
> Для выбора настроек: https://modernizr.com/download?setclasses
1717
1818
- Подключен **[normalize.css](https://necolas.github.io/normalize.css/)** (его Scss версия)
19-
- Проверка кода осущетсвляется с помощью **[EsLint](http://eslint.org/)** (настройки в корне проекта, файл `.eslintrc`)
19+
- ~~Проверка кода осущетсвляется с помощью **[EsLint](http://eslint.org/)** (настройки в корне проекта, файл `.eslintrc`)~~
2020

21-
> Настройка путей для gulp тасков в файле `project.paths.json`
21+
> Настройка путей для gulp тасков в файле `project.config.json`
2222
23-
> Gulp таски вынесены в отдельный каталог `./gulp/`. В основном `gulpfile.js` настраиваются только основные таски для работы с проектом
23+
> Gulp таски вынесены в отдельный каталог `./gulp/`. В основном `gulpfile.babel.js` настраиваются только основные таски для работы с проектом
24+
25+
## TODO
26+
27+
> 2.1.1
28+
29+
- Добавить глобальные настройки для создания sourcemaps в dev режиме

gulp/images.gulp.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
'use strict';
22

33
import gulp from 'gulp';
4+
import cache from 'gulp-cache';
5+
import imagemin from 'gulp-imagemin';
46

57
gulp.task('images', () => {
6-
return gulp.src(`${config.paths.img_src}`)
8+
return gulp.src(config.paths.img_src)
79
.pipe(cache(imagemin({
810
optimizationLevel: 3,
911
progressive: true,
1012
interlaced: true
1113
})))
12-
.pipe(gulp.dest(`${config.paths.img_dist}`));
14+
.pipe(gulp.dest(config.paths.img_dist));
1315
})

gulp/modernizr.gulp.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
import gulp from 'gulp';
3+
import gulp from 'gulp';
44
import child_process from 'child_process';
55

66
const exec = child_process.exec;
@@ -9,7 +9,7 @@ const exec = child_process.exec;
99
gulp.task('modernizr', function (cb) {
1010
exec('modernizr -c modernizr-config.json -u -d ./dist/js/libs/', function (err, stdout, stderr) {
1111
console.log(stdout);
12-
console.log(stderr);
13-
cb(err);
12+
console.log(stderr);
13+
cb(err);
1414
});
1515
});

gulp/sass.gulp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ gulp.task('sass', () => {
3939
.pipe(debug({
4040
title: '* SASS ==> Done:'
4141
}))
42-
.pipe(gulp.dest(`${config.paths.css}`));
42+
.pipe(gulp.dest(config.paths.css));
4343
});

gulp/scripts.gulp.js

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,50 @@
11
'use strict';
22

3-
import gulp from 'gulp'
4-
import babelify from 'babelify';
3+
import gulp from 'gulp';
4+
5+
import ts from 'gulp-typescript';
6+
import tsify from 'tsify';
7+
8+
import babelify from 'babelify';
59
import browserify from 'browserify';
6-
import buffer from 'vinyl-buffer';
7-
import source from 'vinyl-source-stream';
8-
import uglify from 'gulp-uglify';
9-
import rename from "gulp-rename";
10-
import eslint from 'gulp-eslint';
11-
12-
gulp.task('lint', () => {
13-
return gulp.src(['./src/js/**/*.js', '!./src/js/libs/**/*.*'])
14-
.pipe(eslint())
15-
.pipe(eslint.format());
16-
});
17-
18-
gulp.task('libs', () => {
19-
return gulp.src(`${config.paths.es6}libs/`)
20-
.pipe(gulp.dest(`${config.paths.es5}`));
10+
import buffer from 'vinyl-buffer';
11+
import source from 'vinyl-source-stream';
12+
13+
import uglify from 'gulp-uglify';
14+
import rename from "gulp-rename";
15+
16+
import debug from 'gulp-debug';
17+
18+
gulp.task('libs:copy', () => {
19+
return gulp.src(config.paths.libs)
20+
.pipe(gulp.dest(config.paths.scripts));
2121
})
2222

23-
gulp.task('scripts', ['lint'], () => {
24-
const bundler = browserify(`${config.paths.es6}index.js`);
25-
bundler.transform(babelify);
26-
27-
bundler.bundle()
28-
.on('error', err => console.error(err))
29-
.pipe(source('scripts.js'))
30-
.pipe(buffer())
31-
.pipe(uglify())
32-
.pipe(rename({
33-
suffix: '.min'
34-
}))
35-
.pipe(gulp.dest(`${config.paths.es5}`));
23+
gulp.task('scripts', () => {
24+
const bundler = browserify({
25+
basedir: '.',
26+
debug: true,
27+
entries: [`${config.paths.ts}/index.ts`],
28+
cache: {},
29+
packageCache: {}
30+
});
31+
32+
bundler
33+
.plugin(tsify, { target: 'es6' })
34+
.transform(babelify.configure({ extensions: [".ts", ".js"] }));
35+
36+
return bundler.bundle()
37+
.on('error', err => console.error(err))
38+
.pipe(source('scripts.js'))
39+
.pipe(buffer())
40+
// .pipe(sourcemaps.init({loadMaps: true}))
41+
.pipe(uglify())
42+
.pipe(rename({
43+
suffix: '.min'
44+
}))
45+
// .pipe(sourcemaps.write('./'))
46+
.pipe(debug({
47+
title: '* TS ==> Done:'
48+
}))
49+
.pipe(gulp.dest(config.paths.scripts));
3650
});

gulp/watch.gulp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ gulp.task('watch', function () {
2828
});
2929
}).on('ready', localhost.reload);
3030

31-
watch(`${config.paths.es6}/**/*.js`, function () {
31+
watch(`${config.paths.ts}/**/*.ts`, function () {
3232
return sequence('scripts')(function (err) {
3333
if (err) console.log(err)
3434
});

gulpfile.babel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import gulp from 'gulp';
44
import sequence from 'gulp-sequence';
55
import requireDir from 'require-dir';
66

7-
global.config = require('./project.paths.json');
7+
global.config = require('./project.config.json');
88

99
requireDir('./gulp');
1010

11-
gulp.task('default', sequence(['clean', 'clear'], 'sass', 'pug', 'images', 'modernizr', 'scripts'));
11+
gulp.task('default', sequence(['clean', 'clear'], 'sass', 'pug', 'images', 'libs:copy', 'scripts', 'modernizr'));
1212

1313
gulp.task('dev', sequence('default', 'server', 'watch'));

0 commit comments

Comments
 (0)