keepmeachangelog 0.0.0-stage → 0.3.0
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/README.md +24 -2
- package/bin/cli.js +53 -0
- package/package.json +31 -5
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# keepmeachangelog (npm)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Linter for changelogs following [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/).
|
|
4
|
+
|
|
5
|
+
This package is a thin wrapper around the Python tool
|
|
6
|
+
[`keepmeachangelog`](https://pypi.org/project/keepmeachangelog/). It runs the Python
|
|
7
|
+
package pinned to the same version, using the first of these available on your machine:
|
|
8
|
+
`uvx`, `pipx run`, or `python3 -m` (when the package is already installed).
|
|
9
|
+
You need [uv](https://docs.astral.sh/uv/), pipx or Python 3.11+.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npx keepmeachangelog . # also: bunx keepmeachangelog . / yarn dlx keepmeachangelog .
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
In a Node project:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm i -D keepmeachangelog
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{ "scripts": { "changelog:lint": "keepmeachangelog --version-from package.json ." } }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
See the [main README](https://github.com/dcotecnologia/keepmeachangelog-lint#readme) for rules and options.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Thin wrapper: runs the Python `keepmeachangelog` package, pinned to this
|
|
5
|
+
// package's version, using the first runner available (uvx, pipx, python).
|
|
6
|
+
|
|
7
|
+
const { spawnSync } = require("node:child_process");
|
|
8
|
+
|
|
9
|
+
const { version } = require("../package.json");
|
|
10
|
+
|
|
11
|
+
function runners(argv) {
|
|
12
|
+
const spec = `keepmeachangelog==${version}`;
|
|
13
|
+
return [
|
|
14
|
+
{ cmd: "uvx", args: [spec, ...argv] },
|
|
15
|
+
{ cmd: "pipx", args: ["run", "--spec", spec, "keepmeachangelog", ...argv] },
|
|
16
|
+
// Only when the package is already installed in that interpreter.
|
|
17
|
+
...["python3", "python"].map((cmd) => ({
|
|
18
|
+
cmd,
|
|
19
|
+
args: ["-m", "keepmeachangelog.cli", ...argv],
|
|
20
|
+
probe: ["-c", "import keepmeachangelog"],
|
|
21
|
+
})),
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function available(spawn, runner) {
|
|
26
|
+
if (!runner.probe) return true;
|
|
27
|
+
const r = spawn(runner.cmd, runner.probe, { stdio: "ignore" });
|
|
28
|
+
return !r.error && r.status === 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function run(argv, spawn = spawnSync) {
|
|
32
|
+
for (const runner of runners(argv)) {
|
|
33
|
+
if (!available(spawn, runner)) continue;
|
|
34
|
+
const r = spawn(runner.cmd, runner.args, { stdio: "inherit" });
|
|
35
|
+
if (r.error && r.error.code === "ENOENT") continue;
|
|
36
|
+
if (r.error) {
|
|
37
|
+
console.error(`keepmeachangelog: ${r.error.message}`);
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
40
|
+
return r.status === null ? 1 : r.status;
|
|
41
|
+
}
|
|
42
|
+
console.error(
|
|
43
|
+
"keepmeachangelog: needs uv (https://docs.astral.sh/uv/), pipx or Python 3.11+ " +
|
|
44
|
+
"with the `keepmeachangelog` package installed."
|
|
45
|
+
);
|
|
46
|
+
return 127;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = { run, runners };
|
|
50
|
+
|
|
51
|
+
if (require.main === module) {
|
|
52
|
+
process.exitCode = run(process.argv.slice(2));
|
|
53
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"bin": {
|
|
3
|
+
"keepmeachangelog": "bin/cli.js"
|
|
4
|
+
},
|
|
5
|
+
"description": "Linter for CHANGELOG files following Keep a Changelog 1.1.0 (wrapper around the Python package)",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/dcotecnologia/keepmeachangelog-lint",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"changelog",
|
|
16
|
+
"keep-a-changelog",
|
|
17
|
+
"lint",
|
|
18
|
+
"linter",
|
|
19
|
+
"semver"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"name": "keepmeachangelog",
|
|
23
|
+
"repository": {
|
|
24
|
+
"directory": "npm",
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/dcotecnologia/keepmeachangelog-lint.git"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "node --test"
|
|
30
|
+
},
|
|
31
|
+
"version": "0.3.0"
|
|
32
|
+
}
|