-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: working dir corrected and turbo creation
- Loading branch information
1 parent
76134d4
commit 18607c1
Showing
6 changed files
with
34 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import { z } from "zod"; | ||
|
||
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc"; | ||
import { getWorkingDir } from "~/utils/get-user-data"; | ||
|
||
export const metadataRouter = createTRPCRouter({ | ||
getCurrentDirectory: publicProcedure.query(() => { | ||
return process.cwd(); | ||
return getWorkingDir(); | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const getWorkingDir = () => process.env.USER_DIR || process.cwd(); | ||
|
||
export type PackageManager = "npm" | "pnpm" | "yarn"; | ||
|
||
// Used from https://github.com/t3-oss/create-t3-app | ||
export const getPkgManager = (): PackageManager => { | ||
const userAgent = process.env.npm_config_user_agent; | ||
|
||
if (userAgent) { | ||
if (userAgent.startsWith("yarn")) { | ||
return "yarn"; | ||
} else if (userAgent.startsWith("pnpm")) { | ||
return "pnpm"; | ||
} else { | ||
return "npm"; | ||
} | ||
} else { | ||
return "npm"; | ||
} | ||
}; |