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
runWhen([{ | |
changedFiles: () => Promise.resolve(['app/index.js', 'app/components/header.jsx']), | |
glob: ['app/components/**'], | |
task(paths) {} | |
}]) |
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
const subprocess = exec(command, { | |
env: {...process.env, FORCE_COLOR: true} | |
}); |
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
const subprocess = exec(command); | |
subprocess.stdout.pipe(process.stdout); | |
subprocess.stderr.pipe(process.stdout); | |
subprocess.on('exit', code => process.exit(code)); |
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
// Inline await to get the the user changed files | |
const filesToMatch = changedFiles ? await changedFiles() : files; | |
// Example of a test | |
test('should run command if glob files matches', async () => { | |
await modifyFixtures(); | |
const {stdout} = await run(`'["__fixtures__/**"]' 'echo fixtures changed'`); | |
expect(stdout.trim()).toEqual('fixtures changed'); | |
await restoreFixtures(); |
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
install: | |
- git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG | |
- cd $TRAVIS_REPO_SLUG | |
- git checkout -qf $TRAVIS_COMMIT |
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
const {2: serializedGlob = "['**']", 3: command} = process.argv; | |
console.log(serializedGlob, command) |
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
const {promisify} = require('util'); | |
const exec = promisify(require('child_process').exec); | |
exec('git diff --name-only origin/master').then(({stdout}) => console.log(stdout)) |
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
import runWhen from 'run-when'; | |
runWhen([ | |
{ | |
glob: ['app/components/index.js', 'app/__tests__/**'], | |
task(paths) { | |
console.log('This will be called!'); | |
} | |
}, | |
{ |
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
class ImgDimensions extends React.Component { | |
state = {width: 0, height: 0, errored: false}; | |
constructor() { | |
this.onLoad = this.onLoad.bind(this); | |
this.onError = this.onError.bind(this); | |
} | |
onLoad({target: {height, width}}) { | |
this.setState({width, height}); |
NewerOlder