Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from FormidableLabs/jp-npm5-support
Browse files Browse the repository at this point in the history
add NPM 5 support
  • Loading branch information
jevakallio authored Oct 19, 2017
2 parents 70cd72e + 76504ef commit a0c7de3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/util/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,9 @@ function isOwnDependency(packageName) {
}
}

function isNotSymlinked(packageName) {
function isSymlinked(packageName) {
const packagePath = path.resolve(process.cwd(), 'node_modules', packageName);
if (isSymlink.sync(packagePath)) {
exitWith(
`Package ${packageName} appears to be symlinked. ` +
'Overwriting symlinks is not currently supported. Unlink package and try again.'
);
}
return isSymlink.sync(packagePath)
}

module.exports = {
Expand All @@ -59,5 +54,5 @@ module.exports = {
whackageJsonDoesntExist,
isValidModule,
isOwnDependency,
isNotSymlinked
isSymlinked
};
6 changes: 5 additions & 1 deletion src/util/start-server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');
const fs = require('fs-extra');
const chokidar = require('chokidar');
const assert = require('./assert');
const syncAll = require('./sync-all');
Expand Down Expand Up @@ -32,7 +33,10 @@ module.exports = function startServer() {
// initial sync
for (const key in packageLookup) {
if (packageLookup.hasOwnProperty(key)) {
assert.isNotSymlinked(packageLookup[key]);
if (assert.isSymlinked(packageLookup[key])) {
const packagePath = path.resolve(process.cwd(), 'node_modules', packageLookup[key]);
fs.removeSync(packagePath);
}
syncAll(ROOT_PATH, key, packageLookup[key], exclude);
}
}
Expand Down

0 comments on commit a0c7de3

Please sign in to comment.