Download react-instantsearch/scripts/update-examples.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/scripts/update-examples.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/scripts/update-examples.js
-
curl -L -o update-examples.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-instantsearch/scripts/update-examples.js
1.99 kB
| 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'); | |
| { | |
| // Update React InstantSearch DOM | |
| 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', | |
| } | |
| ); | |
| }); | |
| } | |
| { | |
| // Update React InstantSearch Native | |
| const examples = glob.sync(path.join(examplesPath, '+(react-native*)')); | |
| examples.forEach((example) => { | |
| console.log('updating in', example); | |
| // @TODO: update to react-instantsearch-native | |
| execSync( | |
| `cd ${example} && yarn upgrade react-instantsearch-native@${version}`, | |
| { | |
| stdio: 'inherit', | |
| } | |
| ); | |
| }); | |
| } | |
| { | |
| // Update React InstantSearch DOM Maps | |
| 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', | |
| } | |
| ); | |
| }); | |
| } | |
| { | |
| // Update React InstantSearch Hooks | |
| 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 -`); | |