2021-11-07 07:34:51 +01:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2022-05-08 19:54:06 +02:00
|
|
|
const NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
|
|
|
|
|
2022-08-23 00:18:47 +02:00
|
|
|
if (NODE_MAJOR_VERSION < 18) {
|
|
|
|
throw new Error('This tool requires NodeJS 18 or later');
|
2022-05-08 19:54:06 +02:00
|
|
|
}
|
|
|
|
|
2023-08-23 10:31:40 +02:00
|
|
|
const expectedPathEnding = '/vendor/adevtool/bin/run'
|
|
|
|
let cwd = process.cwd()
|
|
|
|
let validCwd = false
|
|
|
|
if (__filename.startsWith(cwd)) {
|
|
|
|
let ending = __filename.substring(cwd.length)
|
|
|
|
if (ending === expectedPathEnding) {
|
|
|
|
validCwd = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!validCwd) {
|
|
|
|
if (__filename.endsWith(expectedPathEnding)) {
|
|
|
|
console.log('adevtool should be started from the root of OS tree')
|
|
|
|
} else {
|
|
|
|
console.log('adevtool should be placed in vendor/adevtool directory')
|
|
|
|
}
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
|
2021-11-07 07:34:51 +01:00
|
|
|
require('@oclif/command').run()
|
|
|
|
.then(require('@oclif/command/flush'))
|
|
|
|
.catch(require('@oclif/errors/handle'))
|