mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
build(cleanupNodeModules): use path.join and basePath for extraFoldersDelete
This commit is contained in:
parent
6fe23f9a13
commit
1150f78b15
@ -18,7 +18,8 @@ function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupNodeModules(basePath: string) {
|
function cleanupNodeModules(basePath: string) {
|
||||||
const nodeModulesContent = fs.readdirSync(path.join(basePath, "./node_modules"), { recursive: true, withFileTypes: true });
|
const nodeModulesDirPath = path.join(basePath, "node_modules");
|
||||||
|
const nodeModulesContent = fs.readdirSync(nodeModulesDirPath, { recursive: true, withFileTypes: true });
|
||||||
//const libDir = fs.readdirSync(path.join(basePath, "./libraries"), { recursive: true, withFileTypes: true });
|
//const libDir = fs.readdirSync(path.join(basePath, "./libraries"), { recursive: true, withFileTypes: true });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +40,6 @@ function cleanupNodeModules(basePath: string) {
|
|||||||
.filter(el => el.isDirectory() && filterableDirs.has(el.name))
|
.filter(el => el.isDirectory() && filterableDirs.has(el.name))
|
||||||
.forEach(dir => fs.removeSync(path.join(dir.parentPath, dir.name)));
|
.forEach(dir => fs.removeSync(path.join(dir.parentPath, dir.name)));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete unnecessary files based on file extension
|
* Delete unnecessary files based on file extension
|
||||||
* TODO filter out useless (README).md files
|
* TODO filter out useless (README).md files
|
||||||
@ -57,17 +57,16 @@ function cleanupNodeModules(basePath: string) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete specific unnecessary folders
|
* Delete specific unnecessary folders
|
||||||
* TODO: use basePath
|
|
||||||
* TODO: check if we want removeSync to throw an error, if path does not exist anymore -> currently it will silently fail
|
* TODO: check if we want removeSync to throw an error, if path does not exist anymore -> currently it will silently fail
|
||||||
*/
|
*/
|
||||||
const extraFoldersDelete = new Set([
|
const extraFoldersDelete = new Set([
|
||||||
'build/node_modules/@excalidraw/excalidraw/dist/dev',
|
path.join(nodeModulesDirPath, "@excalidraw", "excalidraw", "dist", "dev"),
|
||||||
'build/node_modules/boxicons/svg',
|
path.join(nodeModulesDirPath, "boxicons", "svg"),
|
||||||
'build/node_modules/boxicons/node_modules',
|
path.join(nodeModulesDirPath, "boxicons", "node_modules"),
|
||||||
'build/node_modules/boxicons/src',
|
path.join(nodeModulesDirPath, "boxicons", "src"),
|
||||||
'build/node_modules/boxicons/iconjar',
|
path.join(nodeModulesDirPath, "boxicons", "iconjar"),
|
||||||
'build/node_modules/@jimp/plugin-print/fonts',
|
path.join(nodeModulesDirPath, "@jimp", "plugin-print", "fonts"),
|
||||||
'build/node_modules/jimp/dist/browser'
|
path.join(nodeModulesDirPath, "jimp", "dist", "browser") // missing "@" in front of jimp is not a typo here
|
||||||
]);
|
]);
|
||||||
|
|
||||||
nodeModulesContent
|
nodeModulesContent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user