Skip to content

Commit

Permalink
- still symlink if srcdir is not a symlink but root is a symlink.
Browse files Browse the repository at this point in the history
   usually happens when we specify `dir` in config.
 - bump version
  • Loading branch information
zbryikt committed Jan 30, 2022
1 parent 26a6928 commit ade4060
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Logs

## v1.1.5

- still symlink if srcdir is not a symlink but root is a symlink. usually happens when we specify `dir` in config.


## v1.1.4

- don`t copy JS / CSS files based on `browser` / `style` field if `main` folder is by link instead of by copying.
Expand Down
10 changes: 7 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cmds['default'] = {
modules: []
}, JSON.parse(fs.readFileSync("package.json").toString()).frontendDependencies || {});
return (fed.modules || []).map(function(obj){
var localModule, root, info, id, mainFile, ref$, i$, name, version, ret, that, desdir, maindir, p, srcdir, realSrcDir, srcFile, desFile;
var localModule, root, info, id, mainFile, ref$, i$, name, version, ret, that, desdir, maindir, p, srcdir, realSrcdir, srcFile, desFile;
obj = typeof obj === 'string' ? {
name: obj
} : obj;
Expand Down Expand Up @@ -129,8 +129,12 @@ cmds['default'] = {
if (fs.lstatSync(srcdir).isSymbolicLink()) {
obj.link = true;
fsExtra.removeSync(desdir);
realSrcDir = path.resolve(path.join(path.dirname(srcdir), fs.readlinkSync(srcdir)));
fsExtra.ensureSymlinkSync(realSrcDir, desdir);
realSrcdir = path.resolve(path.join(path.dirname(srcdir), fs.readlinkSync(srcdir)));
fsExtra.ensureSymlinkSync(realSrcdir, desdir);
} else if (fs.lstatSync(root).isSymbolicLink()) {
obj.link = true;
fsExtra.removeSync(desdir);
fsExtra.ensureSymlinkSync(srcdir, desdir);
} else {
fsExtra.copySync(srcdir, desdir, {
dereference: true,
Expand Down
8 changes: 6 additions & 2 deletions lib/main.ls
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ cmds.default =
if fs.lstat-sync srcdir .is-symbolic-link! =>
obj.link = true
fs-extra.remove-sync desdir
real-src-dir = path.resolve(path.join(path.dirname(srcdir), fs.readlink-sync(srcdir)))
fs-extra.ensure-symlink-sync real-src-dir, desdir
real-srcdir = path.resolve(path.join(path.dirname(srcdir), fs.readlink-sync(srcdir)))
fs-extra.ensure-symlink-sync real-srcdir, desdir
else if fs.lstat-sync root .is-symbolic-link! =>
obj.link = true
fs-extra.remove-sync desdir
fs-extra.ensure-symlink-sync srcdir, desdir
else
fs-extra.copy-sync(
srcdir, desdir,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"cli.js"
],
"description": "Frontend dependency installer",
"version": "1.1.4",
"version": "1.1.5",
"homepage": "https://github.com/plotdb/fedep",
"repository": {
"type": "git",
Expand Down

0 comments on commit ade4060

Please sign in to comment.