Skip to content

Commit

Permalink
Merge pull request #24 from aliaks-ei/refactor_project
Browse files Browse the repository at this point in the history
Refactored project
  • Loading branch information
aliaks-ei authored Aug 23, 2023
2 parents 9a9a53b + 2d5d2c5 commit 5766a3a
Show file tree
Hide file tree
Showing 162 changed files with 25,846 additions and 25,698 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/editorconfig.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: EditorConfig

on:
push:
branches:
- master
on: ['push']

jobs:
editorconfig-check:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['12', '14']
node-version: ['16']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test_e2e.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: E2E tests

on:
push:
branches:
- master
on: ['push']

jobs:
test-e2e:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['12', '14']
node-version: ['16']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@
[![](https://github.com/alexmozheyko/childde/workflows/E2E%20tests/badge.svg)](https://github.com/alexmozheyko/childde/actions?query=workflow%3A%22E2E+tests%22)
[![](https://github.com/alexmozheyko/childde/workflows/EditorConfig/badge.svg)](https://github.com/alexmozheyko/childde/actions?query=workflow%3AEditorConfig)

Fully mobile compatible UI part of knowledge exchange platform [child.de](https://child.de/)

### Run development server

```
npm run serve
```

### Run E2E tests

```
npm run test:e2e
```

### Verify files according to .editorconfig

```
npm run editorconfig:check
```

### Build application

```
npm run build
```
18 changes: 9 additions & 9 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"fileServerFolder": "./build",
"fixturesFolder": "./tests/e2e/fixtures",
"integrationFolder": "./tests/e2e/integration",
"pluginsFile": "./tests/e2e/plugins/index.js",
"supportFile": "./tests/e2e/support/index.js",
"videosFolder": "./tests/e2e/videos",
"screenshotsFolder": "./tests/e2e/screenshots",
"viewportWidth": 1366,
"viewportHeight": 768
"fileServerFolder": "./build",
"fixturesFolder": "./tests/e2e/fixtures",
"integrationFolder": "./tests/e2e/integration",
"pluginsFile": "./tests/e2e/plugins/index.js",
"supportFile": "./tests/e2e/support/index.js",
"videosFolder": "./tests/e2e/videos",
"screenshotsFolder": "./tests/e2e/screenshots",
"viewportWidth": 1366,
"viewportHeight": 768
}
125 changes: 69 additions & 56 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
const { src, dest, watch, series, parallel } = require('gulp');

const babel = require('gulp-babel');
const pug = require('gulp-pug');
const postcss = require('gulp-postcss');
const concat = require('gulp-concat');
const plumber = require('gulp-plumber');
const livereload = require('gulp-livereload');
const svgSymbols = require('gulp-svg-symbols');
const csso = require('gulp-csso');
const minify = require('gulp-minify');
const rename = require('gulp-rename');
const addsrc = require('gulp-add-src');
const sass = require('gulp-sass')(require('sass'));
const mjml = require('gulp-mjml');
const autoprefixer = require('autoprefixer');
const del = require('del');
const postcssPresetEnv = require('postcss-preset-env');
const mjmlEngine = require('mjml');
const { src, dest, watch, series, parallel } = require("gulp");

const babel = require("gulp-babel");
const pug = require("gulp-pug");
const postcss = require("gulp-postcss");
const concat = require("gulp-concat");
const plumber = require("gulp-plumber");
const livereload = require("gulp-livereload");
const svgSymbols = require("gulp-svg-symbols");
const csso = require("gulp-csso");
const minify = require("gulp-minify");
const rename = require("gulp-rename");
const addsrc = require("gulp-add-src");
const sass = require("gulp-sass")(require("sass"));
const mjml = require("gulp-mjml");
const autoprefixer = require("autoprefixer");
const del = require("del");
const postcssPresetEnv = require("postcss-preset-env");
const mjmlEngine = require("mjml");

const paths = {
css: [
'src/assets/styles/variables.scss',
'src/assets/styles/global.scss',
'src/common.blocks/**/*.scss',
'!src/common.blocks/**/m.*.scss'
"src/assets/styles/variables.scss",
"src/assets/styles/global.scss",
"src/common.blocks/**/*.scss",
"!src/common.blocks/**/m.*.scss",
],
mCss : [ 'src/assets/styles/m.global.scss', 'src/common.blocks/**/m.*.scss' ],
js : 'src/common.blocks/**/*.js',
html : 'src/pages/*.pug',
images : 'src/assets/images/*',
icons : 'src/assets/icons/*.svg',
mailers : 'src/pages/mailers/*.pug'
mCss: ["src/assets/styles/m.global.scss", "src/common.blocks/**/m.*.scss"],
js: "src/common.blocks/**/*.js",
html: "src/pages/*.pug",
images: "src/assets/images/*",
icons: "src/assets/icons/*.svg",
mailers: "src/pages/mailers/*.pug",
};

function cleanBuild() {
return del('build/**/*');
return del("build/**/*");
}

function svgSprites(cb) {
src(paths.icons)
.pipe(svgSymbols())
.pipe(dest('build/assets/icons'))
.pipe(dest("build/assets/icons"))
.pipe(livereload());

cb();
Expand All @@ -50,7 +50,7 @@ function html(cb) {
src(paths.html)
.pipe(plumber())
.pipe(pug())
.pipe(dest('build'))
.pipe(dest("build"))
.pipe(livereload());

cb();
Expand All @@ -60,13 +60,13 @@ function css(cb) {
src(paths.css)
.pipe(addsrc.append(paths.mCss))
.pipe(plumber())
.pipe(postcss([ postcssPresetEnv(), autoprefixer() ]))
.pipe(concat('index.scss'))
.pipe(sass({ outputStyle: 'expanded' }).on('error', sass.logError))
.pipe(dest('build/css'))
.pipe(rename('index.min.css'))
.pipe(postcss([postcssPresetEnv(), autoprefixer()]))
.pipe(concat("index.scss"))
.pipe(sass({ outputStyle: "expanded" }).on("error", sass.logError))
.pipe(dest("build/css"))
.pipe(rename("index.min.css"))
.pipe(csso())
.pipe(dest('build/css'))
.pipe(dest("build/css"))
.pipe(livereload());

cb();
Expand All @@ -75,15 +75,17 @@ function css(cb) {
function js(cb) {
src(paths.js)
.pipe(plumber())
.pipe(concat('index.js'))
.pipe(babel({ presets: ['@babel/env'] }))
.pipe(minify({
ext: {
src :'.js',
min :'.min.js'
}
}))
.pipe(dest('build/js'))
.pipe(concat("index.js"))
.pipe(babel({ presets: ["@babel/env"] }))
.pipe(
minify({
ext: {
src: ".js",
min: ".min.js",
},
})
)
.pipe(dest("build/js"))
.pipe(livereload());

cb();
Expand All @@ -92,7 +94,7 @@ function js(cb) {
function images(cb) {
src(paths.images)
.pipe(plumber())
.pipe(dest('build/assets/images'))
.pipe(dest("build/assets/images"))
.pipe(livereload());

cb();
Expand All @@ -102,13 +104,13 @@ function mailers(cb) {
src(paths.mailers)
.pipe(plumber())
.pipe(pug())
.pipe(rename({ extname: '.mjml' }))
.pipe(dest('build/mailers'))
.pipe(rename({ extname: ".mjml" }))
.pipe(dest("build/mailers"))
.pipe(mjml(mjmlEngine, { minify: true }))
.pipe(dest('build/mailers'))
.pipe(dest("build/mailers"))
.pipe(livereload())
.on('end', function () {
del('build/mailers/*.mjml');
.on("end", function () {
del("build/mailers/*.mjml");
});

cb();
Expand All @@ -119,8 +121,16 @@ function watchChanges() {

livereload({ start: true });

watch([ 'src/pages/*.pug', 'src/common.blocks/**/*.pug' ], { ignoreInitial }, html);
watch([ 'src/assets/styles/*.scss', 'src/common.blocks/**/*.scss' ], { ignoreInitial }, css);
watch(
["src/pages/*.pug", "src/common.blocks/**/*.pug"],
{ ignoreInitial },
html
);
watch(
["src/assets/styles/*.scss", "src/common.blocks/**/*.scss"],
{ ignoreInitial },
css
);
watch(paths.js, { ignoreInitial }, js);
watch(paths.images, { ignoreInitial }, images);
watch(paths.icons, { ignoreInitial }, svgSprites);
Expand All @@ -130,4 +140,7 @@ function watchChanges() {
}

exports.serve = series(cleanBuild, watchChanges);
exports.build = series(cleanBuild, parallel(html, css, js, images, svgSprites, mailers));
exports.build = series(
cleanBuild,
parallel(html, css, js, images, svgSprites, mailers)
);
Loading

0 comments on commit 5766a3a

Please sign in to comment.