react-build-sitemap
Advanced tools
Comparing version 0.1.22 to 0.1.23
15
index.js
import babelParser from "@babel/parser"; | ||
import fs from "fs"; | ||
import PropTypes from "prop-types"; | ||
import { warn } from "console"; | ||
@@ -18,3 +17,3 @@ const buildSitemap = (fileName, buildPath, url) => { | ||
if (fileType === undefined) { | ||
throw new warn( | ||
throw new Error( | ||
"The passed file is neither Javascript nor Typescript. Skipping." | ||
@@ -32,5 +31,5 @@ ); | ||
]; | ||
// if component does not exist, throw warning and skip. | ||
// if component does not exist, throw error and skip. | ||
if (fileName === undefined || fileName === null) { | ||
throw new warn("Component does not exist to generate sitemap. Skipping."); | ||
throw new Error("Component does not exist to generate sitemap. Skipping."); | ||
} | ||
@@ -69,3 +68,3 @@ // read through jsx | ||
if (functionObj.length === 0 && classObj.length === 0) { | ||
throw new warn( | ||
throw new Error( | ||
"There is no function declaration in this file: Perhaps it is not a React Component? Skipping." | ||
@@ -153,3 +152,3 @@ ); | ||
if (renderJson.length === 0) { | ||
throw new warn( | ||
throw new Error( | ||
"There is no return statement in this file: Have you written any JSX? Skipping." | ||
@@ -172,5 +171,5 @@ ); | ||
} | ||
// if does not exist, throw a warning saying it doesn't exist and skip running. | ||
// if does not exist, throw an error saying it doesn't exist and skip running. | ||
if (router === undefined) { | ||
throw new warn( | ||
throw new Error( | ||
"The component you passed has no router to iterate through. Skipping." | ||
@@ -177,0 +176,0 @@ ); |
{ | ||
"name": "react-build-sitemap", | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"description": "simple library that generates a sitemap from your react router", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44177
196