Skip to content

Commit 1526872

Browse files
committed
Release v1.2.4
1 parent 693b00c commit 1526872

File tree

15 files changed

+87
-59
lines changed

15 files changed

+87
-59
lines changed

dist/replacer.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! replacer-util v1.2.3 ~~ https://github.com/center-key/replacer-util ~~ MIT License
1+
//! replacer-util v1.2.4 ~~ https://github.com/center-key/replacer-util ~~ MIT License
22

33
export type Settings = {
44
cd: string | null;

dist/replacer.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! replacer-util v1.2.3 ~~ https://github.com/center-key/replacer-util ~~ MIT License
1+
//! replacer-util v1.2.4 ~~ https://github.com/center-key/replacer-util ~~ MIT License
22

33
import { globSync } from 'glob';
44
import { isBinary } from 'istextorbinary';
@@ -88,8 +88,16 @@ const replacer = {
8888
const filePath = dir + '/' + slash(parsedPath.base);
8989
return { ...parsedPath, dir: dir, path: filePath };
9090
};
91+
const getWebRoot = (origin) => {
92+
const depth = origin.substring(source.length).split('/').length - 2;
93+
return depth === 0 ? '.' : '..' + '/..'.repeat(depth - 1);
94+
};
9195
const createEngine = (file) => {
92-
const globals = { package: pkg, file: getFileInfo(file.origin) };
96+
const globals = {
97+
package: pkg,
98+
file: getFileInfo(file.origin),
99+
webRoot: getWebRoot(file.origin),
100+
};
93101
globals['pkg'] = pkg;
94102
const engine = new Liquid({ globals });
95103
const versionFormatter = (numIds) => (str) => str.replace(/[^0-9]*/, '').split('.').slice(0, numIds).join('.');

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "replacer-util",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"description": "Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)",
55
"license": "MIT",
66
"type": "module",
@@ -100,13 +100,13 @@
100100
"@fortawesome/fontawesome-free": "~6.4",
101101
"@types/fancy-log": "~2.0",
102102
"@types/glob": "~8.1",
103-
"@types/node": "~20.7",
103+
"@types/node": "~20.8",
104104
"@typescript-eslint/eslint-plugin": "~6.7",
105105
"@typescript-eslint/parser": "~6.7",
106106
"add-dist-header": "~1.3",
107107
"assert-deep-strict-equal": "~1.1",
108108
"copy-file-util": "~1.1",
109-
"eslint": "~8.50",
109+
"eslint": "~8.51",
110110
"fetch-json": "~3.2",
111111
"highlight.js": "~11.8",
112112
"jshint": "~2.13",

spec/fixtures/source/mock1.html

+13-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@
1010
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@{{package.devDependencies.highlight-js|version}}/build/highlight.min.js></script>
1111
</head>
1212
<body>
13-
<h1>🔍🔍🔍 {{package.name}} 🔍🔍🔍</h1>
14-
<h2>{{package.description}}</h2>
15-
<p>I, for one, welcome our new insect overlords.</p>
16-
<ul>
17-
<li>Release: v{{package.version | version}}</li>
18-
<li>Minor: v{{package.version | minor-version}}</li>
19-
<li>Major: v{{package.version | major-version}}</li>
20-
</ul>
21-
<pre><code class=language-js>{% render 'spec/fixtures/source/subfolder-a/mock2.js' %}</code></pre>
13+
<header>
14+
<h1>🔍🔍🔍 {{package.name}} 🔍🔍🔍</h1>
15+
<h2>{{package.description}}</h2>
16+
</header>
17+
<main>
18+
<p>I, for one, welcome our new insect overlords.</p>
19+
<ul>
20+
<li>Release: v{{package.version | version}}</li>
21+
<li>Minor: v{{package.version | minor-version}}</li>
22+
<li>Major: v{{package.version | major-version}}</li>
23+
</ul>
24+
<pre><code class=language-js>{% render 'spec/fixtures/source/subfolder-a/mock2.js' %}</code></pre>
25+
</main>
2226
<footer>
2327
<a href={{webRoot}}>Home</a>
2428
</footer>

spec/fixtures/source/subfolder-b/mock3.html

+12-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
<script src=https://cdn.jsdelivr.net/npm/fetch-json@{{package.devDependencies.fetch-json|version}}/dist/fetch-json.min.js></script>
99
</head>
1010
<body>
11-
<h1>🔍🔍🔍 {{package.name}} 🔍🔍🔍</h1>
12-
<h2>{{package.description}}</h2>
13-
<p>I, for one, welcome our new insect overlords.</p>
14-
<ul>
15-
<li>Release: v{{package.version | version}}</li>
16-
<li>Minor: v{{package.version | minor-version}}</li>
17-
<li>Major: v{{package.version | major-version}}</li>
18-
</ul>
11+
<header>
12+
<h1>🔍🔍🔍 {{package.name}} 🔍🔍🔍</h1>
13+
<h2>{{package.description}}</h2>
14+
</header>
15+
<main>
16+
<p>I, for one, welcome our new insect overlords.</p>
17+
<ul>
18+
<li>Release: v{{package.version | version}}</li>
19+
<li>Minor: v{{package.version | minor-version}}</li>
20+
<li>Major: v{{package.version | major-version}}</li>
21+
</ul>
22+
</main>
1923
<footer>
2024
<a href={{webRoot}}>Home</a>
2125
</footer>

spec/fixtures/target/bundle.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/target/mock1.html

+14-10
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,25 @@
1010
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8/build/highlight.min.js></script>
1111
</head>
1212
<body>
13-
<h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
14-
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
15-
<p>I, for one, welcome our new A.I. module overlords.</p>
16-
<ul>
17-
<li>Release: v1.2.3</li>
18-
<li>Minor: v1.2</li>
19-
<li>Major: v1</li>
20-
</ul>
21-
<pre><code class=language-js>//! replacer-util ~~ MIT License
13+
<header>
14+
<h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
15+
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
16+
</header>
17+
<main>
18+
<p>I, for one, welcome our new A.I. module overlords.</p>
19+
<ul>
20+
<li>Release: v1.2.4</li>
21+
<li>Minor: v1.2</li>
22+
<li>Major: v1</li>
23+
</ul>
24+
<pre><code class=language-js>//! replacer-util ~~ MIT License
2225
// File: mock2.js
2326

2427
let π2 = 3.14;
2528
let τ2 = 2 * π2;
2629

2730
const info2 = {
28-
banner: '🔍🔍🔍 replacer-util v1.2.3 🔍🔍🔍',
31+
banner: '🔍🔍🔍 replacer-util v1.2.4 🔍🔍🔍',
2932
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)',
3033
code: 'mock1',
3134
file: '{"root":"","dir":"spec/fixtures/source","base":"mock1.html","ext":".html","name":"mock1","path":"spec/fixtures/source/mock1.html"}',
@@ -37,6 +40,7 @@ <h2>Find and replace strings or template outputs in text files (CLI tool designe
3740

3841
export { info2 };
3942
</code></pre>
43+
</main>
4044
<footer>
4145
<a href=.>Home</a>
4246
</footer>

spec/fixtures/target/mock1.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let π1 = 3.14;
55
let τ1 = 2 * π1;
66

77
const info1 = {
8-
banner: '🔍🔍🔍 replacer-util v1.2.3 🔍🔍🔍',
8+
banner: '🔍🔍🔍 replacer-util v1.2.4 🔍🔍🔍',
99
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)',
1010
list1: 'A.I. module, A.I. module, A.I. module',
1111
list2: 'A.I. module, iNsEcT, INSECT, A.I. module',

spec/fixtures/target/subfolder-a/mock2.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
1212
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
1313
<p>I, for one, welcome our new A.I. module overlords.</p>
1414
<ul>
15-
<li>Release: v1.2.3</li>
15+
<li>Release: v1.2.4</li>
1616
<li>Minor: v1.2</li>
1717
<li>Major: v1</li>
1818
</ul>

spec/fixtures/target/subfolder-a/mock2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let π2 = 3.14;
55
let τ2 = 2 * π2;
66

77
const info2 = {
8-
banner: '🔍🔍🔍 replacer-util v1.2.3 🔍🔍🔍',
8+
banner: '🔍🔍🔍 replacer-util v1.2.4 🔍🔍🔍',
99
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)',
1010
code: 'mock2',
1111
file: '{"root":"","dir":"spec/fixtures/source/subfolder-a","base":"mock2.js","ext":".js","name":"mock2","path":"spec/fixtures/source/subfolder-a/mock2.js"}',

spec/fixtures/target/web/index.html

+14-10
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,25 @@
1010
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8/build/highlight.min.js></script>
1111
</head>
1212
<body>
13-
<h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
14-
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
15-
<p>I, for one, welcome our new insect overlords.</p>
16-
<ul>
17-
<li>Release: v1.2.3</li>
18-
<li>Minor: v1.2</li>
19-
<li>Major: v1</li>
20-
</ul>
21-
<pre><code class=language-js>//! replacer-util ~~ MIT License
13+
<header>
14+
<h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
15+
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
16+
</header>
17+
<main>
18+
<p>I, for one, welcome our new insect overlords.</p>
19+
<ul>
20+
<li>Release: v1.2.4</li>
21+
<li>Minor: v1.2</li>
22+
<li>Major: v1</li>
23+
</ul>
24+
<pre><code class=language-js>//! replacer-util ~~ MIT License
2225
// File: mock2.js
2326

2427
let π2 = 3.14;
2528
let τ2 = 2 * π2;
2629

2730
const info2 = {
28-
banner: '🔍🔍🔍 replacer-util v1.2.3 🔍🔍🔍',
31+
banner: '🔍🔍🔍 replacer-util v1.2.4 🔍🔍🔍',
2932
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)',
3033
code: 'mock1',
3134
file: '{"root":"","dir":"spec/fixtures/source","base":"mock1.html","ext":".html","name":"mock1","path":"spec/fixtures/source/mock1.html"}',
@@ -38,6 +41,7 @@ <h2>Find and replace strings or template outputs in text files (CLI tool designe
3841
export { info2 };
3942
//# sourceMappingURL=mock2.js.map
4043
</code></pre>
44+
</main>
4145
<footer>
4246
<a href=.>Home</a>
4347
</footer>

spec/fixtures/target/web/subfolder-a/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
1212
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
1313
<p>I, for one, welcome our new insect overlords.</p>
1414
<ul>
15-
<li>Release: v1.2.3</li>
15+
<li>Release: v1.2.4</li>
1616
<li>Minor: v1.2</li>
1717
<li>Major: v1</li>
1818
</ul>

spec/fixtures/target/web/subfolder-b/index.html

+12-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
<script src=https://cdn.jsdelivr.net/npm/fetch-json@3.2/dist/fetch-json.min.js></script>
99
</head>
1010
<body>
11-
<h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
12-
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
13-
<p>I, for one, welcome our new insect overlords.</p>
14-
<ul>
15-
<li>Release: v1.2.3</li>
16-
<li>Minor: v1.2</li>
17-
<li>Major: v1</li>
18-
</ul>
11+
<header>
12+
<h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
13+
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm scripts)</h2>
14+
</header>
15+
<main>
16+
<p>I, for one, welcome our new insect overlords.</p>
17+
<ul>
18+
<li>Release: v1.2.4</li>
19+
<li>Minor: v1.2</li>
20+
<li>Major: v1</li>
21+
</ul>
22+
</main>
1923
<footer>
2024
<a href=..>Home</a>
2125
</footer>

spec/fixtures/target/web/subfolder-b/subfolder-bb/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h2>Find and replace strings or template outputs in text files (CLI tool designe
1515
<main>
1616
<p>I, for one, welcome our new insect overlords.</p>
1717
<ul>
18-
<li>Release: v1.2.3</li>
18+
<li>Release: v1.2.4</li>
1919
<li>Minor: v1.2</li>
2020
<li>Major: v1</li>
2121
</ul>

task-runner.sh.command

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ releaseInstructions() {
5757
echo "When ready to do the next release:"
5858
echo
5959
echo " === Increment version ==="
60-
echo " Edit pacakge.json to bump $version to next version number"
60+
echo " Edit package.json to bump $version to next version number"
6161
echo " $projectHome/package.json"
6262
}
6363
nextActionCommitTagPub() {

0 commit comments

Comments
 (0)