npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ionic-react-sitemap

v1.0.0

Published

Generate a sitemap for an Ionic/React app

Downloads

2

Readme

Ionic React Sitemap

Ionic React Sitemap is a tool for generating a sitemap for an Ionic/React apps. It's based off lanierc's react-build-sitemap. Supports typescript.

This package is far from perfect, but it gets the job done! If you notice any issues or have suggestions for improvements, you are welcome to submit pull requests. Your contribution is appreciated in making this package better for everyone.

Installation

You can install this tool using npm:

npm install ionic-react-sitemap

Or you may use ionic-react-sitemap package via with npx:

Usage

NPX

You may use it easily on your CI;

npx ionic-react-sitemap ./src/App.js ./build http://yoururl.com

This command generates a sitemap for an Ionic/React app with the main entry file located at ./src/App.js, the build directory located at ./build, and the base URL set to http://yoururl.com.

If you don't specify the --url, --app-path, or --build-path options, the tool will prompt you to enter the values interactively. For example:

npx ionic-react-sitemap

This command will prompt you to enter the app path, build path, and base URL for your app.

JS

You can use Ionic React Sitemap in your plain JavaScript code:

const generateSitemap = require('ionic-react-sitemap');

const appPath = './src/App.js';
const buildPath = './build';
const url = 'http://yoururl.com';

generateSitemap(appPath, buildPath, url)
  .then(() => {
    console.log(`Sitemap generated successfully at ${buildPath}/sitemap.xml`);
  })
  .catch((error) => {
    console.error('Error generating sitemap:', error);
  });

Build Process

Or you can use it in your build process:

const generateSitemap = require('ionic-react-sitemap');
const path = require('path');
const webpack = require('webpack');

const appPath = './src/App.js';
const buildPath = './build';
const url = 'http://yoururl.com';

generateSitemap(appPath, buildPath, url)
  .then(() => {
    const config = {
      entry: appPath,
      output: {
        path: path.resolve(__dirname, buildPath),
        filename: 'bundle.js',
      },
      // ...
    };

    webpack(config, (err, stats) => {
      // ...
    });
  })
  .catch((error) => {
    console.error('Error generating sitemap:', error);
  });

API

| Method Signature | Description | | ---------------- | ----------- | | generateSitemap(appPath: string, buildPath: string, url: string): Promise<void> | Generate a sitemap for an Ionic/React app. |

Parameters

| Parameter | Type | Default | Description | | --------- | ---- | ------- |-------------------------------------------------------------------| | appPath | string | ./src/App.js or ./src/App.tsx | The path to the app's main entry file (e.g. ./src/App.tsx). | | buildPath | string | ./build | The path to the build directory for the app (e.g. ./build). | | url | string | null | The base URL for the app. | | paths | string[] | ["page", "AppPages"] | (Experimental) Paths for dynamic routes based on a map/url array. | | elements | string[] | ["Route","IonRoute", "Redirect"] | JSX elements used to generate the sitemap. | | lastMod | boolean | true | Include <lastmod> tag. |

Known issues

  1. It may or may not work with class components.
  2. Nested Routes May or May not be Supported

License

MIT