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-sym

v1.0.2

Published

Gulp symlink

Downloads

1,965

Readme

gulp-sym

Build Status Build status Dependency Status NPM version Code Climate Coverage

Gulp symlink module

Deprecation warning

In favor of https://github.com/ben-eb/gulp-symlink See https://github.com/ben-eb/gulp-symlink/issues/15

Installation

npm install gulp-sym --save-dev {--production}

Usage

Simple example

var symlink = require('gulp-sym')

gulp
	.src('source')
	.pipe(symlink('path/to/link'))
	//note that it'll return source streams not the symlink ones

Advanced example

var symlink = require('gulp-sym')
  , p = require('path')
  , File = require('gulp-util').File

gulp
	.src(['path/**/to/some/dir/', '!path/example/to/some/dir'])
	//source is a vinyl instance
	.pipe(symlink(function(source) {

		//for example link source is my/dest/path/dirname where dirname matches the glob pattern
		return p.join('my/dest/path', source.relative.split(p.sep)[0])

		//you might also return a vinyl instance if you wanted a different cwd
		return new File({cwd: '/home', path: './symlink'})

	}, { force: true })) //use force option to replace existant

Options

  • force (bool): force overwrite symlink
  • relative (bool): your link will be relative

/!\ Don't do this ...

If you're working on more than 1 source, use a function or an array to specify the destination path so gulp-sym doesn't override the previous symlink!

Here is a counterexample, dest will be a link to source/path/two and the first one will not have any symlink!

gulp
	.src(['source/path/one', 'source/path/two'])
	.pipe(symlink('dest', {force: true})) //bad shit WILL happen
	

... but this

That's how it should be:

gulp
	.src(['source/path/one', 'source/path/two'])
	.pipe(symlink(['dest/one', 'dest/two']))
	

or through a function that'll be called on each source

gulp
	.src(['source/path/one', 'source/path/two'])
	.pipe(symlink(function(source) {
		return p.resolve(source.path, '../../dest', p.basename(source.path))
	})

It's intendend behavior and api will not change for this, I could warn the user in this case - to be discussed.

Why?

I'm aware that there is another symlink module for gulp but as of v0.1.0 it didn't fit my needs and seems to get messy (absolute/relative). In this plugin, paths are always absolute and resolves from the cwd that you might change by passing a vinyl instance to the destination function.

gulp-symlink :

  • has no force option to replace existing link
  • uses fs.symlink twice instead of using fs.exists. I'm aware of the nodejs docs specifying that fs.exists is there on an historical purpose only but why shouldn't we use it?
  • doesn't use the specified type option mentioned in the nodejs docs (windows only)
  • has no test on symlinking directories (maybe why tests are good to go on windows)
  • has bad support on multiple sources (at the moment)

Licence

MIT