Skip to content

Commit

Permalink
Release v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Nov 6, 2023
1 parent 01d0e21 commit ec1a9fd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
9 changes: 6 additions & 3 deletions dist/copy-folder.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
//! copy-folder-util v1.1.1 ~~ https://github.com/center-key/copy-folder-util ~~ MIT License
//! copy-folder-util v1.1.2 ~~ https://github.com/center-key/copy-folder-util ~~ MIT License

export type Settings = {
basename: string;
cd: string;
fileExtensions: string[];
};
export type Options = Partial<Settings>;
export type Results = {
source: string;
target: string;
Expand All @@ -16,7 +15,11 @@ export type Results = {
dest: string;
}[];
};
export type ReporterSettings = {
summaryOnly: boolean;
};
declare const copyFolder: {
cp(sourceFolder: string, targetFolder: string, options?: Options): Results;
cp(sourceFolder: string, targetFolder: string, options?: Partial<Settings>): Results;
reporter(results: Results, options?: Partial<ReporterSettings>): Results;
};
export { copyFolder };
21 changes: 20 additions & 1 deletion dist/copy-folder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! copy-folder-util v1.1.1 ~~ https://github.com/center-key/copy-folder-util ~~ MIT License
//! copy-folder-util v1.1.2 ~~ https://github.com/center-key/copy-folder-util ~~ MIT License

import chalk from 'chalk';
import fs from 'fs';
import log from 'fancy-log';
import path from 'path';
import slash from 'slash';
const extraneousFiles = ['.DS_Store', 'Thumbs.db', 'desktop.ini'];
Expand Down Expand Up @@ -61,5 +63,22 @@ const copyFolder = {
files: files,
};
},
reporter(results, options) {
const defaults = {
summaryOnly: false,
};
const settings = { ...defaults, ...options };
const name = chalk.gray('copy-folder');
const source = chalk.blue.bold(results.source);
const target = chalk.magenta(results.target);
const arrow = { big: chalk.gray.bold(' ⟹ '), little: chalk.gray.bold('→') };
const infoColor = results.count ? chalk.white : chalk.red.bold;
const info = infoColor(`(files: ${results.count}, ${results.duration}ms)`);
log(name, source, arrow.big, target, info);
const logFile = (file) => log(name, chalk.white(file.origin), arrow.little, chalk.green(file.dest));
if (!settings.summaryOnly)
results.files.forEach(logFile);
return results;
},
};
export { copyFolder };
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "copy-folder-util",
"version": "1.1.1",
"version": "1.1.2",
"description": "Recursively copy files from one folder to another folder (CLI tool designed for use in npm scripts)",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -94,12 +94,12 @@
"devDependencies": {
"@types/fancy-log": "~2.0",
"@types/node": "~20.8",
"@typescript-eslint/eslint-plugin": "~6.7",
"@typescript-eslint/parser": "~6.7",
"@typescript-eslint/eslint-plugin": "~6.9",
"@typescript-eslint/parser": "~6.9",
"add-dist-header": "~1.3",
"assert-deep-strict-equal": "~1.1",
"copy-file-util": "~1.1",
"eslint": "~8.51",
"eslint": "~8.53",
"jshint": "~2.13",
"mocha": "~10.2",
"rimraf": "~5.0",
Expand Down

0 comments on commit ec1a9fd

Please sign in to comment.