Skip to content

Commit

Permalink
Release v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Aug 14, 2024
1 parent b17fece commit 130df0c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ See the **TypeScript Declarations** at the top of [copy-file.ts](copy-file.ts) f
- 🪺 [recursive-exec](https://github.com/center-key/recursive-exec):  _Run a command on each file in a folder and its subfolders_
- 🔍 [replacer-util](https://github.com/center-key/replacer-util):  _Find and replace strings or template outputs in text files_
- 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets):  _Revision web asset filenames with cache busting content hash fingerprints_
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util):  _Organize npm package.json scripts into named groups of easy to manage commands_
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util):  _Organize npm package.json scripts into groups of easy to manage commands_
- 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator):  _Check the markup validity of HTML files using the W3C validator_

Feel free to submit questions at:<br>
Expand Down
2 changes: 1 addition & 1 deletion dist/copy-file.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! copy-file-util v1.2.1 ~~ https://github.com/center-key/copy-file-util ~~ MIT License
//! copy-file-util v1.2.2 ~~ https://github.com/center-key/copy-file-util ~~ MIT License

export type Settings = {
cd: string;
Expand Down
8 changes: 4 additions & 4 deletions dist/copy-file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! copy-file-util v1.2.1 ~~ https://github.com/center-key/copy-file-util ~~ MIT License
//! copy-file-util v1.2.2 ~~ https://github.com/center-key/copy-file-util ~~ MIT License

import chalk from 'chalk';
import fs from 'fs';
Expand Down Expand Up @@ -27,7 +27,7 @@ const copyFile = {
const sourceFilename = sourceIsFile ? path.basename(source) : null;
const targetPath = settings.targetFile ? path.dirname(settings.targetFile) : settings.targetFolder;
const targetFolder = targetPath ? normalize(startFolder + targetPath) : null;
const targetFile = settings.targetFile ?? settings.targetFolder + '/' + sourceFilename;
const targetFile = settings.targetFile ?? `${settings.targetFolder}/${sourceFilename}`;
const target = normalize(startFolder + targetFile);
const targetExists = !missingTarget && fs.existsSync(target);
const skip = targetExists && !settings.overwrite;
Expand All @@ -40,10 +40,10 @@ const copyFile = {
!sourceIsFile ? 'Source is not a file: ' + source :
missingTarget ? 'Must specify a target file or folder.' :
ambiguousTarget ? 'Target cannot be both a file and a folder.' :
badTargetFolder ? 'Target folder cannot be written to: ' + targetFolder :
badTargetFolder ? 'Target folder cannot be written to: ' + String(targetFolder) :
null;
if (errorMessage)
throw Error('[copy-file-util] ' + errorMessage);
throw new Error('[copy-file-util] ' + errorMessage);
if (!skip && settings.move)
fs.renameSync(source, target);
else if (!skip)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "copy-file-util",
"version": "1.2.1",
"version": "1.2.2",
"description": "Copy or rename a file with optional package version number (CLI tool designed for use in npm package.json scripts)",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -67,7 +67,7 @@
"devDependencies": {
"@eslint/js": "~9.9",
"@types/fancy-log": "~2.0",
"@types/node": "~22.2",
"@types/node": "~22.3",
"add-dist-header": "~1.4",
"assert-deep-strict-equal": "~1.2",
"eslint": "~9.9",
Expand Down

0 comments on commit 130df0c

Please sign in to comment.