joelniklaus's picture
joelniklaus HF Staff
deploy: 38a879272d474ca1517a3617e512db53d1460598 (part 2)
31c6cca verified
Raw
History Blame Contribute Delete
1.14 kB
import {
cliMain,
defaultDependencies,
formatActivationOutput,
parseSavedPlanOptions,
} from "./cli.js";
import { locateGitRepositoryRoot } from "./source.js";
import {
assertInstallerStateOutsideRepository,
currentInstallPlanPath,
installerStateRoot,
withInstallerStateLock,
} from "./state.js";
import { disableInstall } from "./workflow.js";
const usage =
"Usage: npm run install:disable -- --space <namespace>/<space> [--state-dir <dir>]\n";
await cliMain(async () => {
const options = parseSavedPlanOptions(process.argv.slice(2));
if (options === "help") {
process.stdout.write(usage);
return;
}
const stateRoot = await assertInstallerStateOutsideRepository(
installerStateRoot(options.stateDirectory),
await locateGitRepositoryRoot(),
);
const dependencies = defaultDependencies();
await withInstallerStateLock(options.space, stateRoot, async () => {
const planPath = await currentInstallPlanPath(options.space, stateRoot);
const result = await disableInstall({ planPath }, dependencies);
process.stdout.write(formatActivationOutput(options.space, result));
});
});