|
|
const path = require('path'); |
|
|
const glob = require('glob'); |
|
|
const execSync = require('child_process').execSync; |
|
|
const [version] = process.argv.slice(2); |
|
|
|
|
|
execSync('yarn'); |
|
|
execSync(`yarn upgrade react-instantsearch-dom@${version} -D`); |
|
|
execSync(`yarn upgrade react-instantsearch-dom-maps@${version} -D`); |
|
|
|
|
|
const examplesPath = path.join(__dirname, '..', 'examples'); |
|
|
|
|
|
{ |
|
|
|
|
|
const examples = glob.sync( |
|
|
path.join(examplesPath, '!((react-native|hooks|hooks-server)*)') |
|
|
); |
|
|
|
|
|
examples.forEach((example) => { |
|
|
console.log('updating in', example); |
|
|
execSync( |
|
|
`cd ${example} && yarn upgrade react-instantsearch-dom@${version}`, |
|
|
{ |
|
|
stdio: 'inherit', |
|
|
} |
|
|
); |
|
|
}); |
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
const examples = glob.sync(path.join(examplesPath, '+(react-native*)')); |
|
|
|
|
|
examples.forEach((example) => { |
|
|
console.log('updating in', example); |
|
|
|
|
|
execSync( |
|
|
`cd ${example} && yarn upgrade react-instantsearch-native@${version}`, |
|
|
{ |
|
|
stdio: 'inherit', |
|
|
} |
|
|
); |
|
|
}); |
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
const examples = glob.sync(path.join(examplesPath, 'geo-search')); |
|
|
|
|
|
examples.forEach((example) => { |
|
|
console.log('updating in', example); |
|
|
execSync( |
|
|
`cd ${example} && yarn upgrade react-instantsearch-dom-maps@${version}`, |
|
|
{ |
|
|
stdio: 'inherit', |
|
|
} |
|
|
); |
|
|
}); |
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
const examples = glob.sync(path.join(examplesPath, 'hooks')); |
|
|
|
|
|
examples.forEach((example) => { |
|
|
console.log('updating in', example); |
|
|
execSync( |
|
|
`cd ${example} && yarn upgrade react-instantsearch-hooks@${version}`, |
|
|
{ |
|
|
stdio: 'inherit', |
|
|
} |
|
|
); |
|
|
}); |
|
|
} |
|
|
|
|
|
const commitMessage = `chore(deps): update examples to react-instantsearch v${version}`; |
|
|
execSync('git add examples package.json yarn.lock'); |
|
|
execSync(`printf "${commitMessage}" | git commit --file -`); |
|
|
|