@ijonis/geo-lint 0.1.1 → 0.1.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.
package/dist/cli.cjs CHANGED
@@ -27,6 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
28
28
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
29
29
 
30
+ // src/cli.ts
31
+ var import_node_module = require("module");
32
+
30
33
  // src/index.ts
31
34
  var import_node_path4 = require("path");
32
35
 
@@ -15825,6 +15828,8 @@ async function lint(options = {}) {
15825
15828
  }
15826
15829
 
15827
15830
  // src/cli.ts
15831
+ var require2 = (0, import_node_module.createRequire)(importMetaUrl);
15832
+ var { version } = require2("../package.json");
15828
15833
  var args = process.argv.slice(2);
15829
15834
  function getFlag(name) {
15830
15835
  const arg = args.find((a) => a.startsWith(`--${name}=`));
@@ -15857,25 +15862,25 @@ Examples:
15857
15862
  `);
15858
15863
  }
15859
15864
  function printVersion() {
15860
- console.log("0.1.0");
15865
+ console.log(version);
15861
15866
  }
15862
15867
  async function printRules() {
15863
15868
  const projectRoot = getFlag("root") ?? process.cwd();
15869
+ let config;
15864
15870
  try {
15865
- const config = await loadConfig(projectRoot);
15866
- const linkExtractor = createLinkExtractor(config.siteUrl);
15867
- const rules = buildRules(config, linkExtractor);
15868
- const ruleList = rules.map((r) => ({
15869
- name: r.name,
15870
- severity: r.severity,
15871
- category: r.category ?? "uncategorized",
15872
- fixStrategy: r.fixStrategy ?? null
15873
- }));
15874
- console.log(JSON.stringify(ruleList, null, 2));
15871
+ config = await loadConfig(projectRoot);
15875
15872
  } catch {
15876
- console.error("geo-lint: Could not load config. Create a geo-lint.config.ts first.");
15877
- process.exit(1);
15873
+ config = { siteUrl: "https://example.com", ...DEFAULT_CONFIG };
15878
15874
  }
15875
+ const linkExtractor = createLinkExtractor(config.siteUrl);
15876
+ const rules = buildRules(config, linkExtractor);
15877
+ const ruleList = rules.map((r) => ({
15878
+ name: r.name,
15879
+ severity: r.severity,
15880
+ category: r.category ?? "uncategorized",
15881
+ fixStrategy: r.fixStrategy ?? null
15882
+ }));
15883
+ console.log(JSON.stringify(ruleList, null, 2));
15879
15884
  }
15880
15885
  async function main() {
15881
15886
  if (hasFlag("help") || hasFlag("h")) {