[Optimize] Clean up the file (#12001)

This commit is contained in:
SijieWang
2022-07-14 22:03:52 +08:00
committed by GitHub
parent debd809319
commit 98bdb2d86b
2 changed files with 43 additions and 1 deletions
+1 -1
View File
@@ -23,7 +23,7 @@
"bundle-adapter": "node ./scripts/bundle-adapter.js",
"build-const": "node ./scripts/build-consts.js",
"clear": "git clean -xfd",
"clear-platform": "node ./native/utils/clear-platform.js",
"clear-platform": "node ./native/utils/clear-platform.js && node ./scripts/clear-file.js",
"update:native-external": "node ./native/utils/update-external.js",
"test": "gulp test",
"install:typedoc-plugin": "cd ./scripts/typedoc-plugin && npm install --only=production",
+42
View File
@@ -0,0 +1,42 @@
'use strict';
const { readdirSync, statSync, unlinkSync } = require('fs');
const { join } = require('path');
(() => {
let total = 0;
let m = 0;
function step(dir) {
total++;
const names = readdirSync(dir);
names.forEach((name) => {
const file = join(dir, name);
const stat = statSync(file);
if (stat.isDirectory()) {
step(file);
} else {
if (
/\.d\.ts$/.test(file) ||
/\.md$/.test(file) ||
/\.markdown$/.test(file)
) {
m++;
unlinkSync(file);
} else {
total++;
}
}
});
}
const root = join(__dirname, '../node_modules');
step(root);
const xcode = join(__dirname, './native-pack-tool/xcode/node_modules');
step(xcode);
console.log(`${total} - ${m}`);
})();