runtime-pin-check 0.1.0 → 0.1.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/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  scanFiles,
13
13
  scopesOf,
14
14
  toRange
15
- } from "./chunk-DBYFB476.js";
15
+ } from "./chunk-TRO76P2I.js";
16
16
 
17
17
  // src/cli.ts
18
18
  import { realpathSync } from "fs";
@@ -1384,6 +1384,28 @@ function dockerfileSources(file, text2, runtime) {
1384
1384
  }
1385
1385
  return out;
1386
1386
  }
1387
+ function isGitlabCi(file) {
1388
+ return /^\.gitlab-ci\.ya?ml$/i.test(baseName(file));
1389
+ }
1390
+ function gitlabSources(file, text2, runtime) {
1391
+ const out = [];
1392
+ for (const img of parseGitlabCi(text2)) {
1393
+ if (!isRuntimeImage(img.image, runtime)) continue;
1394
+ const written = splitImageRef(img.raw);
1395
+ const raw = written.tag ?? img.raw;
1396
+ const tagOffset = written.tag === void 0 ? 0 : written.image.length + 1;
1397
+ out.push({
1398
+ runtime,
1399
+ file,
1400
+ line: img.line,
1401
+ column: img.column + tagOffset,
1402
+ raw,
1403
+ kind: "gitlab-ci",
1404
+ constraint: dockerConstraint(img.tag, img.digest, runtime)
1405
+ });
1406
+ }
1407
+ return out;
1408
+ }
1387
1409
  function toolVersionsSources(file, text2, runtime, tools) {
1388
1410
  const out = [];
1389
1411
  const lines = text2.split(/\r?\n/);
@@ -1560,6 +1582,7 @@ function dispatch(file, text2) {
1560
1582
  if (isToolVersions(file)) return toolVersionsSources(file, text2, "go", GO_TOOLS);
1561
1583
  if (isMiseFile(file)) return miseSources(file, text2, "go", GO_TOOLS);
1562
1584
  if (isDockerfile(file)) return dockerfileSources(file, text2, "go");
1585
+ if (isGitlabCi(file)) return gitlabSources(file, text2, "go");
1563
1586
  if (isWorkflowFile(file)) return workflowSources(file, text2, "go", "actions/setup-go", "go-version");
1564
1587
  return [];
1565
1588
  }
@@ -1903,6 +1926,7 @@ function dispatch2(file, text2) {
1903
1926
  if (isToolVersions(file)) return toolVersionsSources(file, text2, "python", ["python"]);
1904
1927
  if (isMiseFile(file)) return miseSources(file, text2, "python", ["python"]);
1905
1928
  if (isDockerfile(file)) return dockerfileSources(file, text2, "python");
1929
+ if (isGitlabCi(file)) return gitlabSources(file, text2, "python");
1906
1930
  if (isWorkflowFile(file)) return workflowSources(file, text2, "python", "actions/setup-python", "python-version");
1907
1931
  return [];
1908
1932
  }
@@ -2382,7 +2406,71 @@ function formatDiagnosticAnnotations(diagnostics, pathOf = (f) => f) {
2382
2406
  ` : "";
2383
2407
  }
2384
2408
 
2409
+ // package.json
2410
+ var package_default = {
2411
+ name: "runtime-pin-check",
2412
+ version: "0.1.1",
2413
+ description: "Find Node, Python and Go version pins that disagree across a repo's files, with file and line.",
2414
+ license: "MIT",
2415
+ type: "module",
2416
+ engines: {
2417
+ node: ">=22"
2418
+ },
2419
+ files: [
2420
+ "dist"
2421
+ ],
2422
+ bin: {
2423
+ "runtime-pin-check": "dist/cli.js"
2424
+ },
2425
+ main: "./dist/index.js",
2426
+ types: "./dist/index.d.ts",
2427
+ exports: {
2428
+ ".": {
2429
+ types: "./dist/index.d.ts",
2430
+ import: "./dist/index.js"
2431
+ },
2432
+ "./package.json": "./package.json"
2433
+ },
2434
+ sideEffects: false,
2435
+ scripts: {
2436
+ typecheck: "tsc --noEmit",
2437
+ test: "vitest run",
2438
+ build: "tsup",
2439
+ prepublishOnly: "npm run typecheck && npm test && npm run build"
2440
+ },
2441
+ keywords: [
2442
+ "node-version",
2443
+ "nvmrc",
2444
+ "engines",
2445
+ "python-version",
2446
+ "go-version",
2447
+ "ci",
2448
+ "monorepo"
2449
+ ],
2450
+ dependencies: {
2451
+ semver: "7.7.2",
2452
+ "smol-toml": "1.9.1",
2453
+ yaml: "2.9.1"
2454
+ },
2455
+ devDependencies: {
2456
+ "@types/node": "22.20.5",
2457
+ "@types/semver": "7.7.0",
2458
+ tsup: "8.5.0",
2459
+ typescript: "5.9.3",
2460
+ vitest: "3.2.4"
2461
+ },
2462
+ repository: {
2463
+ type: "git",
2464
+ url: "git+https://github.com/Mammost1/runtime-pin-check.git"
2465
+ },
2466
+ homepage: "https://github.com/Mammost1/runtime-pin-check#readme",
2467
+ bugs: {
2468
+ url: "https://github.com/Mammost1/runtime-pin-check/issues"
2469
+ }
2470
+ };
2471
+
2385
2472
  // src/cli.ts
2473
+ var VERSION = package_default.version;
2386
2474
  var RUNTIMES2 = ["node", "python", "go"];
2387
2475
  var SEVERITIES = ["error", "warning", "info"];
2388
2476
  var RANK2 = { error: 0, warning: 1, info: 2 };
@@ -2398,9 +2486,11 @@ Options:
2398
2486
  --runtime node,python,go only these runtimes (default: all)
2399
2487
  --fail-on error|warning|info exit 1 when a finding is at or above this level (default: error)
2400
2488
  --date YYYY-MM-DD check end-of-life and LTS aliases as of this date (default: today, UTC)
2401
- --include-fixtures also scan fixtures/, __fixtures__/, testdata/, test-fixtures/ (skipped by default)
2489
+ --include-fixtures also scan fixture folders (skipped by default: fixtures/, fixture/,
2490
+ __fixtures__/, test_fixtures/, test-fixtures/, testdata/, test_data/ ...)
2402
2491
  --exclude <glob> skip matching paths (repeatable; 'examples', 'docs/**', '*.Dockerfile')
2403
2492
  --fix --to <version> rewrite pins to <version> (with --runtime <one>, --dry-run, --fix-ranges)
2493
+ -v, --version print the version
2404
2494
  -h, --help show this help
2405
2495
 
2406
2496
  Exit codes: 0 no finding at or above --fail-on, 1 findings, 2 usage or I/O error.
@@ -2425,7 +2515,8 @@ function parseCliArgs(argv) {
2425
2515
  to: { type: "string" },
2426
2516
  "dry-run": { type: "boolean" },
2427
2517
  "fix-ranges": { type: "boolean" },
2428
- help: { type: "boolean", short: "h" }
2518
+ help: { type: "boolean", short: "h" },
2519
+ version: { type: "boolean", short: "v" }
2429
2520
  }
2430
2521
  });
2431
2522
  } catch (err) {
@@ -2463,7 +2554,8 @@ function parseCliArgs(argv) {
2463
2554
  to: v.to,
2464
2555
  dryRun: v["dry-run"] === true,
2465
2556
  fixRanges: v["fix-ranges"] === true,
2466
- help: v.help === true
2557
+ help: v.help === true,
2558
+ version: v.version === true
2467
2559
  };
2468
2560
  }
2469
2561
  async function readDirectory(dir, files, runtimes = RUNTIMES2) {
@@ -2610,6 +2702,11 @@ async function run(argv, io = defaultIo()) {
2610
2702
  ${USAGE}`);
2611
2703
  return 2;
2612
2704
  }
2705
+ if (options.version) {
2706
+ io.stdout(`${VERSION}
2707
+ `);
2708
+ return 0;
2709
+ }
2613
2710
  if (options.help) {
2614
2711
  io.stdout(USAGE);
2615
2712
  return 0;
@@ -2671,6 +2768,7 @@ if (isMain()) {
2671
2768
  }
2672
2769
  export {
2673
2770
  USAGE,
2771
+ VERSION,
2674
2772
  checkDirectory,
2675
2773
  collectSources,
2676
2774
  parseCliArgs,