Skip to content

Commit acc682b

Browse files
committed
build: reorganization order and add prettier
1 parent 9a97115 commit acc682b

File tree

4 files changed

+60
-26
lines changed

4 files changed

+60
-26
lines changed

.prettierignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
**/*.svg
2+
package.json
3+
/dist
4+
.dockerignore
5+
.DS_Store
6+
.eslintignore
7+
*.png
8+
*.toml
9+
docker
10+
.editorconfig
11+
Dockerfile*
12+
.gitignore
13+
.prettierignore
14+
LICENSE
15+
.eslintcache
16+
*.lock
17+
yarn-error.log
18+
.history

.prettierrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
module.exports = {
3+
singleQuote: true,
4+
trailingComma: 'all',
5+
printWidth: 100,
6+
proseWrap: 'never',
7+
overrides: [
8+
{
9+
files: '.prettierrc',
10+
options: {
11+
parser: 'json',
12+
},
13+
},
14+
],
15+
};

gulpfile.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
const { src, dest,parallel } = require('gulp');
1+
const { src, dest, parallel } = require('gulp');
22
const through = require('through2');
3-
const sass=require('gulp-sass');
3+
const sass = require('gulp-sass');
44
const concat = require('gulp-concat');
5-
function outputStyleTask () {
5+
function outputStyleTask() {
66
return src(['src/components/**/*.scss'])
7-
.pipe(through.obj(function (file, _, callback) {
8-
const pathName=file.relative.split('/')[0]
9-
this.push(pathName)
10-
callback()
11-
}))
12-
.on('data', (data) => {
13-
convertStyles(data)
14-
})
7+
.pipe(
8+
through.obj(function(file, _, callback) {
9+
const pathName = file.relative.split('/')[0];
10+
this.push(pathName);
11+
callback();
12+
}),
13+
)
14+
.on('data', data => {
15+
convertStyles(data);
16+
});
1517
}
16-
function convertStyles(data){
17-
return src(['src/components/'+String(data)+'/*.scss'])
18-
.pipe(dest('lib/'+String(data)+'/style/'))
19-
.pipe(sass())
20-
.pipe(dest('lib/'+String(data)+'/style/'))
18+
function convertStyles(data) {
19+
return src(['src/components/' + String(data) + '/*.scss'])
20+
.pipe(dest('lib/' + String(data) + '/style/'))
21+
.pipe(sass())
22+
.pipe(dest('lib/' + String(data) + '/style/'));
2123
}
2224

2325
//管道输出后会引用新位置,因此css和scss单独两个task
24-
function globalSass(){
26+
function globalSass() {
2527
return src('src/components/**/*.scss') //建议单独建个文件夹摆放,考虑到其他项目应用时也需相应更改,所以暂时先放打包文件根目录
26-
.pipe(concat('index.scss'))
27-
.pipe(dest('lib'))
28+
.pipe(concat('index.scss'))
29+
.pipe(dest('lib'));
2830
}
2931

30-
function globalCss(){
32+
function globalCss() {
3133
return src('src/components/**/*.scss')
32-
.pipe(concat('index.css'))
33-
.pipe(sass())
34-
.pipe(dest('lib'))
34+
.pipe(concat('index.css'))
35+
.pipe(sass())
36+
.pipe(dest('lib'));
3537
}
36-
exports.default = parallel(outputStyleTask,globalCss,globalSass)
38+
exports.default = parallel(outputStyleTask, globalCss, globalSass);

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
"module": "lib/index.js",
88
"types": "lib/index.d.ts",
99
"scripts": {
10-
"gulp": "gulp",
10+
"build-css": "gulp",
1111
"increase-memory-limit": "cross-env LIMIT=8096 increase-memory-limit",
1212
"storybook": "start-storybook -p 9001 -c .storybook",
1313
"build-storybook": "export NODE_ENV='production' && build-storybook -c .storybook -o dist",
14-
"build": "npm run build-ts && npm run gulp",
1514
"compile": "rm -rf lib && npm run build-ts && npm run build-css",
1615
"build-ts": "tsc -p tsconfig.build.json",
1716
"release": "./scripts/release.sh",

0 commit comments

Comments
 (0)