Skip to content

Commit

Permalink
allow opting out of ts-node
Browse files Browse the repository at this point in the history
  • Loading branch information
ds300 committed Jan 18, 2024
1 parent 7a6f0ae commit edf02b6
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions packages/core/src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@ import { execSync } from "child_process";
import isBinary from "./utils/is-binary";
import { gitReset } from "./utils/git-reset";

try {
if (require.resolve("typescript")) {
require("ts-node/register/transpile-only");
}
} catch (error) {
// User doesn't have TS installed, cannot write TS plugins
}

const proxyUrl = process.env.https_proxy || process.env.http_proxy;
const env = envCi();

Expand Down Expand Up @@ -436,7 +428,22 @@ export default class Auto {
private versionBump?: SEMVER;

/** Initialize auto and it's environment */
constructor(options: ApiOptions = {}) {
constructor(
options: ApiOptions & {
/**
* Non-cli option to disable ts-node in contexts where a different ts loader is used.
*/
disableTsNode?: boolean;
} = {}
) {
try {
if (require.resolve("typescript") && !options.disableTsNode) {
require("ts-node/register/transpile-only");
}
} catch (error) {
// User doesn't have TS installed, cannot write TS plugins
}

this.options = options;
this.baseBranch =
options.baseBranch || (hasBranch("main") && "main") || "master";
Expand Down Expand Up @@ -580,7 +587,7 @@ export default class Auto {
options.newVersion,
options.isPrerelease,
options.to,
options.isPrerelease ? false: !this.inOldVersionBranch(),
options.isPrerelease ? false : !this.inOldVersionBranch()
);

this.logger.log.info(release.data.html_url);
Expand Down Expand Up @@ -1006,7 +1013,9 @@ export default class Auto {
// adding this command without resorting to bash if/else statements.
if (
env.isCi &&
(env.branch === this.baseBranch || this.inPrereleaseBranch() || this.inOldVersionBranch())
(env.branch === this.baseBranch ||
this.inPrereleaseBranch() ||
this.inOldVersionBranch())
) {
process.exit(0);
}
Expand Down

0 comments on commit edf02b6

Please sign in to comment.