Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
heikomat committed Sep 6, 2017
2 parents 086ba77 + bf7a11a commit fb900b0
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 13 deletions.
53 changes: 51 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
# 2.0.0
### Bugfixes
- Fix linking of localy available packages, when they are also a sub-dependency (see below)

### Breaking changes
This breaking change applies **only** to the following scenario:
- linking is not disabled
- at some point somewhere you have a dependency on package xyz
- xyz has a (sub-)dependency on a package, that is actually localy avaliable (regardless of the version)

**before:**

That sub-dependency gets installed from the registry to the main node_modules
```
my-modular-app
├── modules
│ ├── database (@2.0.0)
│ └── tasks (@2.0.0) [requires xyz, which in return requires database@^1.0.0]
├── node_modules
│ ├── minstall
│ ├── database (@1.0.0 from registry)
│ └── tasks -> ../modules/tasks
├── index.js
└── package.json [requires minstall, database@2.0.0 and tasks@2.0.0]
```

**now (if linking is enabled):**

The localy avaliable package will be linked in the main node_modules
```
my-modular-app
├── modules
│ ├── database (@2.0.0)
│ └── tasks (@2.0.0) [requires xyz, which in return requires database@1.0.0]
├── node_modules
│ ├── minstall
│ ├── database ../modules/database
│ └── tasks -> ../modules/tasks
├── index.js
└── package.json [requires minstall, database@2.0.0 and tasks@2.0.0]
```

notice how before, database@1.0.0 was installed, but the local package not linked, and now
the local package is linked, but database@1.0.0 not installed.

The reasoning is, that when linking packages, you usually do that for development purposes,
but without that change, some localy avaliable packages might not get linked


# 1.6.1
### Improvements
- Better install-as-dependency detection
Expand All @@ -11,9 +60,9 @@

# 1.5.0
### New Features
- Support for local modules as dependencies in other local modules.
- Support for local modules as dependencies in other local modules.
aka. if your local module A requires your local module B, B wont be downloaded, but linked, if the local version of B matches A's dependency
- Minstall now allows `.` as module-folder
- Minstall now allows `.` as module-folder
for when you just want to install and link a bunch of modules, that don't have a parent-project (this is experimental, please open an issue if this feature leads to problems)

### Bugfixes
Expand Down
26 changes: 16 additions & 10 deletions lib/minstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function logVersionConflict(messages, moduleFolderName) {
| UNCRITICAL DEPENDENCY-CONFLICTS FOUND:
| ${messages.join('\n| ')}
|
|
| This is not an error, but consider using compatible package-versions
| throughout the whole project.`);
}
Expand Down Expand Up @@ -134,15 +134,21 @@ function checkStartConditions() {
}

function linkModulesToRoot(moduleInfos) {
logger.debug('linking local modules to root-node_modules');
logger.debug('deleting installed versions of local modules');
return Promise.all(moduleInfos.map((moduleInfo) => {
return systools.delete(path.join(cwd, 'node_modules', moduleInfo.folderName));
}))
.then(() => {
logger.debug('linking local modules to root-node_modules');
return Promise.all(moduleInfos.map((moduleInfo) => {

// local modules should be linked using the folder-names they should have,
// no matter what folder-name they actually have, therefore don't use .realFolderName here
const targetPath = path.join(cwd, 'node_modules', moduleInfo.folderName);
const modulePath = path.join(cwd, moduletools.modulesFolder, moduleInfo.realFolderName);
return systools.link(modulePath, targetPath);
}));
// local modules should be linked using the folder-names they should have,
// no matter what folder-name they actually have, therefore don't use .realFolderName here
const targetPath = path.join(cwd, 'node_modules', moduleInfo.folderName);
const modulePath = path.join(cwd, moduletools.modulesFolder, moduleInfo.realFolderName);
return systools.link(modulePath, targetPath);
}));
});
}

function linkRootToModule(moduleFolder) {
Expand Down Expand Up @@ -271,7 +277,7 @@ function persistExistingConfilctingDependencies(packetsToKeep, moduleFolderName)
function installModules(installedModules, moduleInfos, index) {

if (logVerbose()) {
process.stdout.write(`\n`);
process.stdout.write('\n');
}

const moduleIndex = index || 0;
Expand All @@ -294,7 +300,7 @@ function installModules(installedModules, moduleInfos, index) {
process.stdout.write(`installing module ${moduleNumber}/${moduleInfos.length} -> ${moduleInfo.realFolderName} `);

if (logVerbose()) {
process.stdout.write(`\n`);
process.stdout.write('\n');
}

}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minstall",
"version": "1.6.1",
"version": "2.0.0",
"description": "local module installer",
"main": "lib/minstall.js",
"bin": "lib/minstall.js",
Expand Down

0 comments on commit fb900b0

Please sign in to comment.