prolog-notebook 0.3.0 → 0.3.1
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/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/src/build-info.js +27 -18
- package/src/build-info.json +2 -3
- package/src/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.1] — 2026-08-30
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **The build line in `--version` carries one date, and it is the build's.**
|
|
8
|
+
|
|
9
|
+
Built from commit ca69c2a on 2026-08-30 14:42:46 UTC
|
|
10
|
+
Working copy ca69c2a (modified)
|
|
11
|
+
|
|
12
|
+
The commit's own date is gone: the hash already identifies it, and anyone who wants it can
|
|
13
|
+
ask git. A working copy now carries no date at all, which follows from the same rule rather
|
|
14
|
+
than being a separate decision — the only date left is the build's, and a working copy has
|
|
15
|
+
not been built. UTC, to the second, because a build stamp is read by whoever is holding the
|
|
16
|
+
package, wherever they are.
|
|
17
|
+
|
|
3
18
|
## [0.3.0] — 2026-08-30
|
|
4
19
|
|
|
5
20
|
**A chapter is a file you can read, run, and fill in from the command line.** The renderer,
|
package/package.json
CHANGED
package/src/build-info.js
CHANGED
|
@@ -8,18 +8,19 @@
|
|
|
8
8
|
//
|
|
9
9
|
// TWO STATES, NAMED, because they are not the same claim:
|
|
10
10
|
//
|
|
11
|
-
//
|
|
12
|
-
// Working copy ccf8e5b (modified)
|
|
11
|
+
// Built from commit ccf8e5b on 2026-08-30 14:32:51 UTC
|
|
12
|
+
// Working copy ccf8e5b (modified)
|
|
13
13
|
//
|
|
14
14
|
// The first is baked in by the release workflow just before publish — git exists
|
|
15
15
|
// there and does not exist inside an installed package. The second is read from
|
|
16
16
|
// git at run time, and says `(modified)` when the tree has edits, because a bare
|
|
17
17
|
// SHA over a dirty tree names a program that nobody has.
|
|
18
18
|
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
// why
|
|
19
|
+
// ONE DATE, AND IT IS THE BUILD'S. The commit's own date is not printed because
|
|
20
|
+
// the hash already identifies it — anyone who wants it can ask git — and two
|
|
21
|
+
// dates where one was asked for is noise dressed as rigour. A working copy has no
|
|
22
|
+
// build time at all, which is why that state carries no date: there is nothing to
|
|
23
|
+
// date yet.
|
|
23
24
|
import { execFileSync } from 'node:child_process';
|
|
24
25
|
import { readFileSync } from 'node:fs';
|
|
25
26
|
|
|
@@ -31,15 +32,13 @@ const BAKED = new URL('./build-info.json', import.meta.url);
|
|
|
31
32
|
*
|
|
32
33
|
* Pure, so both states can be tested without a filesystem or a git repository.
|
|
33
34
|
*
|
|
34
|
-
* @param {{commit: string,
|
|
35
|
+
* @param {{commit: string, built?: string, modified?: boolean}|null} info
|
|
35
36
|
* @returns {string|null}
|
|
36
37
|
*/
|
|
37
38
|
export function buildLine(info) {
|
|
38
39
|
if (!info?.commit) return null;
|
|
39
|
-
if (info.
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
return `Working copy ${info.commit}${info.modified ? ' (modified)' : ''}, committed ${info.committed}`;
|
|
40
|
+
if (info.built) return `Built from commit ${info.commit} on ${info.built}`;
|
|
41
|
+
return `Working copy ${info.commit}${info.modified ? ' (modified)' : ''}`;
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
/**
|
|
@@ -49,7 +48,7 @@ export function buildLine(info) {
|
|
|
49
48
|
* this existed, or a source tree with no history. A line that says "unknown"
|
|
50
49
|
* three times is worse than no line.
|
|
51
50
|
*
|
|
52
|
-
* @returns {{commit: string,
|
|
51
|
+
* @returns {{commit: string, built?: string, modified?: boolean}|null}
|
|
53
52
|
*/
|
|
54
53
|
export function currentBuild() {
|
|
55
54
|
try {
|
|
@@ -75,20 +74,30 @@ function fromGit() {
|
|
|
75
74
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
76
75
|
}).trim();
|
|
77
76
|
try {
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
return {
|
|
78
|
+
commit: git('log', '-1', '--format=%h'),
|
|
79
|
+
modified: git('status', '--porcelain') !== '',
|
|
80
|
+
};
|
|
80
81
|
} catch {
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
/**
|
|
86
|
-
* The facts, as
|
|
87
|
-
* time and the code that reads the result agree on the shape.
|
|
87
|
+
* The facts, as the release writes them. Exported so the script that runs at
|
|
88
|
+
* publish time and the code that reads the result agree on the shape.
|
|
89
|
+
*
|
|
90
|
+
* UTC, spelled out. A build stamp is read by whoever is holding the package,
|
|
91
|
+
* wherever they are, and a bare local time from someone else's machine says less
|
|
92
|
+
* than nothing.
|
|
88
93
|
*
|
|
89
|
-
* @param {{commit: string
|
|
94
|
+
* @param {{commit: string}} head
|
|
90
95
|
* @param {Date} [now]
|
|
96
|
+
* @returns {{commit: string, built: string}}
|
|
91
97
|
*/
|
|
92
98
|
export function bakedFrom(head, now = new Date()) {
|
|
93
|
-
return {
|
|
99
|
+
return {
|
|
100
|
+
commit: head.commit,
|
|
101
|
+
built: `${now.toISOString().slice(0, 19).replace('T', ' ')} UTC`,
|
|
102
|
+
};
|
|
94
103
|
}
|
package/src/build-info.json
CHANGED
package/src/version.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export const NAME = 'Prolog Notebook';
|
|
11
11
|
|
|
12
12
|
/** Must equal package.json's `version` — test/run.test.mjs enforces it. */
|
|
13
|
-
export const VERSION = '0.3.
|
|
13
|
+
export const VERSION = '0.3.1';
|
|
14
14
|
|
|
15
15
|
/** The two facts a licence notice is actually made of. */
|
|
16
16
|
export const YEAR = '2026';
|