29 lines
857 B
TypeScript
Executable File
29 lines
857 B
TypeScript
Executable File
#!/usr/bin/env bun
|
|
|
|
import { jjCliYargs } from "./jjCliYargs";
|
|
jjCliYargs(false)
|
|
|
|
const requiredProcessEnvs = {
|
|
JJ_SOURCE_DIR: process.env.JJ_SOURCE_DIR
|
|
}
|
|
|
|
import { getJJConfigByKeyChain, getJjYamlObj, jjConfigsExp } from "./jjConfigUtils";
|
|
import _ from 'lodash';
|
|
import { dynamicStringHandler } from "./dynamicStringHandler";
|
|
|
|
const jjCommandConfig = getJJConfigByKeyChain(`commands['${process.env.JJ_CLI_ARG_1}']`)
|
|
|
|
if (!jjCommandConfig || _.isEmpty(jjCommandConfig)) {
|
|
console.error(`Command ${process.env.JJ_CLI_ARG_1} is not available`)
|
|
process.exit(0)
|
|
} else {
|
|
const scriptToRunPath = dynamicStringHandler(`${jjCommandConfig.scriptToRun.prePath}/${jjCommandConfig.scriptToRun.path}`, "", requiredProcessEnvs, false)
|
|
const scriptToRunFn = (await import(scriptToRunPath)).default
|
|
await scriptToRunFn()
|
|
process.exit(0)
|
|
}
|
|
|
|
|
|
|
|
|