mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
修复 windows 平台 npm run dist 任务异常的问题 (#301)
This commit is contained in:
parent
874dd0cefa
commit
fbcb691699
@ -7,6 +7,8 @@ const path = require('path');
|
|||||||
const components = require('./get-components')();
|
const components = require('./get-components')();
|
||||||
const dependencyTree = require('dependency-tree');
|
const dependencyTree = require('dependency-tree');
|
||||||
|
|
||||||
|
const SEP = path.sep;
|
||||||
|
|
||||||
components.forEach(componentName => {
|
components.forEach(componentName => {
|
||||||
const libDir = path.resolve(__dirname, '../../lib');
|
const libDir = path.resolve(__dirname, '../../lib');
|
||||||
const content = analyzeDependencies(componentName, libDir).map(component => `require('../../vant-css/${component}.css');`);
|
const content = analyzeDependencies(componentName, libDir).map(component => `require('../../vant-css/${component}.css');`);
|
||||||
@ -19,7 +21,7 @@ function analyzeDependencies(componentName, libDir) {
|
|||||||
search(dependencyTree({
|
search(dependencyTree({
|
||||||
directory: libDir,
|
directory: libDir,
|
||||||
filename: path.resolve(libDir, componentName, 'index.js'),
|
filename: path.resolve(libDir, componentName, 'index.js'),
|
||||||
filter: path => path.indexOf('vant/lib/') !== -1
|
filter: path => path.indexOf(`vant${SEP}lib${SEP}`) !== -1
|
||||||
}), checkList);
|
}), checkList);
|
||||||
return checkList.filter(component => checkComponentHasStyle(component));
|
return checkList.filter(component => checkComponentHasStyle(component));
|
||||||
}
|
}
|
||||||
@ -27,7 +29,7 @@ function analyzeDependencies(componentName, libDir) {
|
|||||||
function search(tree, checkList) {
|
function search(tree, checkList) {
|
||||||
tree && Object.keys(tree).forEach(key => {
|
tree && Object.keys(tree).forEach(key => {
|
||||||
search(tree[key], checkList);
|
search(tree[key], checkList);
|
||||||
const component = key.split('/vant/lib/')[1].replace('/index.js', '').replace('mixins/', '');
|
const component = key.split(`${SEP}vant${SEP}lib${SEP}`)[1].replace(`${SEP}index.js`, '').replace(`mixins${SEP}`, '');
|
||||||
if (checkList.indexOf(component) === -1) {
|
if (checkList.indexOf(component) === -1) {
|
||||||
checkList.push(component);
|
checkList.push(component);
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
"dev": "npm run build:file && webpack-dev-server --inline --config build/webpack.config.dev.js --content-base ./",
|
"dev": "npm run build:file && webpack-dev-server --inline --config build/webpack.config.dev.js --content-base ./",
|
||||||
"build:file": "node build/bin/build-entry.js",
|
"build:file": "node build/bin/build-entry.js",
|
||||||
"build:components": "node build/bin/build-components.js --color",
|
"build:components": "node build/bin/build-components.js --color",
|
||||||
"build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js --color && mkdir lib/vant-css && cp -R packages/vant-css/lib/ lib/vant-css",
|
"build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js --color",
|
||||||
"build:vant": "cross-env NODE_ENV=production webpack --progress --hide-modules --color --config build/webpack.build.js && cross-env NODE_ENV=production webpack -p --progress --hide-modules --color --config build/webpack.build.js",
|
"build:vant": "cross-env NODE_ENV=production webpack --progress --hide-modules --color --config build/webpack.build.js && cross-env NODE_ENV=production webpack -p --progress --hide-modules --color --config build/webpack.build.js",
|
||||||
"build:style-entry": "VUE_ENV=server node build/bin/build-style-entry.js",
|
"build:style-entry": "cross-env VUE_ENV=server node build/bin/build-style-entry.js",
|
||||||
"build:changelog": "sh build/bin/build-changelog.sh",
|
"build:changelog": "sh build/bin/build-changelog.sh",
|
||||||
"deploy": "npm run deploy:docs && npm run deploy:cdn && gh-pages -d docs/dist --remote youzan && rimraf docs/dist",
|
"deploy": "npm run deploy:docs && npm run deploy:cdn && gh-pages -d docs/dist --remote youzan && rimraf docs/dist",
|
||||||
"deploy:cdn": "superman cdn /zanui/vant docs/dist/*.js docs/dist/*.css && superman cdn /zanui/vant/async_en-US docs/dist/async_en-US/*.js && superman cdn /zanui/vant/async_zh-CN docs/dist/async_zh-CN/*.js",
|
"deploy:cdn": "superman cdn /zanui/vant docs/dist/*.js docs/dist/*.css && superman cdn /zanui/vant/async_en-US docs/dist/async_en-US/*.js && superman cdn /zanui/vant/async_zh-CN docs/dist/async_zh-CN/*.js",
|
||||||
@ -75,7 +75,10 @@
|
|||||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||||
"gh-pages": "^1.0.0",
|
"gh-pages": "^1.0.0",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
|
"gulp-clean-css": "^3.9.0",
|
||||||
"gulp-cssmin": "^0.2.0",
|
"gulp-cssmin": "^0.2.0",
|
||||||
|
"gulp-iconfont": "^9.0.2",
|
||||||
|
"gulp-iconfont-css": "^2.1.0",
|
||||||
"gulp-postcss": "^7.0.0",
|
"gulp-postcss": "^7.0.0",
|
||||||
"gulp-util": "^3.0.8",
|
"gulp-util": "^3.0.8",
|
||||||
"highlight.js": "^9.12.0",
|
"highlight.js": "^9.12.0",
|
||||||
@ -93,6 +96,7 @@
|
|||||||
"karma-webpack": "^2.0.4",
|
"karma-webpack": "^2.0.4",
|
||||||
"markdown-it": "^8.4.0",
|
"markdown-it": "^8.4.0",
|
||||||
"markdown-it-container": "^2.0.0",
|
"markdown-it-container": "^2.0.0",
|
||||||
|
"md5-file": "^3.2.3",
|
||||||
"mocha": "^3.4.2",
|
"mocha": "^3.4.2",
|
||||||
"postcss": "^6.0.14",
|
"postcss": "^6.0.14",
|
||||||
"postcss-calc": "^6.0.0",
|
"postcss-calc": "^6.0.0",
|
||||||
|
@ -35,7 +35,8 @@ gulp.task('compile', () => {
|
|||||||
.src('./src/*.css')
|
.src('./src/*.css')
|
||||||
.pipe(postcss())
|
.pipe(postcss())
|
||||||
.pipe(cssmin())
|
.pipe(cssmin())
|
||||||
.pipe(gulp.dest('./lib'));
|
.pipe(gulp.dest('./lib'))
|
||||||
|
.pipe(gulp.dest('../../lib/vant-css/'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('icon-font-ttf', () => {
|
gulp.task('icon-font-ttf', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user