UNPKG

533 BJavaScriptView Raw
1var $, fse;
2
3$ = {};
4
5$.normalizePath = require('../dist/normalizePath');
6
7$.info = require('../dist/info');
8
9$.wrapList = require('../dist/wrapList');
10
11fse = require('fs-extra');
12
13module.exports = async function(source, target) {
14 if (!(source && target)) {
15 throw new Error('link_/error: invalid argument length');
16 }
17 source = $.normalizePath(source);
18 target = $.normalizePath(target);
19 await fse.ensureSymlink(source, target);
20 $.info('link', `linked ${$.wrapList(source)} to ${$.wrapList(target)}`);
21 return this;
22};