UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 1.16 kB
{"version":3,"file":"calculate-outdir-size.mjs","names":[],"sources":["../../../../src/libs/cli/services/calculate-outdir-size.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nconst calculateOutDirSize = async (dirPath: string): Promise<number> => {\n\tlet totalSize = 0;\n\n\tconst calculateSize = async (currentPath: string): Promise<void> => {\n\t\tconst stats = await fs.stat(currentPath);\n\n\t\tif (stats.isFile()) {\n\t\t\ttotalSize += stats.size;\n\t\t} else if (stats.isDirectory()) {\n\t\t\tconst entries = await fs.readdir(currentPath);\n\t\t\tawait Promise.all(\n\t\t\t\tentries.map((entry) => calculateSize(path.join(currentPath, entry))),\n\t\t\t);\n\t\t}\n\t};\n\n\tawait calculateSize(dirPath);\n\treturn totalSize;\n};\n\nexport default calculateOutDirSize;\n"],"mappings":"yDAGA,MAAM,EAAsB,KAAO,IAAqC,CACvE,IAAI,EAAY,EAEV,EAAgB,KAAO,IAAuC,CACnE,IAAM,EAAQ,MAAM,EAAG,KAAK,CAAW,EAEvC,GAAI,EAAM,OAAO,EAChB,GAAa,EAAM,UACb,GAAI,EAAM,YAAY,EAAG,CAC/B,IAAM,EAAU,MAAM,EAAG,QAAQ,CAAW,EAC5C,MAAM,QAAQ,IACb,EAAQ,IAAK,GAAU,EAAc,EAAK,KAAK,EAAa,CAAK,CAAC,CAAC,CACpE,CACD,CACD,EAGA,OADA,MAAM,EAAc,CAAO,EACpB,CACR"}