eyelang 0.1.6 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyelang",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "A small Prolog-syntax-subset logic programming language for rules, goals, answers, and proofs.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -190,6 +190,19 @@ why(
190
190
  assertEqual(result.stderr, '', 'stderr');
191
191
  },
192
192
  },
193
+ {
194
+ name: 'npm exec can run package CLI bin from checkout',
195
+ run: () => {
196
+ const result = spawnSync('npm', ['exec', '--', 'eyelang', '--version'], {
197
+ cwd: packageRoot,
198
+ encoding: 'utf8',
199
+ env: { ...process.env, npm_config_update_notifier: 'false' },
200
+ });
201
+ assertEqual(result.status, 0, 'exit status');
202
+ assertEqual(result.stdout, `eyelang ${pkg.version}\n`, 'stdout');
203
+ assertEqual(result.stderr, '', 'stderr');
204
+ },
205
+ },
193
206
  {
194
207
  name: 'stdin input is accepted',
195
208
  run: () => {
@@ -285,6 +298,16 @@ function documentationSyncCases() {
285
298
  name: 'documented npm scripts exist in package.json',
286
299
  run: () => assertArrayEqual(missingDocumentedPackageScripts(), [], 'missing documented npm scripts'),
287
300
  },
301
+ {
302
+ name: 'source-checkout setup docs match package bin',
303
+ run: () => {
304
+ assertEqual(pkg.bin?.eyelang, './bin/eyelang.js', 'package eyelang bin');
305
+ const binPath = path.join(packageRoot, pkg.bin.eyelang);
306
+ const binText = fs.readFileSync(binPath, 'utf8');
307
+ assertEqual(binText.startsWith('#!/usr/bin/env node\n'), true, 'bin shebang');
308
+ assertArrayEqual(misleadingDependencyInstallDocs(), [], 'misleading dependency install docs');
309
+ },
310
+ },
288
311
  ];
289
312
  }
290
313
 
@@ -483,6 +506,17 @@ function whiteBoxCases() {
483
506
  assertEqual(termToString(candidates.primary[0].head, new Env(), true), 'edge(a, b)', 'primary head');
484
507
  },
485
508
  },
509
+ {
510
+ name: 'collatz example keeps recursive trajectory predicate memoized',
511
+ run: () => {
512
+ const text = fs.readFileSync(path.join(packageRoot, 'examples', 'collatz-1000.pl'), 'utf8');
513
+ const program = Program.parseSources([{ text, filename: 'collatz-1000.pl' }]);
514
+ const group = program.findGroup('collatz', 2);
515
+ assertEqual(Boolean(group), true, 'collatz/2 group exists');
516
+ assertEqual(group.memoized, true, 'collatz/2 memoized');
517
+ assertEqual(group.recursive, true, 'collatz/2 recursive');
518
+ },
519
+ },
486
520
  ];
487
521
  }
488
522
 
@@ -607,14 +641,19 @@ function declaredValueExportNames() {
607
641
  function missingDocumentedPackageScripts() {
608
642
  const docs = documentationFiles();
609
643
  const missing = [];
644
+ const nativeCommands = new Set(['exec', 'install', 'link']);
610
645
  for (const file of docs) {
611
646
  const text = fs.readFileSync(file, 'utf8');
612
647
  for (const line of text.split('\n')) {
613
648
  const trimmed = line.trim();
614
- if (!trimmed.startsWith('npm ') && !line.includes('`npm ')) continue;
615
- for (const match of line.matchAll(/\bnpm\s+(?:run\s+)?([A-Za-z0-9:_-]+)/g)) {
649
+ const commandTexts = [];
650
+ if (trimmed.startsWith('npm ')) commandTexts.push(trimmed);
651
+ for (const match of line.matchAll(/`([^`]*\bnpm\s+[^`]*)`/g)) commandTexts.push(match[1].trim());
652
+ for (const commandText of commandTexts) {
653
+ const match = commandText.match(/^npm\s+(?:run\s+)?([A-Za-z0-9:_-]+)/);
654
+ if (match == null) continue;
616
655
  const command = match[1];
617
- if (command === 'install') continue;
656
+ if (nativeCommands.has(command)) continue;
618
657
  const script = command === 'test' ? 'test' : command;
619
658
  if (!pkg.scripts?.[script]) missing.push(`${path.relative(packageRoot, file)}: npm ${command === 'test' ? 'test' : `run ${script}`}`);
620
659
  }
@@ -623,6 +662,18 @@ function missingDocumentedPackageScripts() {
623
662
  return [...new Set(missing)].sort();
624
663
  }
625
664
 
665
+ function misleadingDependencyInstallDocs() {
666
+ const misleading = [];
667
+ for (const file of documentationFiles()) {
668
+ const text = fs.readFileSync(file, 'utf8');
669
+ if (text.includes('Install dependencies')) misleading.push(`${path.relative(packageRoot, file)}: Install dependencies`);
670
+ if (text.includes('npm install\n```') || text.includes('npm install\r\n```')) {
671
+ misleading.push(`${path.relative(packageRoot, file)}: bare npm install setup block`);
672
+ }
673
+ }
674
+ return [...new Set(misleading)].sort();
675
+ }
676
+
626
677
  function findBrokenDocLinks() {
627
678
  const broken = [];
628
679
  const anchorsByFile = new Map();