@citemap/cli 0.3.2 → 0.3.3

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -9
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
2
 
4
3
  // src/index.ts
5
- var import_fs = require("fs");
6
- var import_path = require("path");
7
- var import_validator = require("@citemap/validator");
8
- var VERSION = "0.3.0";
4
+ import { readFileSync } from "fs";
5
+ import { resolve } from "path";
6
+ import { validate, validateAndDiagnose } from "@citemap/validator";
7
+ var VERSION = "0.3.3";
9
8
  var colors = {
10
9
  reset: "\x1B[0m",
11
10
  bright: "\x1B[1m",
@@ -40,8 +39,8 @@ function printVersion() {
40
39
  }
41
40
  function loadJSON(filePath) {
42
41
  try {
43
- const absolutePath = (0, import_path.resolve)(filePath);
44
- const content = (0, import_fs.readFileSync)(absolutePath, "utf-8");
42
+ const absolutePath = resolve(filePath);
43
+ const content = readFileSync(absolutePath, "utf-8");
45
44
  return JSON.parse(content);
46
45
  } catch (error) {
47
46
  if (error instanceof SyntaxError) {
@@ -106,7 +105,7 @@ ${statusIcon} ${statusText} citemap.json ${colors.dim}v${result.version}${color
106
105
  process.exit(result.valid ? 0 : 1);
107
106
  }
108
107
  function formatDiagnosticOutput(data) {
109
- const result = (0, import_validator.validateAndDiagnose)(data);
108
+ const result = validateAndDiagnose(data);
110
109
  const diag = result.diagnosis;
111
110
  const statusIcon = result.valid ? `${colors.green}\u2713${colors.reset}` : `${colors.red}\u2717${colors.reset}`;
112
111
  const statusText = result.valid ? `${colors.green}Valid${colors.reset}` : `${colors.red}Invalid${colors.reset}`;
@@ -202,7 +201,7 @@ async function main() {
202
201
  }
203
202
  const data = loadJSON(filePath);
204
203
  if (command === "validate") {
205
- const result = (0, import_validator.validate)(data);
204
+ const result = validate(data);
206
205
  formatValidationOutput(result);
207
206
  } else if (command === "diagnose") {
208
207
  formatDiagnosticOutput(data);
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@citemap/cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Command-line tool for validating citemap.json files",
5
+ "type": "module",
5
6
  "bin": {
6
7
  "citemap": "./dist/index.js"
7
8
  },
@@ -9,7 +10,7 @@
9
10
  "dist"
10
11
  ],
11
12
  "scripts": {
12
- "build": "tsup src/index.ts --format cjs --no-dts --out-dir dist && test -f dist/index.cjs && mv dist/index.cjs dist/index.js || true",
13
+ "build": "tsup src/index.ts --format esm --no-dts --out-dir dist",
13
14
  "dev": "node --loader ts-node/esm src/index.ts",
14
15
  "prepublishOnly": "npm run build"
15
16
  },