Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

hostProcess.ts

51 lines1.3 KB

1import * as Context from "effect/Context";
2import * as NodeOS from "node:os";
3​
4export const HostProcessPlatform = Context.Reference<NodeJS.Platform>(
5 "@piku/shared/hostProcess/HostProcessPlatform",
6 {
7 defaultValue: () => process.platform,
8 },
9);
10​
11export const HostProcessArchitecture = Context.Reference<NodeJS.Architecture>(
12 "@piku/shared/hostProcess/HostProcessArchitecture",
13 {
14 defaultValue: () => process.arch,
15 },
16);
17​
18export const HostProcessHostname = Context.Reference<string>(
19 "@piku/shared/hostProcess/HostProcessHostname",
20 {
21 defaultValue: () => NodeOS.hostname(),
22 },
23);
24​
25export const HostProcessEnvironment = Context.Reference<NodeJS.ProcessEnv>(
26 "@piku/shared/hostProcess/HostProcessEnvironment",
27 {
28 defaultValue: () => process.env,
29 },
30);
31​
32export const HostProcessWorkingDirectory = Context.Reference<string>(
33 "@piku/shared/hostProcess/HostProcessWorkingDirectory",
34 {
35 defaultValue: () => process.cwd(),
36 },
37);
38​
39export const HostProcessExecutablePath = Context.Reference<string>(
40 "@piku/shared/hostProcess/HostProcessExecutablePath",
41 {
42 defaultValue: () => process.execPath,
43 },
44);
45​
46export const HostProcessArguments = Context.Reference<ReadonlyArray<string>>(
47 "@piku/shared/hostProcess/HostProcessArguments",
48 {
49 defaultValue: () => process.argv,
50 },
51);