Skip to content

Commit 53090e8

Browse files
authored
Merge pull request #501 from jakub300/rewrite-with-webpack-update-tests
Minify Styles & Update Tests
2 parents 7219131 + 51ef219 commit 53090e8

File tree

6 files changed

+159
-249
lines changed

6 files changed

+159
-249
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_js:
44
- 10.14.2
55
- 10
66
- 12
7+
- 14
78
cache:
89
yarn: true
910
# addons:
@@ -17,6 +18,7 @@ services:
1718
before_script:
1819
- yarn prepare-links
1920
- cd packages/chisel-plugin-wordpress; yarn prepare; cd -;
21+
- export FORCE_COLOR=3
2022

2123
after_script:
2224
- npm install -g codecov

__tests__/fe/__snapshots__/add-page.js.snap

+140-80
Large diffs are not rendered by default.

__tests__/fe/build/__snapshots__/0.js.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Array [
88
99
scripts/app.98db252c.full.js 4.41 KiB 1.35 KiB
1010
scripts/app.98db252c.js 1.18 KiB 0.59 KiB
11-
[34mstyles/main.--HASH--.full.css[39m 18.52 KiB 4.79 KiB
12-
[34mstyles/main.--HASH--.css[39m 5.20 KiB 1.86 KiB
11+
[34mstyles/main.--HASH--.full.css[39m 18.92 KiB 4.85 KiB
12+
[34mstyles/main.--HASH--.css[39m 5.25 KiB 1.88 KiB
1313
1414
Images and other types of assets omitted.
1515
",
@@ -36,8 +36,8 @@ Array [
3636
3737
scripts/app.98db252c.full.js 4.41 KiB 1.35 KiB
3838
scripts/app.98db252c.js 1.18 KiB 0.59 KiB
39-
[34mstyles/main.--HASH--.full.css[39m 18.52 KiB 4.79 KiB
40-
[34mstyles/main.--HASH--.css[39m 5.20 KiB 1.86 KiB
39+
[34mstyles/main.--HASH--.full.css[39m 18.92 KiB 4.85 KiB
40+
[34mstyles/main.--HASH--.css[39m 5.25 KiB 1.88 KiB
4141
4242
Images and other types of assets omitted.
4343
",

__tests__/wp/__snapshots__/wp-config.js.snap

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Array [
66
"",
77
],
88
Array [
9-
"ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (--ERROR-DETAILS-)",
9+
"Error: Failed to get current SQL modes. Reason: ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (--ERROR-DETAILS-)
10+
",
1011
],
1112
Array [
1213
"",

packages/generator-chisel/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html

+1-156
Original file line numberDiff line numberDiff line change
@@ -10,162 +10,7 @@
1010
>
1111
<!-- prettier-ignore -->
1212
<style>
13-
html {
14-
font-size: 1em;
15-
line-height: 1.5;
16-
}
17-
18-
@media (min-width:768px) {
19-
html {
20-
font-size: 1.25em
21-
}
22-
}
23-
24-
@media (min-width:1024px) {
25-
html {
26-
font-size: 1.5em
27-
}
28-
}
29-
30-
body {
31-
background: #fff;
32-
color: #2a1468;
33-
font-family: Quicksand, sans-serif;
34-
padding: 1em
35-
}
36-
37-
a,
38-
a:link {
39-
color: #2a1468;
40-
text-decoration: underline;
41-
}
42-
43-
a:hover {
44-
color: #ff6d54;
45-
}
46-
47-
p {
48-
margin: 0 0 1em
49-
}
50-
51-
.c-wrapper {
52-
margin: 0 auto;
53-
max-width: 860px
54-
}
55-
56-
.c-section {
57-
margin-top: 0.5em;
58-
}
59-
60-
.c-section__content {
61-
font-size: 0.75em;
62-
}
63-
64-
.c-section__text a {
65-
font-weight: 500;
66-
}
67-
68-
.c-section__intro {
69-
font-size: 1em;
70-
font-weight: 600;
71-
}
72-
73-
.c-section:last-child {
74-
margin-top: 2em;
75-
}
76-
77-
.c-section__note {
78-
margin-top: 1em
79-
}
80-
81-
.c-section__note:not(:last-child) {
82-
display: none
83-
}
84-
85-
.c-page-title {
86-
margin: 0;
87-
font-size: 1.5em;
88-
}
89-
90-
.c-page-subtitle {
91-
margin: 1.5em 0 0;
92-
font-size: 1em;
93-
}
94-
95-
.c-page-subtitle,
96-
.c-heading {
97-
border-bottom: 3px solid #ff6d54;
98-
display: inline-block;
99-
font-weight: 600;
100-
}
101-
102-
.c-intro {
103-
font-size: 1em;
104-
font-weight: 600;
105-
margin: 0 1em 1.9em 0;
106-
line-height: 1.5;
107-
}
108-
109-
.c-heading {
110-
margin: 0 0 .5em;
111-
font-size: 1.35em;
112-
}
113-
114-
.c-list {
115-
list-style: none;
116-
margin: 0;
117-
padding: 0
118-
}
119-
120-
.c-list li {
121-
margin-bottom: .5em;
122-
padding-left: 1em;
123-
position: relative
124-
}
125-
126-
.c-list li:before {
127-
background: #ff6d54;
128-
content: "";
129-
display: block;
130-
height: .5em;
131-
left: 0;
132-
position: absolute;
133-
top: .5em;
134-
width: .5em
135-
}
136-
137-
.c-page {
138-
text-decoration: none;
139-
position: relative;
140-
display: block;
141-
border-bottom: 1px dashed #ccc;
142-
padding-bottom: .5em
143-
}
144-
145-
.c-page__link {
146-
font-weight: 600;
147-
}
148-
149-
.c-page__name {
150-
color: #2a1468;
151-
margin-left: .5em;
152-
position: absolute;
153-
top: 0;
154-
right: 0
155-
}
156-
157-
.c-page:hover .c-page__name {
158-
color: #ff6d54
159-
}
160-
161-
.c-section__code {
162-
padding: 0.9rem 0.8rem;
163-
overflow: auto;
164-
display: block;
165-
background: #2d2b57;
166-
color: #e3dfff;
167-
border-radius: 10px;
168-
}
13+
html{font-size:1em;line-height:1.5}@media (min-width:768px){html{font-size:1.25em}}@media (min-width:1024px){html{font-size:1.5em}}body{background:#fff;color:#2a1468;font-family:Quicksand,sans-serif;padding:1em}a,a:link{color:#2a1468;text-decoration:underline}a:hover{color:#ff6d54}p{margin:0 0 1em}.c-wrapper{margin:0 auto;max-width:860px}.c-section{margin-top:.5em}.c-section__content{font-size:.75em}.c-section__text a{font-weight:500}.c-section__intro{font-size:1em;font-weight:600}.c-section:last-child{margin-top:2em}.c-section__note{margin-top:1em}.c-section__note:not(:last-child){display:none}.c-page-title{margin:0;font-size:1.5em}.c-page-subtitle{margin:1.5em 0 0;font-size:1em}.c-heading,.c-page-subtitle{border-bottom:3px solid #ff6d54;display:inline-block;font-weight:600}.c-intro{font-size:1em;font-weight:600;margin:0 1em 1.9em 0;line-height:1.5}.c-heading{margin:0 0 .5em;font-size:1.35em}.c-list{list-style:none;margin:0;padding:0}.c-list li{margin-bottom:.5em;padding-left:1em;position:relative}.c-list li:before{background:#ff6d54;content:"";display:block;height:.5em;left:0;position:absolute;top:.5em;width:.5em}.c-page{text-decoration:none;position:relative;display:block;border-bottom:1px dashed #ccc;padding-bottom:.5em}.c-page__link{font-weight:600}.c-page__name{color:#2a1468;margin-left:.5em;position:absolute;top:0;right:0}.c-page:hover .c-page__name{color:#ff6d54}.c-section__code{padding:.9rem .8rem;overflow:auto;display:block;background:#2d2b57;color:#e3dfff;border-radius:10px}
16914
</style>
17015
<script type="text/x-chisel-pages-template">
17116
<ul class="c-list">

scripts/testSetup.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,14 @@ global.chiselTestHelpers = {
166166
});
167167

168168
if (consoleMock.mock.calls[1] && consoleMock.mock.calls[1][0]) {
169-
// in Ci in Node 12 there is difference in gzip compression
170-
// ex. https://travis-ci.org/github/xfiveco/generator-chisel/jobs/712710842
171-
if (parseInt(process.versions.node.split('.')[0], 10) >= '12') {
172-
consoleMock.mock.calls[1][0] = consoleMock.mock.calls[1][0].replace(
173-
'4.78 KiB',
174-
'4.79 KiB',
175-
);
169+
// in Ci in Node 12 and 14 there is difference in gzip compression
170+
// ex. https://travis-ci.com/github/jakub300/generator-chisel/builds/231019589
171+
const nodeVersion = parseInt(process.versions.node.split('.')[0], 10);
172+
const call = consoleMock.mock.calls[1][0];
173+
if (nodeVersion === 10) {
174+
consoleMock.mock.calls[1][0] = call.replace('4.86 KiB', '4.85 KiB');
175+
} else if (nodeVersion === 12) {
176+
consoleMock.mock.calls[1][0] = call.replace('1.87 KiB', '1.88 KiB');
176177
}
177178
}
178179
},
@@ -185,7 +186,8 @@ global.chiselTestHelpers = {
185186
.replace(/dbrand\d+/g, '--DB-RAND--')
186187
.split(process.cwd())
187188
.join('--PROJECT-PATH--')
188-
.replace(/(?<=--PROJECT-PATH--)\\/g, '/'),
189+
.replace(/(?<=--PROJECT-PATH--)\\/g, '/')
190+
.replace(/Copyright &copy; 202\d /g, 'Copyright &copy; 2020 '),
189191
).toMatchSnapshot();
190192
},
191193

0 commit comments

Comments
 (0)