-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gulp: lint, flow, and version-check (#7174)
* Add plugin loading for gulp * Convert `lint` task to gulp * Convert `flow` task to gulp * Convert `version-check` task to gulp * Add missing semicolons
- Loading branch information
1 parent
2b226f5
commit 69703e0
Showing
9 changed files
with
182 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var path = require('path'); | ||
var spawn = require('child_process').spawn; | ||
|
||
var extension = process.platform === 'win32' ? '.cmd' : ''; | ||
|
||
module.exports = function(gulp, plugins) { | ||
var gutil = plugins.util; | ||
|
||
return function(done) { | ||
spawn( | ||
process.execPath, | ||
[ | ||
path.join('node_modules', '.bin', 'eslint' + extension), | ||
'.', | ||
], | ||
{ | ||
// Allow colors to pass through | ||
stdio: 'inherit', | ||
} | ||
).on('close', function(code) { | ||
if (code !== 0) { | ||
gutil.log( | ||
gutil.colors.red( | ||
'Lint failed' | ||
) | ||
); | ||
process.exit(code); | ||
} | ||
|
||
gutil.log( | ||
gutil.colors.green( | ||
'Lint passed' | ||
) | ||
); | ||
done(); | ||
}); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var path = require('path'); | ||
var spawn = require('child_process').spawn; | ||
|
||
var extension = process.platform === 'win32' ? '.cmd' : ''; | ||
|
||
module.exports = function(gulp, plugins) { | ||
var gutil = plugins.util; | ||
|
||
return function(done) { | ||
spawn( | ||
process.execPath, | ||
[ | ||
path.join('node_modules', '.bin', 'flow' + extension), | ||
'check', | ||
'.', | ||
], | ||
{ | ||
// Allow colors to pass through | ||
stdio: 'inherit', | ||
} | ||
).on('close', function(code) { | ||
if (code !== 0) { | ||
gutil.log( | ||
gutil.colors.red( | ||
'Flow failed' | ||
) | ||
); | ||
process.exit(code); | ||
} | ||
|
||
gutil.log( | ||
gutil.colors.green( | ||
'Flow passed' | ||
) | ||
); | ||
done(); | ||
}); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
module.exports = function(gulp, plugins) { | ||
var gutil = plugins.util; | ||
|
||
return function(done) { | ||
var reactVersion = require('../../package.json').version; | ||
|
||
var addonsData = require('../../packages/react-addons/package.json'); | ||
var versions = { | ||
'packages/react/package.json': | ||
require('../../packages/react/package.json').version, | ||
'packages/react-dom/package.json': | ||
require('../../packages/react-dom/package.json').version, | ||
'packages/react-native-renderer/package.json': | ||
require('../../packages/react-native-renderer/package.json').version, | ||
'packages/react-addons/package.json (version)': addonsData.version, | ||
'packages/react-addons/package.json (react dependency)': | ||
// Get the "version" without the range bit | ||
addonsData.peerDependencies.react.slice(1), | ||
'src/ReactVersion.js': require('../../src/ReactVersion'), | ||
}; | ||
|
||
var allVersionsMatch = true; | ||
Object.keys(versions).forEach(function(name) { | ||
var version = versions[name]; | ||
if (version !== reactVersion) { | ||
allVersionsMatch = false; | ||
gutil.log( | ||
gutil.colors.red( | ||
'%s version does not match package.json. Expected %s, saw %s.' | ||
), | ||
name, | ||
reactVersion, | ||
version | ||
); | ||
} | ||
}); | ||
|
||
if (!allVersionsMatch) { | ||
process.exit(1); | ||
} | ||
|
||
done(); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters