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

gulp-reinstall

v0.3.2

Published

A Gulp plugin to install npm, bower, tsd, and pip packages, based on the configuration files found in the gulp file stream

Downloads

16

Readme

gulp-reinstall

gulp-reinstall is a gulp plugin to automatically install npm, bower, tsd, typings, composer and pip packages/dependencies.

NPM

CI build devDependency Status License: MIT

Overview

gulp-reinstall runs package install commands based on the files found in a vinyl stream. The filename determines the command that is run.

The default settings are:

| File Found | Command run | | ------------------ | --------------------------------- | | package.json | npm install | | bower.json | bower install | | tsd.json | tsd reinstall --save | | typings.json | typings install | | composer.json | composer install | | requirements.txt | pip install -r requirements.txt |

It will run the command in the directory it finds the file, so if you have configs nested in a lower directory than your gulpfile.js, this will still work.

NOTE gulp-reinstall requires at least NodeJS 8.3.

Usage

var reinstall = require('gulp-reinstall');

gulp.src(['./bower.json', './package.json']).pipe(reinstall());

Options

options.commands

Type: Object

Default: null

Use this option to add or override the command to be run for a particular filename.

var reinstall = require('gulp-reinstall');

gulp
  .src(__dirname + '/templates/**')
  .pipe(gulp.dest('./'))
  .pipe(
    reinstall({
      commands: {
        'package.json': 'yarn',
      },
      yarn: ['install', '--ignore-scripts', '--force'],
    })
  ); // yarn install --ignore-scripts --force

options.production

Type: Boolean

Default: false

Set to true if invocations of npm install and bower install should be appended with the --production parameter.

Example:

var reinstall = require('gulp-reinstall');

gulp
  .src(__dirname + '/templates/**')
  .pipe(gulp.dest('./'))
  // npm install --production
  .pipe(reinstall({ production: true }));

options.ignoreScripts

Type: Boolean

Default: false

Set to true if invocations of npm install should be appended with the --ignore-scripts parameter. Useful for skipping postinstall scripts with npm.

Example:

var reinstall = require('gulp-reinstall');

gulp
  .src(__dirname + '/templates/**')
  .pipe(gulp.dest('./'))
  // npm install --ignore-scripts
  .pipe(reinstall({ ignoreScripts: true }));

options.noOptional

Type: Boolean

Default: false

Set to true if invocations of npm install should be appended with the --no-optional parameter, which will prevent optional dependencies from being installed.

Example:

var reinstall = require('gulp-reinstall');

gulp
  .src(__dirname + '/templates/**')
  .pipe(gulp.dest('./'))
  // npm install --no-optional
  .pipe(reinstall({ noOptional: true }));

options.allowRoot

Type: Boolean

Default: false

Set to true if invocations of bower install should be appended with the --allow-root parameter.

Example:

var reinstall = require('gulp-reinstall');

gulp
  .src(__dirname + '/templates/**')
  .pipe(gulp.dest('./'))
  // bower install --allow-root
  .pipe(reinstall({ allowRoot: true }));

options.args

Type: Array | String

Default: undefined

Specify additional arguments that will be passed to all install command(s).

Example:

var reinstall = require('gulp-reinstall');

gulp
  .src(__dirname + '/templates/**')
  .pipe(gulp.dest('./'))
  .pipe(
    reinstall(
      {
        args: ['dev', '--no-shrinkwrap'],
      } // npm install --dev --no-shrinkwrap
    )
  );

options.<command-name>

Type: Array | String | Object

Default: null

Use this to specify additional arguments for a particular command.

Example:

var reinstall = require('gulp-reinstall');

gulp
  .src(__dirname + '/templates/**')
  .pipe(gulp.dest('./'))
  .pipe(
    reinstall({
      // Either a single argument as a string
      npm: '--production',
      // Or arguments as an object (transformed using Dargs: https://www.npmjs.com/package/dargs)
      bower: { allowRoot: true },
      // Or arguments as an array
      pip: ['--target', '.'],
    })
  );

Credits

This plugin is inspired by gulp-install, and significant parts of the source code owe a debt to that plugin, although the main plugin logic is largely rewritten.

The gulp-install plugin appears to be no longer maintained, and is dependent on the now-deprecated gulp-util package. gulp-reinstall removes that dependency, and also reduces the number of package dependencies to avoid npm audit problems in future.

Contributing

Contributions are very welcome! The rest of this section describes how to set yourself up for developing gulp-reinstall.

Getting started

Just clone the repo locally and start hacking. Run npm test to see if stuff broke.

Changelog

This project follows the Keep a Changelog conventions.

Commit mesages

Please use the Angular commit guidelines when writing commit messages.

Release process

(These are mainly notes for the maintainer, if you are contributing you won't need to worry about this)

The release process is driven by release-it. First you create a draft GitHub release locally by using release-it, then you publish the release through the GitHub web UI.

To create a draft release:

  1. On your local computer, checkout the main branch.
  2. Update the changelog.
  3. Run npm run release with the options you want, then follow the prompts. The two most useful options are --dry-run and --preRelease=alpha (or whatever the pre-release version is). Note that you need to add -- before any release-it arguments.

Example:

npm run release -- --dry-run --preRelease=alpha

The release-it settings are configured to create a draft release on GitHub. Once the release is published within GitHub, an automated workflow publishes the package to the npm repository.

Note: in order to run the release process, you need to set up the RELEASEMGMT_GITHUB_API_TOKEN environment variable on your local computer. This should contain a GitHub PAT with the appropriate permissions - see the release-it documentation for more details.

License

Licensed under the MIT License.