forked from kentcdodds/testing-react-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiff.js
More file actions
34 lines (31 loc) · 754 Bytes
/
diff.js
File metadata and controls
34 lines (31 loc) · 754 Bytes
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
const {spawnSync} = require('child_process')
const inquirer = require('inquirer')
const glob = require('glob')
async function go() {
const files = glob
.sync('src/+(exercise|final)/*.+(js|ts|tsx)', {
ignore: ['*.d.ts'],
})
.map(f => f.replace(/^src\//, ''))
const {first} = await inquirer.prompt([
{
name: 'first',
message: `What's the first file`,
type: 'list',
choices: files,
},
])
const {second} = await inquirer.prompt([
{
name: 'second',
message: `What's the second file`,
type: 'list',
choices: files.filter(f => f !== first),
},
])
spawnSync(`git diff --no-index ./src/${first} ./src/${second}`, {
shell: true,
stdio: 'inherit',
})
}
go()