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

git-directory-deploy

v1.5.1

Published

Deploy a git directory to a branch.

Downloads

7,907

Readme

git-directory-deploy

Build Status NPM

Deploy a subdirectory from a git repo to a different branch. Useful to deploy to GitHub Pages.

Why

The shell script portion of this code is from X1011/git-directory-deploy, and it's best explained in that README:

Unlike the git-subtree approach, it does not require the generated files be committed to the source branch. It keeps a linear history on the deploy branch and does not make superfluous commits or deploys when the generated files do not change.

This repo accomplishes a few other things:

  • Named cli args
  • Publish it to npm so I can use it as a devDep in projects

Example

I normally use it like this:

cd project/ # Assumes a git directory with a package.json
echo _build >> .gitignore
npm install git-directory-deploy --save-dev
touch build.js # For however you want to build your static files

Then add these scripts to package.json:

"scripts": {
  "build": "node build.js", // should write files to _build/
  "deploy": "npm run build && git-directory-deploy --directory _build/"
}

Then: npm run deploy!

Check out npm-v0-finder for an example.

Install

For global use:

npm install -g git-directory-deploy

cd projects/i-want-to-deploy/

git-directory-deploy --directory _dist --branch gh-pages

Or for use in via npm run-script:

npm install git-directory-deploy --save-dev

and then use it in your package.json likes this:

"scripts": {
    "deploy": "git-directory-deploy --directory _dist --branch gh-pages"
}

Usage

git-directory-deploy [args]

--directory [_site]

The subdirectory to deploy. Defaults to _site/.

--branch [gh-pages]

The branch that will receive the deploy. Defaults to gh-pages.

--repo [origin]

The repo to push the deploy to. Defaults to origin.

--username [git config user.name]

The username that will be associated with the deploy commit. This will always be set to the current user.name from git config, but if that is not set, then it can be set via this flag.

--email [git config user.email]

The email that will be associated with the deploy commit. This will always be set to the current user.email from git config, but if that is not set, then it can be set via this flag.

--message

Append something to the commit message. The message will look like this:

publish: $COMMIT_MESSAGE $MESSAGE

generated from commit $COMMIT_HASH

--verbose

Be louder.

--allow_empty

Allow the --directory to be empty.

--ignore_removal

Deploy will not override files that are in the remote repo but not in the deploy directory.

LICENSE

MIT

The script at bin/git-directory-deploy.sh is Copyright Daniel Smith. See the file for terms.