diff --git a/.gitignore b/.gitignore index 4fe1f73..dd20914 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ yarn-debug.log* yarn-error.log* # Idea -.idea/workspace.xml +.idea # Runtime data pids diff --git a/.idea/FRS-replace.iml b/.idea/FRS-replace.iml deleted file mode 100644 index 24643cc..0000000 --- a/.idea/FRS-replace.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index c8c7f59..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml deleted file mode 100644 index 2af8566..0000000 --- a/.idea/dbnavigator.xml +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 15a15b2..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml deleted file mode 100644 index d23208f..0000000 --- a/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 28a804d..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 2190197..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cfe0aa3..60ba7e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. -### [2.0.1](https://github.com/FRSource/FRS-replace/compare/v2.0.0...v2.0.1) (2019-11-01) +### [2.0.1](https://github.com/FRSource/frs-replace/compare/v2.0.0...v2.0.1) (2019-11-01) -## [2.0.0](https://github.com/FRSource/FRS-replace/compare/v1.0.1...v2.0.0) (2019-10-21) +## [2.0.0](https://github.com/FRSource/frs-replace/compare/v1.0.1...v2.0.0) (2019-10-21) ### ⚠ BREAKING CHANGES @@ -13,32 +13,32 @@ All notable changes to this project will be documented in this file. See [standa ### Features -* better parallelization ([4d90537](https://github.com/FRSource/FRS-replace/commit/4d905375f0550a097d9464b742d13515e1314c94)), closes [#17](https://github.com/FRSource/FRS-replace/issues/17) [#10](https://github.com/FRSource/FRS-replace/issues/10) [#19](https://github.com/FRSource/FRS-replace/issues/19) +* better parallelization ([4d90537](https://github.com/FRSource/frs-replace/commit/4d905375f0550a097d9464b742d13515e1314c94)), closes [#17](https://github.com/FRSource/frs-replace/issues/17) [#10](https://github.com/FRSource/frs-replace/issues/10) [#19](https://github.com/FRSource/frs-replace/issues/19) ### Bug Fixes -* **package:** update fast-glob to version 3.1.0 ([#44](https://github.com/FRSource/FRS-replace/issues/44)) ([735785d](https://github.com/FRSource/FRS-replace/commit/735785dfdc99869096cd4c6a3be60fb8f796d54b)) -* **package:** update write to version 2.0.0 ([#36](https://github.com/FRSource/FRS-replace/issues/36)) ([d0b7ffd](https://github.com/FRSource/FRS-replace/commit/d0b7ffdbbd668262860e130551e64b54840ac782)) -* **package:** update yargs to version 14.2.0 ([#45](https://github.com/FRSource/FRS-replace/issues/45)) ([6df29e4](https://github.com/FRSource/FRS-replace/commit/6df29e4e9bda262f9467d85349cd1c61d260c328)), closes [#35](https://github.com/FRSource/FRS-replace/issues/35) +* **package:** update fast-glob to version 3.1.0 ([#44](https://github.com/FRSource/frs-replace/issues/44)) ([735785d](https://github.com/FRSource/frs-replace/commit/735785dfdc99869096cd4c6a3be60fb8f796d54b)) +* **package:** update write to version 2.0.0 ([#36](https://github.com/FRSource/frs-replace/issues/36)) ([d0b7ffd](https://github.com/FRSource/frs-replace/commit/d0b7ffdbbd668262860e130551e64b54840ac782)) +* **package:** update yargs to version 14.2.0 ([#45](https://github.com/FRSource/frs-replace/issues/45)) ([6df29e4](https://github.com/FRSource/frs-replace/commit/6df29e4e9bda262f9467d85349cd1c61d260c328)), closes [#35](https://github.com/FRSource/frs-replace/issues/35) -## [1.0.1](https://github.com/FRSource/FRS-replace/compare/v1.0.0...v1.0.1) (2019-10-18) +## [1.0.1](https://github.com/FRSource/frs-replace/compare/v1.0.0...v1.0.1) (2019-10-18) ### Bug Fixes -* **package:** update yargs to version 13.2.2 ([749b721](https://github.com/FRSource/FRS-replace/commit/749b72144049d9c900b04dd2b14473938af963d7)), closes [#20](https://github.com/FRSource/FRS-replace/issues/20) +* **package:** update yargs to version 13.2.2 ([749b721](https://github.com/FRSource/frs-replace/commit/749b72144049d9c900b04dd2b14473938af963d7)), closes [#20](https://github.com/FRSource/frs-replace/issues/20) -# [1.0.0](https://github.com/FRSource/FRS-replace/compare/v0.1.2...v1.0.0) (2018-11-14) +# [1.0.0](https://github.com/FRSource/frs-replace/compare/v0.1.2...v1.0.0) (2018-11-14) ### Features -* **input:** add support for globbing matching ([#14](https://github.com/FRSource/FRS-replace/issues/14)) ([b289ffe](https://github.com/FRSource/FRS-replace/commit/b289ffe)), closes [#3](https://github.com/FRSource/FRS-replace/issues/3) -* **sync:** Sync speed improvements ([#18](https://github.com/FRSource/FRS-replace/issues/18)) ([4ff2a1e](https://github.com/FRSource/FRS-replace/commit/4ff2a1e)), closes [#17](https://github.com/FRSource/FRS-replace/issues/17) +* **input:** add support for globbing matching ([#14](https://github.com/FRSource/frs-replace/issues/14)) ([b289ffe](https://github.com/FRSource/frs-replace/commit/b289ffe)), closes [#3](https://github.com/FRSource/frs-replace/issues/3) +* **sync:** Sync speed improvements ([#18](https://github.com/FRSource/frs-replace/issues/18)) ([4ff2a1e](https://github.com/FRSource/frs-replace/commit/4ff2a1e)), closes [#17](https://github.com/FRSource/frs-replace/issues/17) ### BREAKING CHANGES @@ -52,63 +52,63 @@ Turn off camel-case-expansion to speed up yargs a bit -## [0.1.2](https://github.com/FRSource/FRS-replace/compare/v0.1.1...v0.1.2) (2018-10-19) +## [0.1.2](https://github.com/FRSource/frs-replace/compare/v0.1.1...v0.1.2) (2018-10-19) -## [0.1.1](https://github.com/FRSource/FRS-replace/compare/v0.1.0...v0.1.1) (2018-10-17) +## [0.1.1](https://github.com/FRSource/frs-replace/compare/v0.1.0...v0.1.1) (2018-10-17) -# [0.1.0](https://github.com/FRSource/FRS-replace/compare/v0.0.6...v0.1.0) (2018-10-17) +# [0.1.0](https://github.com/FRSource/frs-replace/compare/v0.0.6...v0.1.0) (2018-10-17) ### Features -* **cli:** Input & output options ([06e8363](https://github.com/FRSource/FRS-replace/commit/06e8363)), closes [#7](https://github.com/FRSource/FRS-replace/issues/7) +* **cli:** Input & output options ([06e8363](https://github.com/FRSource/frs-replace/commit/06e8363)), closes [#7](https://github.com/FRSource/frs-replace/issues/7) -## [0.0.6](https://github.com/FRSource/FRS-replace/compare/v0.0.5...v0.0.6) (2018-10-15) +## [0.0.6](https://github.com/FRSource/frs-replace/compare/v0.0.5...v0.0.6) (2018-10-15) ### Bug Fixes -* **docs:** positionals table ([7168474](https://github.com/FRSource/FRS-replace/commit/7168474)), closes [#6](https://github.com/FRSource/FRS-replace/issues/6) +* **docs:** positionals table ([7168474](https://github.com/FRSource/frs-replace/commit/7168474)), closes [#6](https://github.com/FRSource/frs-replace/issues/6) -## [0.0.5](https://github.com/FRSource/FRS-replace/compare/v0.0.4...v0.0.5) (2018-10-15) +## [0.0.5](https://github.com/FRSource/frs-replace/compare/v0.0.4...v0.0.5) (2018-10-15) ### Bug Fixes -* **docs:** styling & API usage/examples ([cba85dc](https://github.com/FRSource/FRS-replace/commit/cba85dc)), closes [#1](https://github.com/FRSource/FRS-replace/issues/1) -* **node:** expose public node API ([c727dff](https://github.com/FRSource/FRS-replace/commit/c727dff)), closes [#5](https://github.com/FRSource/FRS-replace/issues/5) +* **docs:** styling & API usage/examples ([cba85dc](https://github.com/FRSource/frs-replace/commit/cba85dc)), closes [#1](https://github.com/FRSource/frs-replace/issues/1) +* **node:** expose public node API ([c727dff](https://github.com/FRSource/frs-replace/commit/c727dff)), closes [#5](https://github.com/FRSource/frs-replace/issues/5) -## [0.0.4](https://github.com/FRSource/FRS-replace/compare/v0.0.3...v0.0.4) (2018-10-15) +## [0.0.4](https://github.com/FRSource/frs-replace/compare/v0.0.3...v0.0.4) (2018-10-15) -## [0.0.3](https://github.com/FRSource/FRS-replace/compare/v0.0.2...v0.0.3) (2018-10-15) +## [0.0.3](https://github.com/FRSource/frs-replace/compare/v0.0.2...v0.0.3) (2018-10-15) -## [0.0.2](https://github.com/FRSource/FRS-replace/compare/v0.0.1...v0.0.2) (2018-10-15) +## [0.0.2](https://github.com/FRSource/frs-replace/compare/v0.0.1...v0.0.2) (2018-10-15) ### Bug Fixes -* **npm:** lowercase package name to meet npm requirements ([06daa6a](https://github.com/FRSource/FRS-replace/commit/06daa6a)) +* **npm:** lowercase package name to meet npm requirements ([06daa6a](https://github.com/FRSource/frs-replace/commit/06daa6a)) diff --git a/README.md b/README.md index 360592b..bc990e7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# FRS-replace +# frs-replace [![NPM version](https://img.shields.io/npm/v/frs-replace.svg?style=flat)](https://www.npmjs.com/package/frs-replace) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -[![Build Status](https://travis-ci.org/FRSource/FRS-replace.svg?branch=master)](https://travis-ci.org/FRSource/FRS-replace) -[![Coverage Status](https://coveralls.io/repos/github/FRSource/FRS-replace/badge.svg?branch=master)](https://coveralls.io/github/FRSource/FRS-replace?branch=master) -[![Dependabot badge](https://api.dependabot.com/badges/status?host=github&repo=FRSource/FRS-replace)](https://dependabot.com/) +[![Build Status](https://travis-ci.org/FRSource/frs-replace.svg?branch=master)](https://travis-ci.org/FRSource/frs-replace) +[![Coverage Status](https://coveralls.io/repos/github/FRSource/frs-replace/badge.svg?branch=master)](https://coveralls.io/github/FRSource/frs-replace?branch=master) +[![Dependabot badge](https://api.dependabot.com/badges/status?host=github&repo=FRSource/frs-replace)](https://dependabot.com/) [![Dependencies status](https://david-dm.org/frsource/frs-replace.svg)](https://david-dm.org/frsource/frs-replace) [![Dev dependencies status](https://david-dm.org/frsource/frs-replace/dev-status.svg)](https://david-dm.org/frsource/frs-replace?type=dev) [![codebeat badge](https://codebeat.co/badges/5496a006-a13d-48cc-baeb-37c79a1f6444)](https://codebeat.co/projects/github-com-frsource-frs-replace-master) @@ -33,21 +33,21 @@ npm install frs-replace ``` download -[zipped from FRS-replace Releases](https://github.com/FRSource/FRS-replace/releases) +[zipped from frs-replace Releases](https://github.com/FRSource/frs-replace/releases) ## Node API usage -FRS-replace package provides 2 methods for synchronous / asynchronous (with promise and ES6 `async`/`await` syntax support) usage: +frs-replace package provides 2 methods for synchronous / asynchronous (with promise and ES6 `async`/`await` syntax support) usage: ```javascript -const FRSReplace = require('FRS-replace'); +const FRSReplace = require('frs-replace'); FRSReplace.sync({/* options */}) FRSReplace.async({/* options */}) ``` Where `/* options */` is an object containing: -> Note: remember that you need to provide some input for FRS-replace to work, so one of the parameters: input or content are **required** +> Note: remember that you need to provide some input for frs-replace to work, so one of the parameters: input or content are **required** | Option | Type | Default | Description | | --- | --- | --- | --- | @@ -64,7 +64,7 @@ Where `/* options */` is an object containing: ## CLI usage ```bash -FRS-replace [options] +frs-replace [options] ``` ### Positionals @@ -104,7 +104,7 @@ FRS-replace [options] #### 1.1 API ```javascript -const FRSReplace = require('FRS-replace') +const FRSReplace = require('frs-replace') /* synchronously */ const resultSync = FRSReplace.sync({ @@ -138,7 +138,7 @@ const resultAsync = await FRSReplace.async({ #### 1.2 CLI ```bash -FRS-replace a b -i foo.js --stdout +frs-replace a b -i foo.js --stdout ``` ### 2. Replace all `a` occurences with `b` from given `foo.js` and save result to `foo_replaced.js` @@ -146,7 +146,7 @@ FRS-replace a b -i foo.js --stdout #### 2.1 API ```javascript -const result = require('FRS-replace').sync({ +const result = require('frs-replace').sync({ input : 'foo.js', regex : new RegExp('a', 'g'), replacement : 'b', @@ -157,7 +157,7 @@ const result = require('FRS-replace').sync({ #### 2.2 CLI ```bash -FRS-replace a b -i foo.js -o foo_replaced.js +frs-replace a b -i foo.js -o foo_replaced.js ``` ### 3. Replace all `a` occurences with `b` from given array of files and save result to `foo_replaced.js` using default `\n` as result-joining string @@ -165,7 +165,7 @@ FRS-replace a b -i foo.js -o foo_replaced.js #### 3.1 API ```javascript -const result = require('FRS-replace').sync({ +const result = require('frs-replace').sync({ input : ['foo.js', 'foo2.js'], regex : new RegExp('a', 'g'), replacement : 'b', @@ -176,13 +176,13 @@ const result = require('FRS-replace').sync({ #### 3.2 CLI ```bash -FRS-replace a b -i foo.js foo2.js -o foo_replaced.js --i-join-str "\n/////\n" +frs-replace a b -i foo.js foo2.js -o foo_replaced.js --i-join-str "\n/////\n" ``` or ```bash -FRS-replace a b -i foo.js -i foo2.js -o foo_replaced.js --i-join-str "\n/////\n" +frs-replace a b -i foo.js -i foo2.js -o foo_replaced.js --i-join-str "\n/////\n" ``` > Note: Arrays can be passed under single flag-entry as a space-separated list *or* under same flag repeated multiple times (all values will be concatenated into single array using, details - [yargs array notation](https://github.com/yargs/yargs-parser#dot-notation)). @@ -192,7 +192,7 @@ FRS-replace a b -i foo.js -i foo2.js -o foo_replaced.js --i-join-str "\n/////\n" #### 4.1 API ```javascript -const result = require('FRS-replace').sync({ +const result = require('frs-replace').sync({ input : 'foo/*.js', regex : new RegExp('a', 'g'), replacement : 'b', @@ -204,7 +204,7 @@ const result = require('FRS-replace').sync({ #### 4.2 CLI ```bash -FRS-replace a b -i foo/*.js -o foo_replaced.js --i-join-str "\n/////\n" +frs-replace a b -i foo/*.js -o foo_replaced.js --i-join-str "\n/////\n" ``` ### 5. Replace all `a` occurences with `b` in given content string `abcd` and save result to `foo_replaced.js` @@ -212,7 +212,7 @@ FRS-replace a b -i foo/*.js -o foo_replaced.js --i-join-str "\n/////\n" #### 5.1 API ```javascript -const result = require('FRS-replace').sync({ +const result = require('frs-replace').sync({ content : 'abcd', regex : new RegExp('a', 'g'), replacement : 'b', @@ -223,7 +223,7 @@ const result = require('FRS-replace').sync({ #### 5.2 CLI ```bash -FRS-replace a b --content abcd -o foo_replaced.js +frs-replace a b --content abcd -o foo_replaced.js ``` ### 6. Replace all `a` occurences with `b` from piped stream and save it to output file @@ -231,7 +231,7 @@ FRS-replace a b --content abcd -o foo_replaced.js #### 6.1 CLI ```bash - | FRS-replace a b > + | frs-replace a b > ``` ### 7. Replaces all `a` occurences with `b` from piped stream and pass it through `stdout` stream to next command @@ -239,7 +239,7 @@ FRS-replace a b --content abcd -o foo_replaced.js #### 7.1 CLI ```bash - | FRS-replace a b | + | frs-replace a b | ``` ### 8. Both pipe & options styles can be mixed together, here - getting input from `i` argument and passing output down the stream to next command @@ -247,7 +247,7 @@ FRS-replace a b --content abcd -o foo_replaced.js #### 8.1 CLI ```bash -FRS-replace a b -i foo.js | +frs-replace a b -i foo.js | ``` ## Benchmarks (Node v10.16.0) @@ -256,8 +256,8 @@ FRS-replace a b -i foo.js | | Library (best bolded) | Execution time [s] | Difference percentage (comparing to best time) | | --- | --- | --- | -| FRS-replace async | 0.01761663 | 103.7503% | -| **FRS-replace sync** | 0.00864619 | 0.0000% | +| frs-replace async | 0.01761663 | 103.7503% | +| **frs-replace sync** | 0.00864619 | 0.0000% | | replace-in-file | 0.02154322 | 149.1644% | | replace async | *N/A* | *N/A* | | replace sync | 0.05026399 | 481.3428% | @@ -267,8 +267,8 @@ FRS-replace a b -i foo.js | | Library (best bolded) | Execution time [s] | Difference percentage (comparing to best time) | | --- | --- | --- | -| FRS-replace async | 0.00011756 | 215.1822% | -| **FRS-replace sync** | 0.00003730 | 0.0000% | +| frs-replace async | 0.00011756 | 215.1822% | +| **frs-replace sync** | 0.00003730 | 0.0000% | | replace-in-file | *N/A* | *N/A* | | replace async | *N/A* | *N/A* | | replace sync | *N/A* | *N/A* | diff --git a/benchmark/multiple-file-replace.benchmark.test.js b/benchmark/multiple-file-replace.benchmark.test.js index 7626645..6c11b7c 100644 --- a/benchmark/multiple-file-replace.benchmark.test.js +++ b/benchmark/multiple-file-replace.benchmark.test.js @@ -16,8 +16,8 @@ const content = `aąbcćdeęfg%hi jklmn oópqr,stuvwxyZ` const tmpPrefixes = { - input: 'FRS-replace-replace-in-', - output: 'FRS-replace-replace-out-' + input: 'frs-replace-replace-in', + output: 'frs-replace-replace-out' } const defaults = { inputReadOptions: 'utf8', @@ -54,8 +54,8 @@ const testInput = { } } const testedLibraries = [ - 'FRS-replace async', - 'FRS-replace sync', + 'frs-replace async', + 'frs-replace sync', 'replace-in-file', 'replace async', 'replace sync', @@ -136,8 +136,8 @@ tap.test(`input as glob pattern [${inputFilesNo} files x ${iterationsNo} iterati const result = outputPerfy(ct, results, results.slice().sort(sortByNumberVariable('fullNanoseconds'))[0]) const sortedResults = result.results.slice().sort(sortByNumberVariable('avgTime')) - ct.is((sortedResults[0].name.indexOf('FRS-replace sync') !== -1 || (sortedResults[1].name.indexOf('FRS-replace sync') !== -1 && sortedResults[1].avgPercentageDifference < 5)), true, 'FRS-replace sync should be the fastest or second, but at most with 5% difference to best') - ct.is(sortedResults[0].name.indexOf('FRS-replace async') !== -1 || sortedResults[1].name.indexOf('FRS-replace async') !== -1, true, 'FRS-replace async should be the fastest or second') + ct.is((sortedResults[0].name.indexOf('frs-replace sync') !== -1 || (sortedResults[1].name.indexOf('frs-replace sync') !== -1 && sortedResults[1].avgPercentageDifference < 5)), true, 'frs-replace sync should be the fastest or second, but at most with 5% difference to best') + ct.is(sortedResults[0].name.indexOf('frs-replace async') !== -1 || sortedResults[1].name.indexOf('frs-replace async') !== -1, true, 'frs-replace async should be the fastest or second') ct.end() }) @@ -167,7 +167,7 @@ tap.test(`input & replacement as strings [${iterationsNo} iterations x ${repetit const result = outputPerfy(ct, results, results.slice().sort(sortByNumberVariable('fullNanoseconds'))[0]) const sortedResults = result.results.slice().sort(sortByNumberVariable('avgTime')) - ct.is((sortedResults[0].name.indexOf('FRS-replace') !== -1 || (sortedResults[1].name.indexOf('FRS-replace') !== -1 && sortedResults[1].avgPercentageDifference < 10)), true, 'FRS-replace should be the fastest or second, but at most with 10% difference to best') + ct.is((sortedResults[0].name.indexOf('frs-replace') !== -1 || (sortedResults[1].name.indexOf('frs-replace') !== -1 && sortedResults[1].avgPercentageDifference < 10)), true, 'frs-replace should be the fastest or second, but at most with 10% difference to best') ct.end() }) diff --git a/bin/cli.js b/bin/cli.js index b4b19cd..3c68178 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -15,7 +15,7 @@ require('get-stdin')().then((stdin) => { .parserConfiguration({ 'camel-case-expansion': false }) - .scriptName('FRS-replace') + .scriptName('frs-replace') .usage('$0 [options]', 'Replace matching parts of string with replacement string/function', (yargs) => { yargs .positional('regex', { diff --git a/bin/cli.spec.test.js b/bin/cli.spec.test.js index 6121f83..c269df8 100644 --- a/bin/cli.spec.test.js +++ b/bin/cli.spec.test.js @@ -6,8 +6,8 @@ const glob = require('fast-glob') const path = require('path') const tmpPrefixes = { - input: 'FRS-replace-cli-in', - output: 'FRS-replace-cli-out' + input: 'frs-replace-cli-in', + output: 'frs-replace-cli-out' } const defaultOptions = { timeout: 2000 diff --git a/package.json b/package.json index a574e8d..38e0aaa 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,17 @@ "name": "frs-replace", "version": "2.0.1", "description": "Simple wrapper around javascript replace with CLI usage support!", - "bin": "./bin/cli.js", + "bin": { + "frs-replace": "./src/cli.js" + }, "main": "index.js", - "repository": "https://github.com/FRSource/FRS-replace.git", + "repository": "https://github.com/FRSource/frs-replace.git", "author": "Jakub Freisler ", "license": "Apache-2.0", "bugs": { - "url": "https://github.com/FRSource/FRS-replace/issues" + "url": "https://github.com/FRSource/frs-replace/issues" }, - "homepage": "https://github.com/FRSource/FRS-replace#readme", + "homepage": "https://github.com/FRSource/frs-replace#readme", "files": [ "bin/cli.js", "src/replace.js", diff --git a/src/replace.js b/src/replace.js index c27c8b2..d423dd4 100644 --- a/src/replace.js +++ b/src/replace.js @@ -105,7 +105,7 @@ async function replaceAsync ({ } function writeError (msg) { - throw new Error(`FRS-replace :: ${msg}`) + throw new Error(`frs-replace :: ${msg}`) } function replaceRegex (content, needle, replacement) { diff --git a/src/replace.spec.test.js b/src/replace.spec.test.js index 2c11d87..9ec6a1b 100644 --- a/src/replace.spec.test.js +++ b/src/replace.spec.test.js @@ -7,8 +7,8 @@ const glob = require('fast-glob') const replace = require('./replace') const tmpPrefixes = { - input: 'FRS-replace-replace-in', - output: 'FRS-replace-replace-out' + input: 'frs-replace-replace-in', + output: 'frs-replace-replace-out' } const content = `aąbcćdeęfg%hi jklmn @@ -42,10 +42,10 @@ tap.afterEach((done) => { }) tap.test('check required fields', async t => { - t.throws(() => replace.sync({}), { message: 'FRS-replace :: at least one input source must be defined!' }, 'sync :: should throw if both stdin & input arguments missing') + t.throws(() => replace.sync({}), { message: 'frs-replace :: at least one input source must be defined!' }, 'sync :: should throw if both stdin & input arguments missing') const asyncResult = replace.async({}) asyncResult.catch(() => {}) // to silent Node "PromiseRejectionHandledWarning:" error - await t.rejects(asyncResult, { message: 'FRS-replace :: at least one input source must be defined!' }, 'async :: should reject promise if both stdin & input arguments missing') + await t.rejects(asyncResult, { message: 'frs-replace :: at least one input source must be defined!' }, 'async :: should reject promise if both stdin & input arguments missing') t.end() })