@ijonis/geo-lint 0.1.1 → 0.1.2

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
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // src/cli.ts
4
+ import { createRequire } from "module";
5
+
3
6
  // src/index.ts
4
7
  import { resolve as resolve2 } from "path";
5
8
 
@@ -15798,6 +15801,8 @@ async function lint(options = {}) {
15798
15801
  }
15799
15802
 
15800
15803
  // src/cli.ts
15804
+ var require2 = createRequire(import.meta.url);
15805
+ var { version } = require2("../package.json");
15801
15806
  var args = process.argv.slice(2);
15802
15807
  function getFlag(name) {
15803
15808
  const arg = args.find((a) => a.startsWith(`--${name}=`));
@@ -15830,25 +15835,25 @@ Examples:
15830
15835
  `);
15831
15836
  }
15832
15837
  function printVersion() {
15833
- console.log("0.1.0");
15838
+ console.log(version);
15834
15839
  }
15835
15840
  async function printRules() {
15836
15841
  const projectRoot = getFlag("root") ?? process.cwd();
15842
+ let config;
15837
15843
  try {
15838
- const config = await loadConfig(projectRoot);
15839
- const linkExtractor = createLinkExtractor(config.siteUrl);
15840
- const rules = buildRules(config, linkExtractor);
15841
- const ruleList = rules.map((r) => ({
15842
- name: r.name,
15843
- severity: r.severity,
15844
- category: r.category ?? "uncategorized",
15845
- fixStrategy: r.fixStrategy ?? null
15846
- }));
15847
- console.log(JSON.stringify(ruleList, null, 2));
15844
+ config = await loadConfig(projectRoot);
15848
15845
  } catch {
15849
- console.error("geo-lint: Could not load config. Create a geo-lint.config.ts first.");
15850
- process.exit(1);
15846
+ config = { siteUrl: "https://example.com", ...DEFAULT_CONFIG };
15851
15847
  }
15848
+ const linkExtractor = createLinkExtractor(config.siteUrl);
15849
+ const rules = buildRules(config, linkExtractor);
15850
+ const ruleList = rules.map((r) => ({
15851
+ name: r.name,
15852
+ severity: r.severity,
15853
+ category: r.category ?? "uncategorized",
15854
+ fixStrategy: r.fixStrategy ?? null
15855
+ }));
15856
+ console.log(JSON.stringify(ruleList, null, 2));
15852
15857
  }
15853
15858
  async function main() {
15854
15859
  if (hasFlag("help") || hasFlag("h")) {