UNPKG

rn-logo-replacer

Version:

This is a project aiming at remplacing the logo of a react native app with a single npx command

51 lines (50 loc) 2.36 kB
"use strict"; 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) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Copy = void 0; const fileOperation_1 = require("./fileOperation"); const directoryManagement_1 = require("../utils/directoryManagement"); const fs_extra_1 = __importDefault(require("fs-extra")); class Copy extends fileOperation_1.FileOperation { constructor(source, destination) { super(source, destination); } // Method to display the source and destination displayPaths() { console.log(`Source: ${this.source}`); console.log(`Destination: ${this.destination}`); } execute() { const _super = Object.create(null, { execute: { get: () => super.execute } }); return __awaiter(this, void 0, void 0, function* () { yield _super.execute.call(this); // Making sure that the folders exists const isSourceFolder = (0, directoryManagement_1.ensureFolderExists)(this.source, false); const isDestinationFolder = (0, directoryManagement_1.ensureFolderExists)(this.destination, true); // Copying the files try { // Ensure the destination directory exists yield fs_extra_1.default.ensureDir(this.destination); // Copy files yield fs_extra_1.default.copy(this.source, this.destination); } catch (error) { console.error("Error copying files:", error); } }); } } exports.Copy = Copy;