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

sitback

v0.4.28

Published

A git diff based approach to package and deploy server apps of any kind.

Downloads

97

Readme

sitback

npm Version

A git diff based approach to package and deploy server apps of any kind.

The whole reason I created this, was that I has to do a lot of manual work around deployment,
And that that manual work involved something that was not automated by any standard deployment/publishing system: Git diffs.
If only one certain file changed, I only want to push that - to reduce deployment time and reduce server downtime.
If some other files changed, I want to invoke a build system, and deploy the result.

What this does, is allow you to create a simple JSON script that defines the rules of when to package what and how, and then on the server side you can run the unpackage step with a single command.

This can be integrated in whole pipelines.
One example of such a pipeline would be:

  1. Trigger a packaging step after a merge request or a tag
  2. Push the package to a special git repo
  3. A script on the server that periodically pulls if there is anything to pull
  4. If there's a new package then unpack it with a single command
  5. Restart pm2/IIS/etc.

Now I can sitback and relax.

Documentation

Any help appreciated there.
I'm trying to write more tests and to document more of the features available.
In the meantime you can read the sources and the tests that exist.

Installation:

npm install --save sitback

Usage example

Packing / unpacking:

sitback --pack=deploy.json --base=C:\\Users\\User\\Projects\\git\\my_app" --out=C:\\Users\\User\\Projects\\out --git-from=prod_latest --git-to=prod_next

.
.
.

sitback --unpack=/var/incoming/my_app.json --out=/var/app
sitback --unpack=/var/incoming/another_app.json --out=/var/another_app

deploy.json:

[
    {
        "name": "my_app",

        "variables": {
            "trigger_js_build": {
                "git_diff": { "pattern": "js/**/*" }
            },
            "trigger_net_build": {
                "git_diff": { "pattern": "core/**/*.cs" }
            }
        },
        
        "actions": [
            {
                "condition": "trigger_js_build",
                "type": "cmd",
                "description": "Building JS code...",
                "options": {
                    "path": "npm run build",
                    "args": ["--dist"]
                }
            },
            {
                "condition": "trigger_net_build",
                "type": "msbuild",
                "description": "Building .NET code...",
                "options": {
                    "solution": "core/app.sln",
                    "target": "app:Rebuild",
                    "props": {
                        "Configuration": "Release",
                        "Platform": "Any CPU"
                    }
                }
            }
        ],
        
        "package": [
            {
                "condition": "trigger_js_build",
                "source": "dist",
                "dest": "js",
                "pattern": "app.js",
                "mode": "sync"
            },
            {
                "condition": "trigger_net_build",
                "source": "core/Bin/Release",
                "dest": "bin",
                "pattern": "**/*",
                "mode": "sync"
            },
            {
                "condition": "trigger_net_build",
                "source": "libs",
                "dest": "bin",
                "pattern": "*.dll",
                "mode": "sync"
            },
            {
                "source": "resources",
                "dest": "resources",
                "pattern": "**/*",
                "mode": "git_diff"
            }
        ]
    },
    {
        "name": "another_app",

        "variables": {
            "trigger_js_build": {
                "git_diff": { "pattern": "js/**/*" }
            }
        },
        
        "actions": [
            {
                "condition": "trigger_js_build",
                "type": "cmd",
                "description": "Building JS code...",
                "options": {
                    "path": "npm run build",
                    "args": ["--dist"]
                }
            }
        ],
        
        "package": [
            {
                "condition": "trigger_js_build",
                "source": "dist",
                "dest": "js",
                "pattern": "app.js",
                "mode": "sync"
            },
            {
                "source": "resources",
                "dest": "resources",
                "pattern": "**/*",
                "mode": "git_diff"
            },
            {
                "source": "web.confg",
                "dest": "web.confg",
                "sourceXmlPath": "$.configuration.runtime",
                "destXmlPath": "$.configuration.runtime",
                "mode": "xml_replace"
            }
        ]
    }
]

Contributing

If you have anything to contribute, or functionality that you lack - you are more than welcome to participate in this! If anyone wishes to contribute unit tests - that also would be great :-)

Me

Help

If you want to buy me a beer, you are very welcome to Donate Thanks :-)

License

All the code here is under MIT license. Which means you could do virtually anything with the code. I will appreciate it very much if you keep an attribution where appropriate.

The MIT License (MIT)

Copyright (c) 2013 Daniel Cohen Gindi ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.