eyeprolog 1.1.10 → 1.1.11
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 +29 -4
- package/package.json +1 -1
- package/test/run-regression.mjs +37 -0
- package/the-art-of-eyeprolog.md +24 -0
package/README.md
CHANGED
|
@@ -21,11 +21,22 @@ examples, proofs, conformance, and implementation.
|
|
|
21
21
|
|
|
22
22
|
## Quick start
|
|
23
23
|
|
|
24
|
-
EyeProlog requires Node.js 18 or newer.
|
|
24
|
+
EyeProlog requires Node.js 18 or newer. Check the active runtime before
|
|
25
|
+
installing:
|
|
25
26
|
|
|
26
27
|
```sh
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
node --version
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If it reports an older release, upgrade through a Node version manager or the
|
|
32
|
+
[official Node.js download](https://nodejs.org/en/download) and check again.
|
|
33
|
+
Distribution packages can provide an older Node.js even on a current operating
|
|
34
|
+
system.
|
|
35
|
+
|
|
36
|
+
Run EyeProlog without a global installation:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npx --yes eyeprolog
|
|
29
40
|
?- use_module(library(lists)).
|
|
30
41
|
true.
|
|
31
42
|
?- member(X, [prolog, logic]).
|
|
@@ -34,11 +45,25 @@ eyeprolog
|
|
|
34
45
|
?- halt.
|
|
35
46
|
```
|
|
36
47
|
|
|
48
|
+
For a persistent `eyeprolog` command without administrator access, install it
|
|
49
|
+
under a user-owned prefix and put that prefix's `bin` directory on `PATH`:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npm install --global --prefix "$HOME/.local" eyeprolog
|
|
53
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
54
|
+
eyeprolog
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Add the `PATH` export to your shell startup file to keep it across sessions.
|
|
58
|
+
Do not use `sudo npm install`; npm's
|
|
59
|
+
[EACCES guidance](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally/)
|
|
60
|
+
also recommends a Node version manager or a user-owned npm prefix.
|
|
61
|
+
|
|
37
62
|
For a non-interactive run:
|
|
38
63
|
|
|
39
64
|
```sh
|
|
40
65
|
printf 'human(socrates).\nmortal(X) :- human(X).\n' |
|
|
41
|
-
eyeprolog --proof --goal 'mortal(socrates)' -
|
|
66
|
+
npx --yes eyeprolog --proof --goal 'mortal(socrates)' -
|
|
42
67
|
```
|
|
43
68
|
|
|
44
69
|
Programs may declare their default queries with `%% goal:` comments.
|
package/package.json
CHANGED
package/test/run-regression.mjs
CHANGED
|
@@ -516,6 +516,27 @@ c4 ?- call((!;1)).
|
|
|
516
516
|
assertEqual(result.stderr, '', 'stderr');
|
|
517
517
|
},
|
|
518
518
|
},
|
|
519
|
+
{
|
|
520
|
+
name: 'npm can install the CLI under a user-owned prefix',
|
|
521
|
+
run: () => {
|
|
522
|
+
const prefix = path.join(tmp, `npm-prefix-${++tmpCounter}`);
|
|
523
|
+
const installed = spawnSync('npm', [
|
|
524
|
+
'install', '--global', '--prefix', prefix, '--loglevel=silent', '--no-audit', '--no-fund', '.',
|
|
525
|
+
], {
|
|
526
|
+
cwd: packageRoot,
|
|
527
|
+
encoding: 'utf8',
|
|
528
|
+
env: { ...process.env, npm_config_update_notifier: 'false' },
|
|
529
|
+
});
|
|
530
|
+
assertEqual(installed.status, 0, 'install exit status');
|
|
531
|
+
const executable = process.platform === 'win32'
|
|
532
|
+
? path.join(prefix, 'eyeprolog.cmd')
|
|
533
|
+
: path.join(prefix, 'bin', 'eyeprolog');
|
|
534
|
+
const result = spawnSync(executable, ['--version'], { encoding: 'utf8' });
|
|
535
|
+
assertEqual(result.status, 0, 'installed CLI exit status');
|
|
536
|
+
assertEqual(result.stdout, `eyeprolog ${pkg.version}\n`, 'installed CLI stdout');
|
|
537
|
+
assertEqual(result.stderr, '', 'installed CLI stderr');
|
|
538
|
+
},
|
|
539
|
+
},
|
|
519
540
|
{
|
|
520
541
|
name: 'stdin input is accepted',
|
|
521
542
|
run: () => {
|
|
@@ -979,6 +1000,22 @@ function documentationSyncCases() {
|
|
|
979
1000
|
assertArrayEqual(misleadingDependencyInstallDocs(), [], 'misleading dependency install docs');
|
|
980
1001
|
},
|
|
981
1002
|
},
|
|
1003
|
+
{
|
|
1004
|
+
name: 'installation docs avoid unsupported Node and global npm permission traps',
|
|
1005
|
+
run: () => {
|
|
1006
|
+
assertEqual(pkg.engines?.node, '>=18', 'supported Node range');
|
|
1007
|
+
for (const filename of ['README.md', 'the-art-of-eyeprolog.md']) {
|
|
1008
|
+
const text = fs.readFileSync(path.join(packageRoot, filename), 'utf8');
|
|
1009
|
+
assertIncludes(text, 'node --version', `${filename} checks Node version`);
|
|
1010
|
+
assertIncludes(text, 'npx --yes eyeprolog', `${filename} offers a non-global launch`);
|
|
1011
|
+
assertIncludes(text, 'npm install --global --prefix "$HOME/.local" eyeprolog', `${filename} uses a user prefix`);
|
|
1012
|
+
assertIncludes(text, 'https://nodejs.org/en/download', `${filename} links Node upgrades`);
|
|
1013
|
+
assertIncludes(text, 'https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally/', `${filename} links npm EACCES guidance`);
|
|
1014
|
+
assertEqual(text.includes('sudo npm install'), true, `${filename} explicitly warns against sudo npm`);
|
|
1015
|
+
assertEqual(/^\s*sudo npm install/m.test(text), false, `${filename} never recommends sudo npm`);
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
982
1019
|
];
|
|
983
1020
|
}
|
|
984
1021
|
|
package/the-art-of-eyeprolog.md
CHANGED
|
@@ -79,6 +79,30 @@ Then ask for the derivations:
|
|
|
79
79
|
node bin/eyeprolog.js --proof examples/socrates.pl
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
To use the published package, first verify that `node --version` reports Node.js
|
|
83
|
+
18 or newer. Upgrade an older runtime through a Node version manager or the
|
|
84
|
+
[official Node.js download](https://nodejs.org/en/download). A current Linux
|
|
85
|
+
distribution can still expose an older Node.js package.
|
|
86
|
+
|
|
87
|
+
The package can be launched without a global installation:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
npx --yes eyeprolog
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For a persistent command without administrator access, install into a
|
|
94
|
+
user-owned prefix:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
npm install --global --prefix "$HOME/.local" eyeprolog
|
|
98
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Persist the `PATH` export in the appropriate shell startup file. Do not use
|
|
102
|
+
`sudo npm install`; npm's
|
|
103
|
+
[EACCES guidance](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally/)
|
|
104
|
+
recommends a Node version manager or a user-owned npm prefix.
|
|
105
|
+
|
|
82
106
|
Readers who do not want to install anything can begin in the
|
|
83
107
|
[browser playground](https://eyereasoner.github.io/eyeprolog/playground). Paste
|
|
84
108
|
the source of `examples/socrates.pl` into the editor and run it. The playground
|