js-dev-tool 1.2.21 → 1.2.22
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/package.json +1 -1
- package/utils.d.ts +2 -2
- package/utils.js +5 -4
package/package.json
CHANGED
package/utils.d.ts
CHANGED
|
@@ -165,11 +165,11 @@ export function copyText(content: string, message?: string, chcp65001?: boolean)
|
|
|
165
165
|
* @param regex
|
|
166
166
|
* @param replacement
|
|
167
167
|
* @param paths Paths that do not exist are ignored
|
|
168
|
-
* @param [
|
|
168
|
+
* @param [opt]
|
|
169
169
|
*
|
|
170
170
|
* @date 2019-4-26
|
|
171
171
|
*/
|
|
172
|
-
export function fireReplace(regex: RegExp, replacement: string | Function, paths: string[], async?: boolean): void;
|
|
172
|
+
export function fireReplace(regex: RegExp, replacement: string | Function, paths: string[], opt?: { async?: boolean; verbose?: boolean }): void;
|
|
173
173
|
export const CI: boolean;
|
|
174
174
|
/**
|
|
175
175
|
* Nothing is logged in a CI environment.
|
package/utils.js
CHANGED
|
@@ -208,13 +208,14 @@ let nodeReplace;
|
|
|
208
208
|
* @param {RegExp} regex
|
|
209
209
|
* @param {string | Function} replacement
|
|
210
210
|
* @param {string[]} paths Paths that do not exist are ignored
|
|
211
|
-
* @param {boolean} [
|
|
211
|
+
* @param {{ async?: boolean; verbose?: boolean }} [opt]
|
|
212
212
|
*
|
|
213
213
|
* @date 2019-4-26
|
|
214
214
|
*/
|
|
215
|
-
function fireReplace(regex, replacement, paths,
|
|
215
|
+
function fireReplace(regex, replacement, paths, opt) {
|
|
216
216
|
// @ts-ignore "replace" is peerDependencies
|
|
217
217
|
nodeReplace === void 0 && (nodeReplace = require("replace"));
|
|
218
|
+
opt = { async: false, verbose: false, ...opt };
|
|
218
219
|
if (Array.isArray(paths)) {
|
|
219
220
|
paths = paths.filter((path) => fs.existsSync(path));
|
|
220
221
|
nodeReplace({
|
|
@@ -222,9 +223,9 @@ function fireReplace(regex, replacement, paths, async = false) {
|
|
|
222
223
|
replacement,
|
|
223
224
|
paths,
|
|
224
225
|
recursive: false,
|
|
225
|
-
silent:
|
|
226
|
+
silent: !opt.verbose,
|
|
226
227
|
preview: false,
|
|
227
|
-
async,
|
|
228
|
+
async: opt.async,
|
|
228
229
|
ignoreCase: false,
|
|
229
230
|
multiline: false,
|
|
230
231
|
});
|