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

generativ

v1.0.5

Published

Generativ generates code in your project using reusable and sharable scripts. Setup, upgrade & automate any code in a matter of seconds.

Downloads

3

Readme

Generativ

Generativ is a lightweight global library that generates code with resusable and sharable scripts. Setup, upgrade or automate any code in a matter of seconds!

1. Install the package globally

npm install -g generativ

2. Create a script and host it on the cloud

Example script ⬇️

This script is hosted here : Click here

{
    "name": "insertRocket",
    "uid": "TETEFEFkfekfkelfkelfelkdkckvekfeueregek",
    "description": "This script inserts three simple comments into two files",
    "instructions": [
        {
            "mode": "file",
            "file": "comment.tsx",
            "actions": [
                {
                    "type": "add_before",
                    "reference": "const reactions: any = {",
                    "code": "\n//Rocket setup\n",
                    "isUnique": true
                },
                {
                    "type": "add_after",
                    "reference": "const reactions: any = {",
                    "code": "\n//Rocket setup %text\n",
                    "variables": [
                        {
                            "name": "text",
                            "defaultValue": "Texte à insérer"
                        }
                    ],
                    "isUnique": true
                }
            ]
        },
        {
            "mode": "file",
            "file": "floating-input/floating-input.tsx",
            "actions": [
                {
                    "type": "add_before",
                    "reference": "export function FloatingInput(props) {",
                    "code": "\n//Rocket setup\n",
                    "isUnique": true
                }
            ]
        }
    ]
}

This script has 2 instructions :

  • First instruction has 2 actions : 1) it adds the comment \n//Rocket setup\n before the code const reactions: any = { into the filepath comment.tsx (be sure to be enough precise to target only one file. In that case, the name and extension was enough). And 2) it adds the comment \n//Rocket setup\n after the code const reactions: any = { with a variable text provided by the args --params text=myvariabletoinsert
  • Second instruction adds the comment \n//Rocket setup\n before the the code export function FloatingInput(props) { into the filepath floating-input/floating-input.tsx

3. Go to the root target of your project directory and execute the command line

For example, for our myreactnativeproject, we need to be into the root of this directory. So in myreactnativeproject.

Then we just execute this command line, providing the script source and the variables to modify :

generativ --url myJsonUrl --params variable1="test"

If we have multiple variables to modify, we can separate them with + :

generativ --url myJsonUrl --params variable1="test"+variable2="test2"+variable3="test3"

With the example above :

generativ --url https://storage.googleapis.com/rocketsetup-2ded0.appspot.com/example-script.json --params text="Un test simple"