Add .gitignore to exclude all node packages and lock files
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.copyDir = copyDir;
|
||||
const node_fs_1 = __importDefault(require("node:fs"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
async function copyDir({ src, dest, onSymlinkDetected, onProgress, copiedBytes = 0, lastReportedProgress = 0, }) {
|
||||
await node_fs_1.default.promises.mkdir(dest, { recursive: true });
|
||||
const entries = await node_fs_1.default.promises.readdir(src, { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
const srcPath = node_path_1.default.join(src, entry.name);
|
||||
const destPath = node_path_1.default.join(dest, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
copiedBytes = await copyDir({
|
||||
src: srcPath,
|
||||
dest: destPath,
|
||||
onSymlinkDetected,
|
||||
onProgress,
|
||||
copiedBytes,
|
||||
lastReportedProgress,
|
||||
});
|
||||
}
|
||||
else if (entry.isSymbolicLink()) {
|
||||
const realpath = await node_fs_1.default.promises.realpath(srcPath);
|
||||
onSymlinkDetected(entry, src);
|
||||
await node_fs_1.default.promises.symlink(realpath, destPath);
|
||||
}
|
||||
else {
|
||||
const [, { size }] = await Promise.all([
|
||||
node_fs_1.default.promises.copyFile(srcPath, destPath),
|
||||
node_fs_1.default.promises.stat(srcPath),
|
||||
]);
|
||||
copiedBytes += size;
|
||||
if (copiedBytes - lastReportedProgress > 1024 * 1024 * 10) {
|
||||
onProgress(copiedBytes);
|
||||
lastReportedProgress = copiedBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
return copiedBytes;
|
||||
}
|
||||
Reference in New Issue
Block a user