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

@larasense/ssg-auth-vue

v0.0.9

Published

[static-site-generation](https://github.com/larasense/static-site-generation) is a Laravel Package for generate static sites using a command or a middleware on visit.

Downloads

1

Readme

Authentication for larasense/static-site-generation application using Vue3 and Pinia

static-site-generation is a Laravel Package for generate static sites using a command or a middleware on visit.

It is meant to be used on a Breeze or Jetstream with the InertiaJs stack, and provide a simple and quick way to generate and consume static content.

But it come with a cabeat. the site generated with no credentials and for that reason authentication need to be handeled difffernly on the Front side.

Instalation

npm i @larasense/ssg-auth-vue

Configuration

TBD

How to use

Backend

on app/Http/Middleware/HandleInertiaRequests.php or wherever the share props is set, call the getUserInfo() from the StaticSite Facade to replace the auth prop.

// app/Http/Middleware/HandleInertiaRequests.php
    /**
     * Define the props that are shared by default.
     *
     * @return array<string, mixed>
     */
    public function share(Request $request): array
    {
        return array_merge(parent::share($request), [
            // ....
            'auth' => StaticSite::getUserInfo(),
        ]);
    }

Frontend

On every page or component that need to access the user

<script setup>
import { useAuth } from "@larasense/ssg-auth-vue";
const props = defineProps({
  // ...
  auth: Object,
});
const auth = useAuth();
auth.setPropUser(props.auth.user);
</script>

and then replace $page.props.auth.user for auth.user

<Link v-if="auth.user" :href="route('dashboard')"
    class="">
Dashboard</Link>

<template v-else>
    <Link :href="route('login')"
        class="">
    Log in</Link>
    <Link v-if="canRegister" :href="route('register')"
        class="">
    Register</Link>
</template>