Skip to content

Commit

Permalink
- make -s false work for symlink ( e.g., local ) folder
Browse files Browse the repository at this point in the history
 - warn but install modules not listed in fedep modules in
   `pacakge.json` ( usually from `-l` option )
  • Loading branch information
zbryikt committed Feb 9, 2022
1 parent ade4060 commit a116fb7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Logs

## v1.1.6

- make `-s false` work for symlink ( e.g., `local` ) folder
- warn but install modules not listed in fedep modules in `pacakge.json` ( usually from `-l` option )


## v1.1.5

- still symlink if srcdir is not a symlink but root is a symlink. usually happens when we specify `dir` in config.
Expand Down
18 changes: 17 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cmds['default'] = {
});
},
handler: function(argv){
var ret, localModules, useSymlink, fed;
var ret, localModules, useSymlink, fed, extModules;
if (argv.l) {
ret = argv.l.split(';').map(function(it){
return it.split(':');
Expand All @@ -46,6 +46,20 @@ cmds['default'] = {
root: '.',
modules: []
}, JSON.parse(fs.readFileSync("package.json").toString()).frontendDependencies || {});
extModules = localModules.filter(function(o){
return !fed.modules.filter(function(it){
return it.name === o.name;
}).length;
});
if (extModules.length) {
console.warn("following modules are not listed in fedep modules. still installed:".yellow);
console.warn(extModules.map(function(it){
return " - " + it.name;
}).join('\n').yellow);
fed.modules = fed.modules.concat(extModules.map(function(it){
return it.name;
}));
}
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;
obj = typeof obj === 'string' ? {
Expand Down Expand Up @@ -168,6 +182,8 @@ cmds['default'] = {
fsExtra.removeSync(maindir);
if (useSymlink) {
return fsExtra.ensureSymlinkSync(desdir, maindir);
} else if (fs.lstatSync(desdir).isSymbolicLink()) {
return fsExtra.copySync(srcdir, maindir);
} else {
return fsExtra.copySync(desdir, maindir);
}
Expand Down
7 changes: 7 additions & 0 deletions lib/main.ls
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ cmds.default =
root: '.', modules: []
} <<< (JSON.parse(fs.read-file-sync "package.json" .toString!).frontendDependencies or {})

ext-modules = local-modules.filter((o) -> !(fed.modules.filter(->it.name == o.name).length))
if ext-modules.length =>
console.warn "following modules are not listed in fedep modules. still installed:".yellow
console.warn ext-modules.map(->" - #{it.name}").join(\\n).yellow
fed.modules ++= ext-modules.map(-> it.name)

(fed.modules or []).map (obj) ->
obj = if typeof(obj) == \string => {name: obj} else obj
local-module = local-modules.filter(-> it.name == obj.name).0
Expand Down Expand Up @@ -115,6 +121,7 @@ cmds.default =
p.then ->
fs-extra.remove-sync maindir
if use-symlink => fs-extra.ensure-symlink-sync desdir, maindir
else if fs.lstat-sync desdir .is-symbolic-link! => fs-extra.copy-sync srcdir, maindir
else fs-extra.copy-sync desdir, maindir


Expand Down

0 comments on commit a116fb7

Please sign in to comment.