copy-file-util 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -15
- package/dist/copy-file.d.ts +1 -1
- package/dist/copy-file.js +6 -6
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -83,12 +83,17 @@ Command-line flags:
|
|
|
83
83
|
> [!NOTE]
|
|
84
84
|
> _Single quotes in commands are normalized so they work cross-platform and avoid the errors often encountered on Microsoft Windows._
|
|
85
85
|
|
|
86
|
+
> [!NOTE]
|
|
87
|
+
> _To copy multiple files consider using_ [copy-folder-util](https://github.com/center-key/copy-folder-util).
|
|
88
|
+
> _It supports commands like the following to copy all **.jpg** files from one folder to another folder:<br>_
|
|
89
|
+
> `copy-folder src/website --ext=.jpg docs`
|
|
90
|
+
|
|
86
91
|
### 6. Template variables
|
|
87
92
|
The *target* parameter can contain template variables, like `{{package.version}}` and `{{package.name}}`, which will be replaced with values with values from your project's **package.json** file.
|
|
88
93
|
|
|
89
94
|
Example:
|
|
90
|
-
- `copy-file build/app.js dist/app-v{{package.version}}.js`<br>
|
|
91
|
-
Creates a copy of **app.js** named something like **app-v1.2.3.js** based on the version of your project.
|
|
95
|
+
- `copy-file build/my-app.js dist/my-app-v{{package.version}}.js`<br>
|
|
96
|
+
Creates a copy of **my-app.js** named something like **my-app-v1.2.3.js** based on the version of your project.
|
|
92
97
|
|
|
93
98
|
## C) Application Code
|
|
94
99
|
Even though **copy-file-util** is primarily intended for build scripts, the package can be used programmatically in ESM and TypeScript projects.
|
|
@@ -106,17 +111,16 @@ See the **TypeScript Declarations** at the top of [copy-file.ts](src/copy-file.t
|
|
|
106
111
|
<br>
|
|
107
112
|
|
|
108
113
|
---
|
|
109
|
-
**CLI Build Tools for package.json**
|
|
110
|
-
- 🎋 [add-dist-header](https://github.com/center-key/add-dist-header): _Prepend a one-line banner comment (with license notice) to distribution files_
|
|
111
|
-
- 📄 [copy-file-util](https://github.com/center-key/copy-file-util): _Copy or rename a file with optional package version number_
|
|
112
|
-
- 📂 [copy-folder-util](https://github.com/center-key/copy-folder-util): _Recursively copy files from one folder to another folder_
|
|
113
|
-
- 🪺 [recursive-exec](https://github.com/center-key/recursive-exec): _Run a command on each file in a folder and its subfolders_
|
|
114
|
-
- 🔍 [replacer-util](https://github.com/center-key/replacer-util): _Find and replace strings or template outputs in text files_
|
|
115
|
-
- 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets): _Revision web asset filenames with cache busting content hash fingerprints_
|
|
116
|
-
- 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util): _Organize npm package.json scripts into groups of easy to manage commands_
|
|
117
|
-
- 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator): _Check the markup validity of HTML files using the W3C validator_
|
|
118
|
-
|
|
119
|
-
Feel free to submit questions at:<br>
|
|
120
|
-
[github.com/center-key/copy-file-util/issues](https://github.com/center-key/copy-file-util/issues)
|
|
121
|
-
|
|
122
114
|
[MIT License](LICENSE.txt)
|
|
115
|
+
|
|
116
|
+
[🛡️ npm Security Aggregator](https://center-key.github.io/npm-security-aggregator/?package=copy-file-util)
|
|
117
|
+
|
|
118
|
+
See the `runScriptsConfig` section of [`package.json`](package.json) for a clean way to organize build tasks:
|
|
119
|
+
- 🎋 [`add-dist-header`](https://github.com/center-key/add-dist-header) — _Prepend a one-line banner comment (with license notice) to distribution files_
|
|
120
|
+
- 📄 [`copy-file-util`](https://github.com/center-key/copy-file-util) — _Copy or rename a file with optional package version number_
|
|
121
|
+
- 📂 [`copy-folder-util`](https://github.com/center-key/copy-folder-util) — _Recursively copy files from one folder to another folder_
|
|
122
|
+
- 🪺 [`recursive-exec`](https://github.com/center-key/recursive-exec) — _Run a command on each file in a folder and its subfolders_
|
|
123
|
+
- 🔍 [`replacer-util`](https://github.com/center-key/replacer-util) — _Find and replace strings or template outputs in text files_
|
|
124
|
+
- 🔢 [`rev-web-assets`](https://github.com/center-key/rev-web-assets) — _Revision web asset filenames with cache busting content hash fingerprints_
|
|
125
|
+
- 🚆 [`run-scripts-util`](https://github.com/center-key/run-scripts-util) — _Organize npm package.json scripts into groups of easy-to-manage commands_
|
|
126
|
+
- 🚦 [`w3c-html-validator`](https://github.com/center-key/w3c-html-validator) — _Check the markup validity of HTML files using the W3C validator_
|
package/dist/copy-file.d.ts
CHANGED
package/dist/copy-file.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
//! copy-file-util v1.3.
|
|
1
|
+
//! copy-file-util v1.3.5 ~~ https://github.com/center-key/copy-file-util ~~ MIT License
|
|
2
2
|
|
|
3
3
|
import { cliArgvUtil } from 'cli-argv-util';
|
|
4
|
-
import { dna } from 'dna-
|
|
5
|
-
import { EOL } from 'node:os';
|
|
4
|
+
import { dna } from 'dna-dom';
|
|
6
5
|
import chalk from 'chalk';
|
|
7
|
-
import fs from 'fs';
|
|
6
|
+
import fs from 'node:fs';
|
|
8
7
|
import log from 'fancy-log';
|
|
9
|
-
import
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
10
|
import slash from 'slash';
|
|
11
11
|
const copyFile = {
|
|
12
12
|
assert(ok, message) {
|
|
@@ -90,7 +90,7 @@ const copyFile = {
|
|
|
90
90
|
const rewriteTarget = () => {
|
|
91
91
|
const semVer = /\s+v[0-9]+\.[0-9]+\.[0-9]+\s+/;
|
|
92
92
|
const content1 = fs.readFileSync(target, 'utf-8');
|
|
93
|
-
const content2 = settings.platformEol ? content1.replace(/\r?\n/g, EOL) : content1;
|
|
93
|
+
const content2 = settings.platformEol ? content1.replace(/\r?\n/g, os.EOL) : content1;
|
|
94
94
|
const content3 = settings.removeSemVer ? content2.replace(semVer, ' ') : content2;
|
|
95
95
|
if (content1 !== content3)
|
|
96
96
|
fs.writeFileSync(target, content3);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copy-file-util",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Copy or rename a file with optional package version number (CLI tool designed for use in npm package.json scripts)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -59,23 +59,23 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"chalk": "~5.6",
|
|
62
|
-
"cli-argv-util": "~1.
|
|
63
|
-
"dna-
|
|
62
|
+
"cli-argv-util": "~1.5",
|
|
63
|
+
"dna-dom": "~3.3",
|
|
64
64
|
"fancy-log": "~2.0",
|
|
65
65
|
"slash": "~5.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@eslint/js": "~
|
|
68
|
+
"@eslint/js": "~10.0",
|
|
69
69
|
"@types/fancy-log": "~2.0",
|
|
70
|
-
"@types/node": "~25.
|
|
70
|
+
"@types/node": "~25.9",
|
|
71
71
|
"add-dist-header": "~1.6",
|
|
72
72
|
"assert-deep-strict-equal": "~1.2",
|
|
73
|
-
"eslint": "~
|
|
73
|
+
"eslint": "~10.4",
|
|
74
74
|
"jshint": "~2.13",
|
|
75
75
|
"mocha": "~11.7",
|
|
76
76
|
"rimraf": "~6.1",
|
|
77
77
|
"run-scripts-util": "~1.3",
|
|
78
|
-
"typescript": "~
|
|
79
|
-
"typescript-eslint": "~8.
|
|
78
|
+
"typescript": "~6.0",
|
|
79
|
+
"typescript-eslint": "~8.60"
|
|
80
80
|
}
|
|
81
81
|
}
|