2015-02-07 updates

- Random little fixes | Andres Suarez
- Add backButtonTitle to Navigator | Nick Poulden
- [react-pacakger] Ignore malformed package.json | Amjad Masad
- Renamed hasMove to hasMark | Rich Seymour
- Update XMLHttpRequest.ios.js | Nick Poulden
- Warn about missing dependencies for issue #16 | Andrew McCloud
This commit is contained in:
Christopher Chedeau 2015-02-07 17:23:25 -08:00
parent 931041f3d2
commit 63e329e388
3 changed files with 47 additions and 3 deletions

View File

@ -3,13 +3,25 @@
*/
'use strict';
var fs = require('fs');
var path = require('path');
if (!fs.existsSync(path.resolve(__dirname, '..', 'node_modules'))) {
console.log(
'\n' +
'Could not find dependencies.\n' +
'Ensure dependencies are installed - ' +
'run \'npm install\' from project root.\n'
);
process.exit();
}
var ReactPackager = require('./react-packager');
var blacklist = require('./blacklist.js');
var connect = require('connect');
var http = require('http');
var launchEditor = require('./launchEditor.js');
var parseCommandLine = require('./parseCommandLine.js');
var path = require('path');
var options = parseCommandLine([{
command: 'port',

View File

@ -122,6 +122,32 @@ describe('DependencyGraph', function() {
});
});
pit('should ignore malformed packages', function() {
var root = '/root';
fs.__setMockFilesystem({
'root': {
'index.js': [
'/**',
' * @providesModule index',
' */',
'require("aPackage")',
].join('\n'),
'aPackage': {
'package.json': 'lol',
'main.js': 'lol'
}
}
});
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
{id: 'index', path: '/root/index.js', dependencies: ['aPackage']},
]);
});
});
pit('can have multiple modules with the same name', function() {
var root = '/root';
fs.__setMockFilesystem({

View File

@ -267,9 +267,15 @@ DependecyGraph.prototype._findAndProcessPackage = function(files, root) {
if (packagePath != null) {
return readFile(packagePath, 'utf8')
.then(function(content) {
var packageJson = JSON.parse(content);
if (packageJson.name == null) {
var packageJson;
try {
packageJson = JSON.parse(content);
} catch (e) {
debug('WARNING: malformed package.json: ', packagePath);
return q();
}
if (packageJson.name == null) {
debug(
'WARNING: package.json `%s` is missing a name field',
packagePath