@gera2ld/tools-node 0.0.1 → 0.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -25
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,26 +1,15 @@
1
- import { readFile as d, writeFile as c } from "node:fs/promises";
2
- async function f(n, a) {
3
- const o = `${n.path}/README.md`, e = (await d(o, "utf8")).split(`
4
- `);
5
- let i = e.indexOf(""), s;
6
- if (i > 0 && (i += 1, e[i].includes("![") || (i = -1)), i < 0)
7
- s = -1;
8
- else
9
- for (s = i + 1; s < e.length && e[s].includes("!["); s += 1)
10
- ;
11
- const l = s < 0 ? [] : e.slice(i, s), t = [
12
- `[![NPM](https://img.shields.io/npm/v/${n.name}.svg)](https://npm.im/${n.name})`,
13
- `![License](https://img.shields.io/npm/l/${n.name}.svg)`,
14
- `[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/${n.name})`
15
- ];
16
- l.join(`
17
- `) !== t.join(`
18
- `) && (console.log(`[${n.name}] Badge updates:
19
-
20
- ${t.join(`
21
- `)}`), s < 0 ? e.splice(1, e[1] ? 0 : 1, "", ...t, "") : e.splice(i, s - i, ...t), a && (await c(o, e.join(`
22
- `)), console.log(`[${n.name}] New badges written`)));
1
+ import { readFile as e, writeFile as t } from "node:fs/promises";
2
+ //#region src/badge.ts
3
+ async function n(n, r) {
4
+ let i = `${n.path}/README.md`, a = (await e(i, "utf8")).split("\n"), o = a.indexOf(""), s;
5
+ if (o > 0 && (o += 1, a[o].includes("![") || (o = -1)), o < 0) s = -1;
6
+ else for (s = o + 1; s < a.length && a[s].includes("!["); s += 1);
7
+ let c = s < 0 ? [] : a.slice(o, s), l = [
8
+ `[![NPM](https://img.shields.io/npm/v/${n.name}.svg)](https://npm.im/${n.name})`,
9
+ `![License](https://img.shields.io/npm/l/${n.name}.svg)`,
10
+ `[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/${n.name})`
11
+ ];
12
+ c.join("\n") !== l.join("\n") && (console.log(`[${n.name}] Badge updates:\n\n${l.join("\n")}`), s < 0 ? a.splice(1, +!a[1], "", ...l, "") : a.splice(o, s - o, ...l), r && (await t(i, a.join("\n")), console.log(`[${n.name}] New badges written`)));
23
13
  }
24
- export {
25
- f as updateBadges
26
- };
14
+ //#endregion
15
+ export { n as updateBadges };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gera2ld/tools-node",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {