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

@gasket/plugin-git

v7.0.6

Published

Adds git support to your application

Downloads

769

Readme

@gasket/plugin-git

This a built-in plugin to the Gasket CLI used to set up new apps with git repositories when using the gasket create command.

Usage

The features of this plugin hooks are in the lifecycles it hooks during the create process.

prompt

The prompt will ask users during the create command if they wish to initialize a git repo or not. This prompt will set the gitInit property of the create context. It is possible to default this in a preset, by setting this in the preset's package.json, under a gasket.create property.

In the following example, when a new app is created with this preset, a git repo will always be initialized, and the user not prompted.

{
  "name": "gasket-preset-example",
  "version": "1.2.3",
  "main": "index.js",
  "dependencies": {
    "@gasket/resolve": "^2.0.0",
    "gasket-plugin-example": "^1.0.0"
  },
  "gasket": {
    "create" : {
      "gitInit": true
    }
  }
}

create

During the create lifecycle, .gitignore and .gitattributes templates will be registered to be generated for the app.

If you have a plugin which needs to add git ignore rules, in the create lifecycle hook of your plugin, you can access gitignore helper to add rules. Rules can be added to different categories which will group them under comments.

The gitignore helper will only be placed on the CreateContext when this plugin is configured and gitInit is true, either by preset config or prompt.

Example adding gitignore

export default {
  name: 'gasket-plugin-example',
  hooks: {
    create(gasket, createContext) {
      const { gitignore } = createContext;

      // See if `gitignore` is on the create context
      if(gitignore) {
        // ignore a single file
        gitignore.add('file-to-be-ignored.js');

        // ignore wildcard rules
        gitignore.add('*.tmp');

        // ignore multiple files and/or directories
        gitignore.add(['file1.js', 'dir2/']);

        // add an ignore under a category
        gitignore.add('node_modules', 'dependencies');
      }
    }
  }
};

The resulting .gitignore that is generated will have all the added gitignore rules and comments for categories.

# -- .gitignore file --

file-to-be-ignored.js
*.tmp
file1.js
dir2/

# dependencies
node_modules

postCreate

After all the app contents are generated, this plugin's postCreate hook will make a first commit for the generated files. The timing for this hook is set to run last. It is important when creating plugins that implement postCreate hooks, that their timings do come after the Git plugin, especially if modifying files, otherwise those modifications will not be part of the first commit.

See plugin hook timings for more information.

License

MIT