Skip to content

Commit

Permalink
Release v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Aug 13, 2024
1 parent 4e04c8d commit 4c20794
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/replacer.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! replacer-util v1.3.0 ~~ https://github.com/center-key/replacer-util ~~ MIT License
//! replacer-util v1.3.1 ~~ https://github.com/center-key/replacer-util ~~ MIT License

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

import { globSync } from 'glob';
import { isBinary } from 'istextorbinary';
Expand All @@ -25,9 +25,9 @@ const task = {
};
Object.keys(pkgObj).forEach(unhide);
};
if (pkg?.dependencies)
if (pkg.dependencies)
fixHiddenKeys(pkg.dependencies);
if (pkg?.devDependencies)
if (pkg.devDependencies)
fixHiddenKeys(pkg.devDependencies);
return pkg;
},
Expand Down Expand Up @@ -63,7 +63,7 @@ const replacer = {
missingFind ? 'Must specify search text with --find or --regex' :
null;
if (errorMessage)
throw Error('[replacer-util] ' + errorMessage);
throw new Error('[replacer-util] ' + errorMessage);
const globFiles = () => exts.map(ext => globSync(source + '/**/*' + ext)).flat().sort();
const keep = (file) => !settings.exclude || !file.includes(settings.exclude);
const relativeFolders = (file) => file.substring(source.length, file.length - path.basename(file).length);
Expand All @@ -87,7 +87,10 @@ const replacer = {
const dir = slash(parsedPath.dir);
const filePath = dir + '/' + slash(parsedPath.base);
const folder = path.basename(dir);
return { ...parsedPath, dir: dir, folder: folder, path: filePath };
const date = fs.statSync(origin).mtime;
const dateFormat = { day: 'numeric', month: 'long', year: 'numeric' };
const modified = date.toLocaleString([], dateFormat);
return { ...parsedPath, dir: dir, folder: folder, path: filePath, date, modified };
};
const getWebRoot = (origin) => {
const depth = origin.substring(source.length).split('/').length - 2;
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": "replacer-util",
"version": "1.3.0",
"version": "1.3.1",
"description": "Find and replace strings or template outputs in text files (CLI tool designed for use in npm package.json scripts)",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -88,7 +88,7 @@
"rimraf": "~6.0",
"run-scripts-util": "~1.3",
"typescript": "~5.5",
"typescript-eslint": "~8.0",
"typescript-eslint": "~8.1",
"w3c-html-validator": "~1.8"
}
}
4 changes: 2 additions & 2 deletions spec/fixtures/target/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions spec/fixtures/target/mock1.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h3>Weekday: Monday</h3>
<main>
<p>I, for one, welcome our new A.I. module overlords.</p>
<ul>
<li>Release: v1.3.0</li>
<li>Release: v1.3.1</li>
<li>Minor: v1.3</li>
<li>Major: v1</li>
</ul>
Expand All @@ -30,7 +30,7 @@ <h3>Weekday: Monday</h3>
let τ2 = 2 * π2;

const info2 = {
banner: '🔍🔍🔍 replacer-util v1.3.0 🔍🔍🔍',
banner: '🔍🔍🔍 replacer-util v1.3.1 🔍🔍🔍',
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm package.json scripts)',
code: 'mock1',
file: '{"root":"","dir":"spec/fixtures/source","base":"mock1.html","ext":".html","name":"mock1","folder":"source","path":"spec/fixtures/source/mock1.html","date":"2024-08-13T03:31:37.663Z","modified":"August 12, 2024"}',
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/target/mock1.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let π1 = 3.14;
let τ1 = 2 * π1;

const info1 = {
banner: '🔍🔍🔍 replacer-util v1.3.0 🔍🔍🔍',
banner: '🔍🔍🔍 replacer-util v1.3.1 🔍🔍🔍',
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm package.json scripts)',
list1: 'A.I. module, A.I. module, A.I. module',
list2: 'A.I. module, iNsEcT, INSECT, A.I. module',
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/target/subfolder-a/mock2.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm package.json scripts)</h2>
<p>I, for one, welcome our new A.I. module overlords.</p>
<ul>
<li>Release: v1.3.0</li>
<li>Release: v1.3.1</li>
<li>Minor: v1.3</li>
<li>Major: v1</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/target/subfolder-a/mock2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let π2 = 3.14;
let τ2 = 2 * π2;

const info2 = {
banner: '🔍🔍🔍 replacer-util v1.3.0 🔍🔍🔍',
banner: '🔍🔍🔍 replacer-util v1.3.1 🔍🔍🔍',
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm package.json scripts)',
code: 'mock2',
file: '{"root":"","dir":"spec/fixtures/source/subfolder-a","base":"mock2.js","ext":".js","name":"mock2","folder":"subfolder-a","path":"spec/fixtures/source/subfolder-a/mock2.js","date":"2024-02-02T15:02:19.837Z","modified":"February 2, 2024"}',
Expand Down
4 changes: 2 additions & 2 deletions spec/fixtures/target/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h3>Weekday: Monday</h3>
<main>
<p>I, for one, welcome our new insect overlords.</p>
<ul>
<li>Release: v1.3.0</li>
<li>Release: v1.3.1</li>
<li>Minor: v1.3</li>
<li>Major: v1</li>
</ul>
Expand All @@ -30,7 +30,7 @@ <h3>Weekday: Monday</h3>
let τ2 = 2 * π2;

const info2 = {
banner: '🔍🔍🔍 replacer-util v1.3.0 🔍🔍🔍',
banner: '🔍🔍🔍 replacer-util v1.3.1 🔍🔍🔍',
description: 'Find and replace strings or template outputs in text files (CLI tool designed for use in npm package.json scripts)',
code: 'mock1',
file: '{"root":"","dir":"spec/fixtures/source","base":"mock1.html","ext":".html","name":"mock1","folder":"source","path":"spec/fixtures/source/mock1.html","date":"2024-08-13T03:31:37.663Z","modified":"August 12, 2024"}',
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/target/web/subfolder-a/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>🔍🔍🔍 replacer-util 🔍🔍🔍</h1>
<h2>Find and replace strings or template outputs in text files (CLI tool designed for use in npm package.json scripts)</h2>
<p>I, for one, welcome our new insect overlords.</p>
<ul>
<li>Release: v1.3.0</li>
<li>Release: v1.3.1</li>
<li>Minor: v1.3</li>
<li>Major: v1</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/target/web/subfolder-b/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2>Find and replace strings or template outputs in text files (CLI tool designe
<main>
<p>I, for one, welcome our new insect overlords.</p>
<ul>
<li>Release: v1.3.0</li>
<li>Release: v1.3.1</li>
<li>Minor: v1.3</li>
<li>Major: v1</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2>Find and replace strings or template outputs in text files (CLI tool designe
<main>
<p>I, for one, welcome our new insect overlords.</p>
<ul>
<li>Release: v1.3.0</li>
<li>Release: v1.3.1</li>
<li>Minor: v1.3</li>
<li>Major: v1</li>
</ul>
Expand Down

0 comments on commit 4c20794

Please sign in to comment.