Comparing version 0.0.3 to 0.0.5
"use strict"; | ||
// class/DirectoryCleaner.ts | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -29,4 +20,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
// ============================================================================ | ||
const fs_1 = require("fs"); | ||
const path_1 = __importDefault(require("path")); | ||
var fs_1 = require("fs"); | ||
var path_1 = __importDefault(require("path")); | ||
// ============================================================================ | ||
@@ -40,23 +31,21 @@ // Classes | ||
*/ | ||
cleanDirectory(dirPath) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const files = yield fs_1.promises.readdir(dirPath); | ||
for (const file of files) { | ||
const curPath = path_1.default.join(dirPath, file); | ||
const stat = yield fs_1.promises.lstat(curPath); | ||
if (stat.isDirectory()) { | ||
yield this.cleanDirectory(curPath); | ||
} | ||
else { | ||
yield fs_1.promises.unlink(curPath); | ||
} | ||
async cleanDirectory(dirPath) { | ||
try { | ||
const files = await fs_1.promises.readdir(dirPath); | ||
for (const file of files) { | ||
const curPath = path_1.default.join(dirPath, file); | ||
const stat = await fs_1.promises.lstat(curPath); | ||
if (stat.isDirectory()) { | ||
await this.cleanDirectory(curPath); | ||
} | ||
yield fs_1.promises.rmdir(dirPath); | ||
else { | ||
await fs_1.promises.unlink(curPath); | ||
} | ||
} | ||
catch (error) { | ||
console.error(`Error cleaning directory ${dirPath}: ${error}`); | ||
throw error; // Rethrow the error for further handling if necessary | ||
} | ||
}); | ||
await fs_1.promises.rmdir(dirPath); | ||
} | ||
catch (error) { | ||
console.error(`Error cleaning directory ${dirPath}: ${error}`); | ||
throw error; // Rethrow the error for further handling if necessary | ||
} | ||
} | ||
@@ -63,0 +52,0 @@ } |
"use strict"; | ||
// class/DirectoryCopier.ts | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -29,4 +20,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
// ============================================================================ | ||
const path_1 = __importDefault(require("path")); | ||
const fs_1 = require("fs"); | ||
var path_1 = __importDefault(require("path")); | ||
var fs_1 = require("fs"); | ||
// ============================================================================ | ||
@@ -45,15 +36,13 @@ // Classes | ||
*/ | ||
copyFiles(srcDir, destDir) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const resolvedSrcDir = path_1.default.resolve(srcDir); | ||
const resolvedDestDir = path_1.default.resolve(destDir); | ||
yield this.recursiveCopy(resolvedSrcDir, resolvedDestDir); | ||
console.log(`Files copied from ${resolvedSrcDir} to ${resolvedDestDir}`); | ||
} | ||
catch (error) { | ||
console.error('Error copying files:', error); | ||
throw error; | ||
} | ||
}); | ||
async copyFiles(srcDir, destDir) { | ||
try { | ||
const resolvedSrcDir = path_1.default.resolve(srcDir); | ||
const resolvedDestDir = path_1.default.resolve(destDir); | ||
await this.recursiveCopy(resolvedSrcDir, resolvedDestDir); | ||
console.log(`Files copied from ${resolvedSrcDir} to ${resolvedDestDir}`); | ||
} | ||
catch (error) { | ||
console.error('Error copying files:', error); | ||
throw error; | ||
} | ||
} | ||
@@ -65,14 +54,12 @@ /** | ||
*/ | ||
recursiveCopy(srcDir, destDir) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield fs_1.promises.mkdir(destDir, { recursive: true }); | ||
const entries = yield fs_1.promises.readdir(srcDir, { withFileTypes: true }); | ||
for (let entry of entries) { | ||
const srcPath = path_1.default.join(srcDir, entry.name); | ||
const destPath = path_1.default.join(destDir, entry.name); | ||
entry.isDirectory() ? | ||
yield this.recursiveCopy(srcPath, destPath) : | ||
yield fs_1.promises.copyFile(srcPath, destPath); | ||
} | ||
}); | ||
async recursiveCopy(srcDir, destDir) { | ||
await fs_1.promises.mkdir(destDir, { recursive: true }); | ||
const entries = await fs_1.promises.readdir(srcDir, { withFileTypes: true }); | ||
for (let entry of entries) { | ||
const srcPath = path_1.default.join(srcDir, entry.name); | ||
const destPath = path_1.default.join(destDir, entry.name); | ||
entry.isDirectory() ? | ||
await this.recursiveCopy(srcPath, destPath) : | ||
await fs_1.promises.copyFile(srcPath, destPath); | ||
} | ||
} | ||
@@ -79,0 +66,0 @@ } |
"use strict"; | ||
// class/DirectoryGenerator.ts | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -29,4 +20,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
// ============================================================================ | ||
const fs_1 = require("fs"); | ||
const path_1 = __importDefault(require("path")); | ||
var fs_1 = require("fs"); | ||
var path_1 = __importDefault(require("path")); | ||
// ============================================================================ | ||
@@ -50,16 +41,14 @@ // Classes | ||
*/ | ||
createDirectories(basePath, directories) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
for (const dir of directories) { | ||
const dirPath = path_1.default.join(basePath, dir); | ||
yield fs_1.promises.mkdir(dirPath, { recursive: true }); | ||
console.log(`Directory created or already exists: ${dirPath}`); | ||
} | ||
async createDirectories(basePath, directories) { | ||
try { | ||
for (const dir of directories) { | ||
const dirPath = path_1.default.join(basePath, dir); | ||
await fs_1.promises.mkdir(dirPath, { recursive: true }); | ||
console.log(`Directory created or already exists: ${dirPath}`); | ||
} | ||
catch (error) { | ||
console.error(`Error creating directories: ${error}`); | ||
throw error; | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
console.error(`Error creating directories: ${error}`); | ||
throw error; | ||
} | ||
} | ||
@@ -66,0 +55,0 @@ } |
@@ -22,7 +22,7 @@ "use strict"; | ||
// Import | Utility Classes | ||
const DirectoryCleaner_1 = __importDefault(require("./class/DirectoryCleaner")); | ||
var DirectoryCleaner_1 = __importDefault(require("./class/DirectoryCleaner")); | ||
exports.DirectoryCleaner = DirectoryCleaner_1.default; | ||
const DirectoryCopier_1 = __importDefault(require("./class/DirectoryCopier")); | ||
var DirectoryCopier_1 = __importDefault(require("./class/DirectoryCopier")); | ||
exports.DirectoryCopier = DirectoryCopier_1.default; | ||
const DirectoryCreator_1 = __importDefault(require("./class/DirectoryCreator")); | ||
var DirectoryCreator_1 = __importDefault(require("./class/DirectoryCreator")); | ||
exports.DirectoryCreator = DirectoryCreator_1.default; |
{ | ||
"name": "pack.gl", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"description": "Package Builder.", | ||
@@ -14,4 +14,4 @@ "keywords": [ | ||
"homepage": "https://www.pack.gl/", | ||
"main": "js/index.js", | ||
"types": "js/index.d.ts", | ||
"main": "js/index", | ||
"types": "js/index", | ||
"files": [ | ||
@@ -18,0 +18,0 @@ "svg/**/*.svg", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
60668
1226