Skip to content

Commit

Permalink
【fix】iclient漏打包g6 g2 l7
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Oct 8, 2024
1 parent 376c468 commit 1c548b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
6 changes: 3 additions & 3 deletions static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js

Large diffs are not rendered by default.

27 changes: 22 additions & 5 deletions test/unit/iclientExternalSpec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
const fs = require('fs');

const data = fs.readFileSync('./static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js', 'utf8');
if (data.includes('function(){try{return G6}catch(e){return {}}}()')) {
const path = './static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js';
const data = fs.readFileSync(path, 'utf8');

if (data.includes('function(){try{return G6}catch(e)')) {
throw new Error('iclient-mapboxgl需要保留g6, 注释掉g6 extrenals手动打包!');
}
if (data.includes('function(){try{return G2}catch(e){return {}}}()')) {
if (data.includes('function(){try{return G2}catch(e)')) {
throw new Error('iclient-mapboxgl需要保留g2, 注释掉g2 extrenals手动打包!');
}
if (data.includes('function(){try{return L7}catch(e){return {}}}()')) {
throw new Error('iclient-mapboxgl需要保留l7-render, 注释掉l7-render extrenals手动打包!')
if (data.includes('function(){try{return L7}catch(e)')) {
throw new Error('iclient-mapboxgl需要保留l7-render, 注释掉l7-render extrenals手动打包!');
}

fs.promises
.stat(path)
.then(stats => {
if (stats.isFile()) {
if (stats.size < 4 * 1024 * 1024) {
throw new Error('iclient-mapboxgl包体积过小,请检查g6、g2、l7-render是否被打包进来!');
}
} else {
throw new Error('路径指向的不是一个文件。');
}
})
.catch(error => {
console.error(error);
});

0 comments on commit 1c548b3

Please sign in to comment.