Skip to content

Commit 0a910fa

Browse files
committed
[update] 更换复制插件
review by qiul ;reivew by yangtt; edit by zhaoq
1 parent 0ff5043 commit 0a910fa

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

build/publish.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
var fs = require('fs');
22
var path = require('path');
3+
const fse = require('fs-extra')
4+
35
var key = process.argv[2] ? process.argv[2].replace("--", "") : "leaflet";
46
var filePath = path.join(__dirname, "../dist");
57
var destDir = path.join(__dirname, "../src/" + key + "/dist");
@@ -40,4 +42,12 @@ fs.readdir(path.join(filePath, key), function (err, files) {
4042
})
4143
}
4244
})
45+
});
46+
47+
// 拷贝resources文件夹到src/mapboxgl
48+
const resourcePath = path.join(__dirname, "../dist/resources");
49+
const srouceDestDir = path.join(__dirname, "../src/mapboxgl/resources");
50+
fse.copy(resourcePath, srouceDestDir, err => {
51+
if (err) {throw err}
52+
console.log('success')
4353
})

build/webpack.config.mapboxgl.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ const configBase = require('./webpack.config.base');
33
const libName = 'mapboxgl';
44
//产品包名
55
const productName = 'iclient-mapboxgl';
6+
//复制文件
7+
const CopyPlugin = require("copy-webpack-plugin");
68

79
module.exports = {
810
target: configBase.target,
@@ -62,5 +64,10 @@ module.exports = {
6264
return moduleRules;
6365
})()
6466
},
65-
plugins: configBase.plugins(libName, productName)
67+
plugins: [
68+
...configBase.plugins(libName, productName),
69+
new CopyPlugin([
70+
{ from: `${__dirname}/../dist/resources/symbols`, to: `${__dirname}/../dist/mapboxgl/resources/symbols`}
71+
])
72+
]
6673
};

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"release": "npm run release-leaflet && npm run release-openlayers && npm run release-mapboxgl && npm run release-classic && npm run release-maplibregl",
1515
"release-leaflet": "npm run release-leaflet-es5 && npm run release-leaflet-es6",
1616
"release-openlayers": "npm run release-openlayers-es5 && npm run release-openlayers-es6 && npm run release-ol-es5 && npm run release-ol-es6",
17-
"release-mapboxgl": "npm run release-mapboxgl-es5 && npm run release-mapboxgl-es6 && copyfiles -u 1 ./dist/resources/** ./dist/mapboxgl/",
17+
"release-mapboxgl": "npm run release-mapboxgl-es5 && npm run release-mapboxgl-es6",
1818
"release-maplibregl": "npm run release-maplibregl-es5 && npm run release-maplibregl-es6",
1919
"release-classic": "npm run release-classic-es5 && npm run release-classic-es6",
2020
"release-leaflet-es5": "cross-env moduleVersion=es5 npm run deploy-leaflet && uglifyjs ./dist/leaflet/iclient-leaflet.js --ecma 5 --comments /iclient-/i -c -m -o ./dist/leaflet/iclient-leaflet.min.js && cleancss -o ./dist/leaflet/iclient-leaflet.min.css ./dist/leaflet/iclient-leaflet.css",
@@ -47,9 +47,8 @@
4747
"build-docs-mapboxgl": "rimraf ./docs/mapboxgl && jsdoc -c ./build/jsdocs/mapboxgl/docs.json -R ./build/jsdocs/mapboxgl/index.md",
4848
"build-docs-maplibregl": "rimraf ./docs/maplibregl && jsdoc -c ./build/jsdocs/maplibregl/docs.json -R ./build/jsdocs/maplibregl/index.md",
4949
"build-docs-classic": "rimraf ./docs/classic && jsdoc -c ./build/jsdocs/classic/docs.json -R ./build/jsdocs/classic/index.md",
50-
"pre-publish": "node ./build/publish.js --leaflet && node ./build/publish.js --openlayers && node ./build/publish.js --mapboxgl && node ./build/publish.js --maplibregl && node ./build/publish.js --classic && npm run pre-publish-symbol",
51-
"publish": "npm run pre-publish && cd ./src/common && npm publish && cd ../leaflet && npm publish && cd ../openlayers && npm publish && cd ../mapboxgl && npm publish && cd ../maplibregl && npm publish && cd ../classic && npm publish",
52-
"pre-publish-symbol": "copyfiles -u 1 ./dist/resources/** ./src/mapboxgl/ "
50+
"pre-publish": "node ./build/publish.js --leaflet && node ./build/publish.js --openlayers && node ./build/publish.js --mapboxgl && node ./build/publish.js --maplibregl && node ./build/publish.js --classic",
51+
"publish": "npm run pre-publish && cd ./src/common && npm publish && cd ../leaflet && npm publish && cd ../openlayers && npm publish && cd ../mapboxgl && npm publish && cd ../maplibregl && npm publish && cd ../classic && npm publish"
5352
},
5453
"keywords": [
5554
"SuperMap",
@@ -87,7 +86,6 @@
8786
"chromedriver": "87.0.5",
8887
"clean-css-cli": "^4.3.0",
8988
"commander": "^9.0.0",
90-
"copyfiles": "^2.4.1",
9189
"cross-env": "^7.0.2",
9290
"css-loader": "^6.7.1",
9391
"elasticsearch": "16.7.3",
@@ -96,6 +94,7 @@
9694
"eslint-plugin-import": "^2.22.1",
9795
"eslint-webpack-plugin": "^2.1.0",
9896
"express": "^4.17.1",
97+
"fs-extra": "^11.1.1",
9998
"get-pixels": "^3.3.2",
10099
"image-size": "^0.9.2",
101100
"istanbul": "^0.4.5",

0 commit comments

Comments
 (0)