aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/turbo-ignore/src/getWorkspace.ts
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2023-11-03 21:25:40 +0800
committer简律纯 <i@jyunko.cn>2023-11-03 21:25:40 +0800
commit9029588590bea8b10451575c5142dcde77ecd1b5 (patch)
tree04cf8aee56c23fd225ff19d340f7cee621d874ef /packages/turbo-ignore/src/getWorkspace.ts
parent94071d7ce16c56641d67d488e2bac6be84ffe731 (diff)
downloadHydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.tar.gz
HydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.zip
chore: delete useless files
Diffstat (limited to 'packages/turbo-ignore/src/getWorkspace.ts')
-rw-r--r--packages/turbo-ignore/src/getWorkspace.ts37
1 files changed, 0 insertions, 37 deletions
diff --git a/packages/turbo-ignore/src/getWorkspace.ts b/packages/turbo-ignore/src/getWorkspace.ts
deleted file mode 100644
index e0b3167..0000000
--- a/packages/turbo-ignore/src/getWorkspace.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import fs from "fs";
-import path from "path";
-import { error, info } from "./logger";
-import { TurboIgnoreArgs } from "./types";
-
-export function getWorkspace(args: TurboIgnoreArgs): string | null {
- const { directory = process.cwd(), workspace } = args;
-
- // if the workspace is provided via args, use that
- if (workspace) {
- info(`Using "${workspace}" as workspace from arguments`);
- return workspace;
- }
-
- // otherwise, try and infer it from a package.json in the current directory
- const packageJsonPath = path.join(directory, "package.json");
- try {
- const raw = fs.readFileSync(packageJsonPath, "utf8");
- const packageJsonContent: Record<string, string> & { name: string } =
- JSON.parse(raw);
-
- if (!packageJsonContent.name) {
- error(`"${packageJsonPath}" is missing the "name" field (required).`);
- return null;
- }
-
- info(
- `Inferred "${packageJsonContent.name}" as workspace from "package.json"`
- );
- return packageJsonContent.name;
- } catch (e) {
- error(
- `"${packageJsonPath}" could not be found. turbo-ignore inferencing failed`
- );
- return null;
- }
-}