Giter Site home page Giter Site logo

grunt-contrib-symlink's Issues

Feature request for hardlinks.

Could there be an option to add hard links?

It would solve some issues with symlinks, especially in Windows.

There's also an issue of "deleting files outside the CWD", when the source of the symlinks are not within the build dir.

grunt-contrib-hardlink: contributing new plugin to grunt-contrib

I just published grunt-contrib-hardlink (initially forked from grunt-contrib-symlink) which solves the problem of a recursive hard-linking grunt task. As demonstrated by the issues and pull requests below it's a feature people would find useful.

I've opened this issue here because I couldn't open one at grunt-contrib, despite the instructions asking for that at the grunt web page contributing section.

overwriting of symlinks to files outside the grunt directory fails

With overwrite: true set, if a symlink resolves to a file outside of the gruntfile's directory, then when it attempts to overwrite an old symlink it fails with: Warning: Cannot delete files outside the current working directory. Use --force to continue.

I think it should just unlink/change the old symlink.

Creating a symlink on Windows fails for regular users

Creating a symbolic link (hardlink) on Windows is a privileged operation. The operation fails with ERROR_ACCESS_DENIED if the SE_CREATE_SYMBOLIC_LINK_NAME has not bee granted, which only administrators have by default. Any user can create a directory junction (soft link) providing the file system permissions allow it.

While it can requested, that the user running Grunt has been granted the necessary privilege, it would be an additional step for the build environment and an exception from company policies would be needed. This can be saved, because junctions are mostly exactly what is needed on Windows.

The NodeJS symlink creation method offers the 'junction' type to solve the problem. The pull request #11 enables junction creation for this task without breaking current scenarios. It could be modified to use the special directory link mode only on Windows platform, if you found it better.

You may consider adding the force option too, to let the Grunt ignore errors, which are not critical for the build (pull request #14).

Non existing source shows invalid file

Try config

symlink: {
    options: {
        overwrite: true
    },
    test: {
        files: [
            {
                src: 'nonexistingfolder',
                dest: 'new'
            }
        ]
    },
}

It will return:

grunt symlink:test
Running "symlink:test" (symlink) task
Warning: Arguments to path.join must be strings Use --force to continue.

Aborted due to warnings.

Instead of File not exist

Symlink creation not working in Windows (at least 8) using NTFS

I tested grunt-contrib-symlink in Windows 8 on NTFS, and it's not creating the symlink whereas that same code works in Ubuntu Linux.

I'm getting this:

Running tasks: symlink

Running "symlink" task

Running "symlink:assets" (symlink) task
Verifying property symlink.assets exists in config...OK
Files: public/assets/test.txt -> blog/test.txt
Linking (file) blog/test.txt -> ..\public\assets\test.txt...ERROR
>> Created 1 symbolic links.

Whereas the same code in Linux nets me

Running tasks: symlink

Running "symlink" task

Running "symlink:assets" (symlink) task
Verifying property symlink.assets exists in config...OK
Files: public/assets/test.txt -> blog/test.txt
Linking (file) blog/test.txt -> ../public/assets/test.txt...OK
>> Created 1 symbolic links.

Done, without errors.
$ ls -lah blog/
total 8.0K
drwxr-sr-x 2 root www-dev 4.0K 2013-08-23 10:35 .
drwxr-sr-x 8 root www-dev 4.0K 2013-08-23 10:35 ..
lrwxrwxrwx 1 root www-dev   25 2013-08-23 10:35 test.txt -> ../public/assets/test.txt

EPERM, operation not permitted at win8.1

      test: {
        src: 'package.json',
        dest: 'dist/package.json'
      },
D:\Workspace\Code\9game\ninegameclient\android-h5 (master)                                                
λ grunt symlink:test                                                                                      
Running "symlink:test" (symlink) task                                                                     
>> Error: EPERM, operation not permitted '..\package.json'                                                
Warning: Failed to create symlink: (file) dist/package.json -> ..\package.json. Use --force to continue.  

Can you update the README for idiots like me?

Hi there,

I thought that explicit was a keyword and I didn't know hot to create a second symlink. Maybe it will be nice to replace this explicit by theNameYouWant or something like this (for people who are new to grunt structure).

Best,

Thanks for the lib btw!

"overwrite" option deletes previous files instead of unlinking

When using the options.overwrite = true option I'm seeing a very undesirable behavior.

Instead of unlinking the old link before overwriting it, it actually deletes the files for the old link. This is not the expected behavior.

Can you please change the command to perform an "unlink" command instead of an "rm" command?

Arguments to path.join must be strings

grunt symlink -v

Running "symlink:bower" (symlink) task
Verifying property symlink.bower exists in config...OK
Files: [no src] -> app/static/bower_components
Warning: Arguments to path.join must be strings Use --force to continue.

My config

symlink: {
    options: {
        overwrite: false
    },
    // dest -> src
    bower: {
        src: '.tmp/static/bower_components',
        dest: 'app/static/bower_components'
    }
},

I have no idea what is wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.