Skip to content

Commit 7437c18

Browse files
committed
build: update build system, close #320
1 parent e8e3574 commit 7437c18

9 files changed

Lines changed: 124 additions & 109 deletions

File tree

.browserslistrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
last 2 versions

.clintonrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"ignores": [
3+
"test/**",
4+
"tmp/**",
5+
"lib/**",
6+
"*.{html,jpg}"
7+
],
8+
"rules": {
9+
"pkg-main": [
10+
"off"
11+
],
12+
"xo": [
13+
"off"
14+
],
15+
"ava": [
16+
"off"
17+
]
18+
}
19+
}

.eslintrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"parser": "babel-eslint",
3+
"plugins": [
4+
"ava",
5+
"xo",
6+
"babel",
7+
"markdown",
8+
"html"
9+
],
10+
"extends": [
11+
"xo",
12+
"plugin:xo/recommended",
13+
"plugin:ava/recommended"
14+
],
15+
"globals": {
16+
"hljs": true,
17+
"test": true,
18+
"fixture": true
19+
},
20+
"rules": {
21+
"no-unused-expressions": [0, { "allowShortCircuit": true}]
22+
}
23+
}

.huskyrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"hooks": {
3+
"pre-push": "npm t",
4+
"pre-commit": "clinton && lint-staged",
5+
"commit-msg": "commitlint --extends=@commitlint/config-angular -e"
6+
}
7+
}

.lintstagedrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"*.{js,html}": "eslint",
3+
"*.md": "eslint",
4+
"src/**/*.css": "stylelint"
5+
6+
}

.postcssrc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"no-map": true,
3+
"plugins": {
4+
"postcss-devtools": {},
5+
"stylefmt": {},
6+
"postcss-easy-import": {
7+
"prefix": "_",
8+
"extensions": ".css"
9+
},
10+
"postcss-each": {},
11+
"postcss-mixins": {},
12+
"postcss-at-rules-variables": {},
13+
"postcss-for": {},
14+
"postcss-custom-properties": {
15+
"preserve": false
16+
},
17+
"postcss-conditionals": {},
18+
"postcss-nested": {},
19+
"postcss-calc": {
20+
"precision": 6
21+
},
22+
"postcss-flow-root": {},
23+
"postcss-initial": {},
24+
"postcss-reduce-initial": {},
25+
"autoprefixer": {},
26+
"postcss-sorting": {},
27+
"postcss-csso": {}
28+
}
29+
}

.posthtmlrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"input": "src/docs/*.html",
3+
"output": "docs",
4+
"plugins": {
5+
"posthtml-extend": {
6+
"root": "src/docs/"
7+
},
8+
"posthtml-modules": {
9+
"root": "src/docs/",
10+
"from": "src/docs/layout/"
11+
},
12+
"posthtml-spaceless": {}
13+
}
14+
}

.stylelintrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"plugins": [
3+
"stylelint-csstree-validator"
4+
],
5+
"extends": "stylelint-config-standard",
6+
"rules": {
7+
"function-whitespace-after": null,
8+
"at-rule-no-unknown": null
9+
}
10+
}

package.json

