Estoy usando Node.js para copiar algunos archivos para uno de mis paquetes. Mi OS es Windows 10 Pro . Cuando ejecuto el archivo JS (probado en cmd , powershell y cmd con admin) no pasa absolutamente nada. Sin error, sin copia. Aquí está el código:
#! /usr/bin/env node let fs = require("fs"); let path = require("path"); let rootPath = path.join(__dirname, ".."); let root = fs.readdirSync(rootPath); let exclude = [ ".git", ".gitignore", ".prettierrc", "bin", "node_modules", "dist", ]; root = root.filter((item) => exclude.indexOf(item) === -1); let rootFiles = root.filter((item) => fs.statSync(path.join(__dirname, "..", item)).isFile() ); let rootFolders = root.filter((item) => fs.statSync(path.join(__dirname, "..", item)).isDirectory() ); for (let file of rootFiles) { let filePath = path.join(rootPath, file); let destinationPath = path.join(process.cwd(), file); if (!fs.existsSync(filePath)) { fs.copyFileSync(filePath, destinationPath); } } process.exit(0);