2018-08-03 15:59:59 +00:00
|
|
|
#!/usr/bin/env ts-node
|
|
|
|
|
|
|
|
import * as Path from 'path'
|
|
|
|
import { spawnSync, SpawnSyncOptions } from 'child_process'
|
|
|
|
|
|
|
|
import * as glob from 'glob'
|
|
|
|
|
|
|
|
const root = Path.dirname(__dirname)
|
|
|
|
|
|
|
|
const options: SpawnSyncOptions = {
|
|
|
|
cwd: root,
|
|
|
|
stdio: 'inherit',
|
|
|
|
}
|
|
|
|
|
|
|
|
function findYarnVersion(callback: (path: string) => void) {
|
2018-08-03 18:08:17 +00:00
|
|
|
glob('vendor/yarn-*.js', (error, files) => {
|
2018-08-03 15:59:59 +00:00
|
|
|
if (error != null) {
|
|
|
|
throw error
|
|
|
|
}
|
|
|
|
|
2018-08-03 18:08:17 +00:00
|
|
|
// this ensures the paths returned by glob are sorted alphabetically
|
2018-08-03 15:59:59 +00:00
|
|
|
files.sort()
|
|
|
|
|
2018-08-03 18:08:17 +00:00
|
|
|
// use the latest version here if multiple are found
|
|
|
|
const latestVersion = files[files.length - 1]
|
2018-08-03 15:59:59 +00:00
|
|
|
|
2018-08-03 18:08:17 +00:00
|
|
|
callback(latestVersion)
|
2018-08-03 15:59:59 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
findYarnVersion(path => {
|
|
|
|
let result = spawnSync(
|
|
|
|
'node',
|
|
|
|
[path, '--cwd', 'app', 'install', '--force'],
|
|
|
|
options
|
|
|
|
)
|
|
|
|
|
|
|
|
if (result.status !== 0) {
|
2020-06-18 17:24:04 +00:00
|
|
|
process.exit(result.status || 1)
|
2018-08-03 15:59:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
result = spawnSync(
|
|
|
|
'git',
|
|
|
|
['submodule', 'update', '--recursive', '--init'],
|
|
|
|
options
|
|
|
|
)
|
|
|
|
|
|
|
|
if (result.status !== 0) {
|
2020-06-15 23:19:30 +00:00
|
|
|
process.exit(result.status || undefined)
|
2018-08-03 15:59:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
result = spawnSync('node', [path, 'compile:tslint'], options)
|
|
|
|
|
|
|
|
if (result.status !== 0) {
|
2020-06-18 17:25:16 +00:00
|
|
|
process.exit(result.status || 1)
|
2018-08-03 15:59:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
result = spawnSync('node', [path, 'compile:script'], options)
|
|
|
|
|
|
|
|
if (result.status !== 0) {
|
2020-06-15 23:19:30 +00:00
|
|
|
process.exit(result.status || undefined)
|
2018-08-03 15:59:59 +00:00
|
|
|
}
|
|
|
|
})
|