Lines changed: 15 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@
1616
"node": ">=8"
1717
},
1818
"scripts": {
19-
"precommit": "clinton && lint-staged",
20-
"commitmsg": "commitlint --extends=@commitlint/config-angular -e",
21-
"prepublish": "npm run build",
22-
"postpublish": "conventional-changelog -i changelog.md -s -r 0 && git commit -am \"build: update changelog\"",
19+
"version": "conventional-changelog -i changelog.md -s -r 0 && git commit -am \"build: update changelog\"",
20+
2321
"test": "npm run test:e2e",
2422
"test:e2e": "npm run build && npm run testcafe",
2523
"testcafe": "testcafe all tests/e2e/*-test.js --app \"http-server ./ -s\"",
26-
"html": "node src/build/html.js",
24+
25+
"precommit": "clinton && lint-staged",
26+
"commitmsg": "commitlint --extends=@commitlint/config-angular -e",
27+
28+
"prepare": "npm run build",
29+
"build": "npm run css && npm run html",
30+
"html": "rimraf docs/*.html && posthtml",
31+
"css": "rimraf {docs,dist}/css/*.css && postcss -o dist/css/slims.min.css src/css/slims.css && cp -a dist/. docs/",
32+
2733
"coverage": "nyc report --reporter=text-lcov | coveralls",
28-
"css": "postcss --no-map -o dist/css/slims.min.css src/css/slims.css && cp -a dist/. docs/",
29-
"build": "rimraf dist && npm run css && npm run html",
34+
35+
"lint": "eslint {src,test}/*.js *.md --fix",
36+
"pretest": "clinton && npm run lint",
37+
3038
"watch:docs": "chokidar src/docs/**/* -c \"npm run html\"",
3139
"watch:css": "chokidar src/css/**/* -c \"npm run css\"",
3240
"watch": "npm run watch:docs | npm run watch:css",
@@ -88,107 +96,5 @@
8896
"stylelint-config-standard": "^18.3.0",
8997
"stylelint-csstree-validator": "^1.4.0",
9098
"testcafe": "^1.3.0"
91-
},
92-
"lint-staged": {
93-
"*.{js,html}": "eslint",
94-
"*.md": "eslint",
95-
"src/**/*.css": "stylelint"
96-
},
97-
"browserslist": [
98-
"last 2 versions"
99-
],
100-
"posthtml": {
101-
"extend": {
102-
"root": "src/docs/"
103-
},
104-
"modules": {
105-
"root": "src/docs/",
106-
"from": "src/docs/layout/"
107-
}
108-
},
109-
"postcss": {
110-
"plugins": {
111-
"postcss-devtools": {},
112-
"stylefmt": {},
113-
"postcss-easy-import": {
114-
"prefix": "_",
115-
"extensions": ".css"
116-
},
117-
"postcss-each": {},
118-
"postcss-mixins": {},
119-
"postcss-at-rules-variables": {},
120-
"postcss-for": {},
121-
"postcss-custom-properties": {
122-
"preserve": false
123-
},
124-
"postcss-conditionals": {},
125-
"postcss-nested": {},
126-
"postcss-calc": {
127-
"precision": 6
128-
},
129-
"postcss-flow-root": {},
130-
"postcss-initial": {},
131-
"postcss-reduce-initial": {},
132-
"autoprefixer": {},
133-
"postcss-sorting": {},
134-
"postcss-csso": {}
135-
}
136-
},
137-
"eslintConfig": {
138-
"parser": "babel-eslint",
139-
"plugins": [
140-
"ava",
141-
"xo",
142-
"babel",
143-
"markdown",
144-
"html"
145-
],
146-
"extends": [
147-
"xo",
148-
"plugin:xo/recommended",
149-
"plugin:ava/recommended"
150-
],
151-
"globals": {
152-
"hljs": true,
153-
"test": true,
154-
"fixture": true
155-
},
156-
"rules": {
157-
"no-unused-expressions": [
158-
0,
159-
{
160-
"allowShortCircuit": true
161-
}
162-
]
163-
}
164-
},
165-
"stylelint": {
166-
"rules": {
167-
"function-whitespace-after": null,
168-
"at-rule-no-unknown": null
169-
},
170-
"plugins": [
171-
"stylelint-csstree-validator"
172-
],
173-
"extends": "stylelint-config-standard"
174-
},
175-
"clinton": {
176-
"ignores": [
177-
"test/**",
178-
"tmp/**",
179-
"lib/**",
180-
"*.{html,jpg}"
181-
],
182-
"rules": {
183-
"pkg-main": [
184-
"off"
185-
],
186-
"xo": [
187-
"off"
188-
],
189-
"ava": [
190-
"off"
191-
]
192-
}
19399
}
194100
}

0 commit comments

Comments
 (0)