File size: 1,994 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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 -`);