gruntjs / grunt-contrib-symlink Goto Github PK
View Code? Open in Web Editor NEWCreate symbolic links.
License: MIT License
Create symbolic links.
License: MIT License
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).
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.
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!
I have tried to create a symlink to copy the files from node_modules to vendor folder but getting an operation not permitted error . Please note i have ran as admin as well
symlink: {
options: {
overwrite: false,
force: false
},
explicit: {
src: 'node_modules',
dest: 'vendor'
}
}
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?
Is it possible to release a 1.0.1
because Windows junction support disappeared in 1.0.0
?
The current master again contains junction support.
Thanks.
Hi,
Could you please publish v0.3.0 to npm?
Thank you!
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.
This option was added in 2014, but has still not made it into a release on npm. I'm running into an issue with my build where I would like to use this flag to work around it.
Thanks!
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.
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
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.
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.