-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint.js
48 lines (46 loc) · 1.41 KB
/
lint.js
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
var cp = require('child_process')
var path = require('path')
const chalk = require('chalk')
console.log('Linting...')
console.log('Starting linting backend.')
const backendLint = cp.spawn('yarn', ['lint:all'], {
cwd: path.join(__dirname, '/backend'),
})
backendLint.stdout.on('data', (data) => {
if (data.includes('warning')) {
console.warn(chalk.yellow('backend linting error: ' + data.toString()))
} else {
console.log('linting backend: ' + data.toString())
}
})
backendLint.stderr.on('data', (data) => {
console.error(chalk.red('backend linting error: ' + data.toString()))
})
backendLint.on('exit', (code) => {
if (code !== 0) {
process.exitCode = 1
}
console.log('frontend formatted')
setTimeout(() => {
console.log('Starting linting frontend.')
const frontendLint = cp.spawn('yarn', ['lint:all'], {
cwd: path.join(__dirname, '/frontend'),
})
frontendLint.stdout.on('data', (data) => {
if (data.includes('warning')) {
console.warn(chalk.yellow('frontend linting error: ' + data.toString()))
} else {
console.log('linting frontend: ' + data.toString())
}
})
frontendLint.stderr.on('data', (data) => {
console.error(chalk.red('frontend linting error: ' + data.toString()))
})
frontendLint.on('exit', (code) => {
if (code !== 0) {
process.exitCode = 1
}
console.log('frontend linted')
})
}, 100)
})