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

@localised/create-localised-site

v1.1.0

Published

CLI tool to create a localized site

Downloads

4

Readme

Create Localised Site

This CLI is used to generate administrative react projects for Localised. The administrative react project that is generated by this CLI was initially generated by create-react-app and therefore has the same features and setup. For more information on create-react-app please visit their documentation. The projects implements Key Cloak authentication, React Router routing as well as the Backpack component library employing the Shell and ThemeProvider components. Additionally the project borrows a lot of its setup from the project ignition-ui which also was generated by create-react-app.

Usage

To initiate the command line run:

npx @localised/create-localised-site

You will be asked the following questions:

  1. What is your App Name? (Must be a valid name for a directory)

This is used for the name of the file folder of the project as well as in the package.json as the applications name. The default is my-app.

  1. What is your App's Display Name? (Shown in the App's title bar)

This is used is title bar in the browser and in the header. This defaults to My App.

  1. What is the Key Cloak application name? (Must be valid Keycloak name)

This is used for configuring KeyCloak with the key for the application name. This defaults to ignition-web.

  1. What is the Key Cloak role key? (User role used for resource access)

This is used for configuring KeyCloak checking the authenticated user role. This defaults to ignition-access.

Generated Project Layout

public

https://create-react-app.dev/docs/using-the-public-folder/

src/components/Loading

Displayed during initial render of the application.

src/components/LoginError

Displayed if authentication through Key Cloak errors.

src/components/Scaffold

Used to wrap the applications content with a sidebar and header whom contain route links, logo, application title and logout button. Implements Backpack Shell component, useShell hook and imports routes from the router.

src/components/Theme

Implements Backpack's ThemeProvider that styles Backpack components in the application using the themeConfig in fixtures.js. Implements dark mode and light mode using the context api that toggles settings in the ThemeProvider and sets the bodies background color depending on the mode. To switch the theme use the useThemeMode hook which exports the mode and the toggleTheme function.

src/envs

Contains application enviroment variables used for production, staging, test such as for Key Cloak configuration.

src/fonts

Contains application fonts.

src/hooks/useShell.js

Generates properties to power the Scaffold including the currently selectedNavOption in the sidebar and routeHeaders to display in the header such as the App Title.

src/hooks/useThemeMode.js

Exports current mode as either light or dark and provides toggleTheme function. Used in conjunction with <Theme/> component.

src/routes/index.js

Implements react-router and renders routes config defined in routes.js.

src/routes/routes.js

Each route uses schema:

{
  path: `/`, // Route path pattern to render the route
  exact: true, // Whether the pattern of the path exactly or overlaps with similar paths
  component: Home, // Component the the route renders
  header: [
    {
      component: () => <HeaderComonent /> // componet displayed in the header of the Shell
      position: `left` // positions of `left`, `middle`, `bottom`
    }
  ],
  // Siderbar configuration object imported into backpack shell
  // Route is hidden from sidebar if property is not defined
  sidebar: { 
    tooltip: `Home`, // tooltip string of SidebarLink
    icon: `home`, // icon string of SidebarLink defined in https://fonts.google.com/icons
    position: `top`, // positions  of `top`, `middle`, `bottom`
  },
  props: {
    // properties added to component <Home {...props} />
  }
},

src/styles

Contains global style files with css variables including theme variables (custom-properties.css), browser styling reset (reset.css), and site typographytypography.css.

src/utils/authentication.js

Script for instantiating keycloak with functions such as init() to being authentication process and logout() to log user back to authentication process. The Instance of Auth is on the window object accessed as window.auth.

index.js

Root of the application which handles authentication, wraps application in theme and imports global css and renders router.