@stryke/env 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +62 -0
- package/dist/ci-checks.cjs +11 -0
- package/dist/ci-checks.d.ts +15 -0
- package/dist/ci-checks.mjs +1 -0
- package/dist/environment-checks.cjs +20 -0
- package/dist/environment-checks.d.ts +25 -0
- package/dist/environment-checks.mjs +1 -0
- package/dist/get-env-paths.cjs +59 -0
- package/dist/get-env-paths.d.ts +60 -0
- package/dist/get-env-paths.mjs +1 -0
- package/dist/index.cjs +71 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.mjs +1 -0
- package/dist/load-env.cjs +55 -0
- package/dist/load-env.d.ts +56 -0
- package/dist/load-env.mjs +1 -0
- package/dist/providers.cjs +41 -0
- package/dist/providers.d.ts +9 -0
- package/dist/providers.mjs +1 -0
- package/dist/runtime-checks.cjs +22 -0
- package/dist/runtime-checks.d.ts +39 -0
- package/dist/runtime-checks.mjs +1 -0
- package/dist/types.cjs +7 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.mjs +1 -0
- package/package.json +180 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!-- START header -->
|
|
2
|
+
<!-- END header -->
|
|
3
|
+
|
|
4
|
+
# env
|
|
5
|
+
|
|
6
|
+
A package containing utility functions to handle environment specific processes
|
|
7
|
+
|
|
8
|
+
<!-- START doctoc -->
|
|
9
|
+
<!-- END doctoc -->
|
|
10
|
+
|
|
11
|
+
## Installing
|
|
12
|
+
|
|
13
|
+
Using [pnpm](http://pnpm.io):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add -D stryke/env
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
<details>
|
|
20
|
+
<summary>Using npm</summary>
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -D stryke/env
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
</details>
|
|
27
|
+
|
|
28
|
+
<details>
|
|
29
|
+
<summary>Using yarn</summary>
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
yarn add -D stryke/env
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
</details>
|
|
36
|
+
|
|
37
|
+
## Reduced Package Size
|
|
38
|
+
|
|
39
|
+
This project uses [tsup](https://tsup.egoist.dev/) to package the source code
|
|
40
|
+
due to its ability to remove unused code and ship smaller javascript files
|
|
41
|
+
thanks to code splitting. This helps to greatly reduce the size of the package
|
|
42
|
+
and to make it easier to use in other projects.
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
This project is built using [Nx](https://nx.dev). As a result, many of the usual
|
|
47
|
+
commands are available to assist in development.
|
|
48
|
+
|
|
49
|
+
### Building
|
|
50
|
+
|
|
51
|
+
Run `nx build env` to build the library.
|
|
52
|
+
|
|
53
|
+
### Running unit tests
|
|
54
|
+
|
|
55
|
+
Run `nx test env` to execute the unit tests via [Jest](https://jestjs.io).
|
|
56
|
+
|
|
57
|
+
### Linting
|
|
58
|
+
|
|
59
|
+
Run `nx lint env` to run [ESLint](https://eslint.org/) on the package.
|
|
60
|
+
|
|
61
|
+
<!-- START footer -->
|
|
62
|
+
<!-- END footer -->
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isInteractive = exports.isCI = void 0;
|
|
7
|
+
var _providers = require("./providers.cjs");
|
|
8
|
+
const isCI = (I = process.env) => !!(I.STORM_CI || I.CI || I.CONTINUOUS_INTEGRATION || I.BUILD_NUMBER || I.RUN_ID || I.AGOLA_GIT_REF || I.AC_APPCIRCLE || I.APPVEYOR || I.CODEBUILD || I.TF_BUILD || I.bamboo_planKey || I.BITBUCKET_COMMIT || I.BITRISE_IO || I.BUDDY_WORKSPACE_ID || I.BUILDKITE || I.CIRCLECI || I.CIRRUS_CI || I.CF_BUILD_ID || I.CM_BUILD_ID || I.CI_NAME || I.DRONE || I.DSARI || I.EARTHLY_CI || I.EAS_BUILD || I.GERRIT_PROJECT || I.GITEA_ACTIONS || I.GITHUB_ACTIONS || I.GITLAB_CI || I.GOCD || I.BUILDER_OUTPUT || I.HARNESS_BUILD_ID || I.JENKINS_URL || I.BUILD_ID || I.LAYERCI || I.MAGNUM || I.NETLIFY || I.NEVERCODE || I.PROW_JOB_ID || I.RELEASE_BUILD_ID || I.RENDER || I.SAILCI || I.HUDSON || I.JENKINS_URL || I.BUILD_ID || I.SCREWDRIVER || I.SEMAPHORE || I.SOURCEHUT || I.STRIDER || I.TASK_ID || I.RUN_ID || I.TEAMCITY_VERSION || I.TRAVIS || I.VELA || I.NOW_BUILDER || I.APPCENTER_BUILD_ID || I.CI_XCODE_PROJECT || I.XCS || _providers.providerInfo.ci !== !1),
|
|
9
|
+
isInteractive = (I = process.stdin) => !!(I?.isTTY && process.env.TERM !== "dumb");
|
|
10
|
+
exports.isInteractive = isInteractive;
|
|
11
|
+
exports.isCI = isCI;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the current environment is a CI environment.
|
|
3
|
+
*
|
|
4
|
+
* @returns True if the current environment is a CI environment.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isCI: (env?: Record<string, string | undefined>) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Check if the current process is interactive
|
|
9
|
+
*
|
|
10
|
+
* @param stream - The stream to check
|
|
11
|
+
* @returns True if the current process is interactive
|
|
12
|
+
*/
|
|
13
|
+
export declare const isInteractive: (stream?: NodeJS.ReadStream & {
|
|
14
|
+
fd: 0;
|
|
15
|
+
}) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{providerInfo as E}from"./providers";export const isCI=(I=process.env)=>!!(I.STORM_CI||I.CI||I.CONTINUOUS_INTEGRATION||I.BUILD_NUMBER||I.RUN_ID||I.AGOLA_GIT_REF||I.AC_APPCIRCLE||I.APPVEYOR||I.CODEBUILD||I.TF_BUILD||I.bamboo_planKey||I.BITBUCKET_COMMIT||I.BITRISE_IO||I.BUDDY_WORKSPACE_ID||I.BUILDKITE||I.CIRCLECI||I.CIRRUS_CI||I.CF_BUILD_ID||I.CM_BUILD_ID||I.CI_NAME||I.DRONE||I.DSARI||I.EARTHLY_CI||I.EAS_BUILD||I.GERRIT_PROJECT||I.GITEA_ACTIONS||I.GITHUB_ACTIONS||I.GITLAB_CI||I.GOCD||I.BUILDER_OUTPUT||I.HARNESS_BUILD_ID||I.JENKINS_URL||I.BUILD_ID||I.LAYERCI||I.MAGNUM||I.NETLIFY||I.NEVERCODE||I.PROW_JOB_ID||I.RELEASE_BUILD_ID||I.RENDER||I.SAILCI||I.HUDSON||I.JENKINS_URL||I.BUILD_ID||I.SCREWDRIVER||I.SEMAPHORE||I.SOURCEHUT||I.STRIDER||I.TASK_ID||I.RUN_ID||I.TEAMCITY_VERSION||I.TRAVIS||I.VELA||I.NOW_BUILDER||I.APPCENTER_BUILD_ID||I.CI_XCODE_PROJECT||I.XCS||E.ci!==!1),isInteractive=(I=process.stdin)=>!!(I?.isTTY&&process.env.TERM!=="dumb");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.platform = exports.nodeVersion = exports.nodeMajorVersion = exports.isWindows = exports.isTest = exports.isProduction = exports.isMinimal = exports.isMacOS = exports.isLinux = exports.isDevelopment = exports.isDebug = exports.isColorSupported = exports.hasTTY = void 0;
|
|
7
|
+
var _ciChecks = require("./ci-checks.cjs");
|
|
8
|
+
const platform = exports.platform = globalThis.process?.platform || "",
|
|
9
|
+
hasTTY = exports.hasTTY = !!(globalThis.process?.stdout && globalThis.process?.stdout.isTTY),
|
|
10
|
+
isDebug = exports.isDebug = !!process.env.DEBUG,
|
|
11
|
+
isTest = exports.isTest = process.env.NODE_ENV === "test" || !!process.env.TEST,
|
|
12
|
+
isProduction = exports.isProduction = process.env.NODE_ENV === "production",
|
|
13
|
+
isDevelopment = exports.isDevelopment = process.env.NODE_ENV === "dev" || process.env.NODE_ENV === "development",
|
|
14
|
+
isMinimal = exports.isMinimal = !!process.env.MINIMAL || _ciChecks.isCI || isTest || !hasTTY,
|
|
15
|
+
isWindows = exports.isWindows = /^win/i.test(platform),
|
|
16
|
+
isLinux = exports.isLinux = /^linux/i.test(platform),
|
|
17
|
+
isMacOS = exports.isMacOS = /^darwin/i.test(platform),
|
|
18
|
+
isColorSupported = exports.isColorSupported = !process.env.NO_COLOR && (!!process.env.FORCE_COLOR || (hasTTY || isWindows) && process.env.TERM !== "dumb" || (0, _ciChecks.isCI)()),
|
|
19
|
+
nodeVersion = exports.nodeVersion = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null,
|
|
20
|
+
nodeMajorVersion = exports.nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Value of process.platform */
|
|
2
|
+
export declare const platform: NodeJS.Platform;
|
|
3
|
+
/** Detect if stdout.TTY is available */
|
|
4
|
+
export declare const hasTTY: boolean;
|
|
5
|
+
/** Detect if `DEBUG` environment variable is set */
|
|
6
|
+
export declare const isDebug: boolean;
|
|
7
|
+
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
8
|
+
export declare const isTest: boolean;
|
|
9
|
+
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
10
|
+
export declare const isProduction: boolean;
|
|
11
|
+
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
12
|
+
export declare const isDevelopment: boolean;
|
|
13
|
+
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
14
|
+
export declare const isMinimal: true | ((env?: Record<string, string | undefined>) => boolean);
|
|
15
|
+
/** Detect if process.platform is Windows */
|
|
16
|
+
export declare const isWindows: boolean;
|
|
17
|
+
/** Detect if process.platform is Linux */
|
|
18
|
+
export declare const isLinux: boolean;
|
|
19
|
+
/** Detect if process.platform is macOS (darwin kernel) */
|
|
20
|
+
export declare const isMacOS: boolean;
|
|
21
|
+
/** Color Support */
|
|
22
|
+
export declare const isColorSupported: boolean;
|
|
23
|
+
/** Node.js versions */
|
|
24
|
+
export declare const nodeVersion: string | null;
|
|
25
|
+
export declare const nodeMajorVersion: number | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isCI as o}from"./ci-checks";export const platform=globalThis.process?.platform||"",hasTTY=!!(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),isDebug=!!process.env.DEBUG,isTest=process.env.NODE_ENV==="test"||!!process.env.TEST,isProduction=process.env.NODE_ENV==="production",isDevelopment=process.env.NODE_ENV==="dev"||process.env.NODE_ENV==="development",isMinimal=!!process.env.MINIMAL||o||isTest||!hasTTY,isWindows=/^win/i.test(platform),isLinux=/^linux/i.test(platform),isMacOS=/^darwin/i.test(platform),isColorSupported=!process.env.NO_COLOR&&(!!process.env.FORCE_COLOR||(hasTTY||isWindows)&&process.env.TERM!=="dumb"||o()),nodeVersion=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null,nodeMajorVersion=Number(nodeVersion?.split(".")[0])||null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getEnvPaths = getEnvPaths;
|
|
7
|
+
var _joinPaths = require("@stryke/path/utilities/join-paths");
|
|
8
|
+
var _titleCase = require("@stryke/string-format/title-case");
|
|
9
|
+
var _isString = require("@stryke/types/type-checks/is-string");
|
|
10
|
+
var _nodeOs = _interopRequireDefault(require("node:os"));
|
|
11
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const n = _nodeOs.default.homedir(),
|
|
14
|
+
o = _nodeOs.default.tmpdir(),
|
|
15
|
+
l = e => {
|
|
16
|
+
const r = (0, _joinPaths.joinPaths)(n, "Library");
|
|
17
|
+
return {
|
|
18
|
+
data: (0, _joinPaths.joinPaths)(r, "Application Support", e),
|
|
19
|
+
config: (0, _joinPaths.joinPaths)(r, "Preferences", e),
|
|
20
|
+
cache: (0, _joinPaths.joinPaths)(r, "Caches", e),
|
|
21
|
+
log: (0, _joinPaths.joinPaths)(r, "Logs", e),
|
|
22
|
+
temp: (0, _joinPaths.joinPaths)(o, e)
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
E = e => {
|
|
26
|
+
const r = process.env.APPDATA || (0, _joinPaths.joinPaths)(n, "AppData", "Roaming"),
|
|
27
|
+
t = process.env.LOCALAPPDATA || (0, _joinPaths.joinPaths)(n, "AppData", "Local"),
|
|
28
|
+
a = (0, _titleCase.titleCase)(e).trim().replace(/\s+/g, "");
|
|
29
|
+
return {
|
|
30
|
+
data: (0, _joinPaths.joinPaths)(t, a, "Data"),
|
|
31
|
+
config: (0, _joinPaths.joinPaths)(r, a, "Config"),
|
|
32
|
+
cache: (0, _joinPaths.joinPaths)(t, "Cache", e),
|
|
33
|
+
log: (0, _joinPaths.joinPaths)(t, a, "Log"),
|
|
34
|
+
temp: (0, _joinPaths.joinPaths)(o, e)
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
O = e => {
|
|
38
|
+
const r = _nodePath.default.basename(n);
|
|
39
|
+
return {
|
|
40
|
+
data: (0, _joinPaths.joinPaths)(process.env.XDG_DATA_HOME || (0, _joinPaths.joinPaths)(n, ".local", "share"), e),
|
|
41
|
+
config: (0, _joinPaths.joinPaths)(process.env.XDG_CONFIG_HOME || (0, _joinPaths.joinPaths)(n, ".config"), e),
|
|
42
|
+
cache: (0, _joinPaths.joinPaths)(process.env.XDG_CACHE_HOME || (0, _joinPaths.joinPaths)(n, ".cache"), e),
|
|
43
|
+
log: (0, _joinPaths.joinPaths)(process.env.XDG_STATE_HOME || (0, _joinPaths.joinPaths)(n, ".local", "state"), e),
|
|
44
|
+
temp: (0, _joinPaths.joinPaths)(o, r, e)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
function getEnvPaths(e = {}) {
|
|
48
|
+
let r = e.orgId || "storm-software";
|
|
49
|
+
if (!r) throw new Error("You need to provide an orgId to the `getEnvPaths` function");
|
|
50
|
+
e.suffix && (r += `-${(0, _isString.isString)(e.suffix) ? e.suffix : "nodejs"}`);
|
|
51
|
+
let t = {};
|
|
52
|
+
return process.platform === "darwin" ? t = l(r) : process.platform === "win32" ? t = E(r) : t = O(r), process.env.STORM_DATA_DIRECTORY ? t.data = process.env.STORM_DATA_DIRECTORY : process.env.STORM_CONFIG_DIRECTORY ? t.config = process.env.STORM_CONFIG_DIRECTORY : process.env.STORM_CACHE_DIRECTORY ? t.cache = process.env.STORM_CACHE_DIRECTORY : process.env.STORM_LOG_DIRECTORY ? t.log = process.env.STORM_LOG_DIRECTORY : process.env.STORM_TEMP_DIRECTORY && (t.temp = process.env.STORM_TEMP_DIRECTORY), e.workspaceRoot && (t.cache ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, "node_modules", ".cache", r), t.temp ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, "tmp", r), t.log ??= (0, _joinPaths.joinPaths)(t.temp, "logs"), t.config ??= (0, _joinPaths.joinPaths)(e.workspaceRoot, ".config", r)), Object.keys(t).reduce((a, c) => {
|
|
53
|
+
if (t[c]) {
|
|
54
|
+
const i = t[c];
|
|
55
|
+
a[c] = e.appId && e.appId !== e.orgId && e.appId !== e.nestedDir ? (0, _joinPaths.joinPaths)(i, e.appId) : i, e.nestedDir && e.nestedDir !== e.orgId && e.nestedDir !== e.appId && (a[c] = (0, _joinPaths.joinPaths)(a[c], e.nestedDir));
|
|
56
|
+
}
|
|
57
|
+
return a;
|
|
58
|
+
}, {});
|
|
59
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the `getEnvPaths` function.
|
|
3
|
+
*/
|
|
4
|
+
export type GetEnvPathsOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the organization
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue "storm-software"
|
|
9
|
+
*/
|
|
10
|
+
orgId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The name of the specific application to use as a nested folder inside the organization's folder
|
|
13
|
+
*
|
|
14
|
+
* For example: `~/ ... /storm-software/Log/<appId>`
|
|
15
|
+
*/
|
|
16
|
+
appId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The name of the specific application to use as a nested folder inside the organization's folder
|
|
19
|
+
*
|
|
20
|
+
* When a value is provided, it will use `~/ ... /storm-software/Log/<appId>/<nestedDir>`
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* If no child is provided, it will use `~/ ... /storm-software/Log/<appId>`
|
|
24
|
+
*/
|
|
25
|
+
nestedDir?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The suffix to append to the project name.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* If `suffix` is `true`, the project name will be suffixed with `"nodejs"`.
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue false
|
|
33
|
+
*/
|
|
34
|
+
suffix?: string | boolean | null;
|
|
35
|
+
/**
|
|
36
|
+
* The root directory of the workspace that is used for determining the `cache` and `tmp` paths if they were not already set by other means.
|
|
37
|
+
*/
|
|
38
|
+
workspaceRoot?: string;
|
|
39
|
+
};
|
|
40
|
+
export type EnvPaths = {
|
|
41
|
+
data: string;
|
|
42
|
+
config: string;
|
|
43
|
+
cache: string;
|
|
44
|
+
log: string;
|
|
45
|
+
temp: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Get paths for storing things like data, config, logs, and cache in the current runtime environment.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* On macOS, directories are generally created in `~/Library/Application Support/<name>`.
|
|
52
|
+
* On Windows, directories are generally created in `%AppData%/<name>`.
|
|
53
|
+
* On Linux, directories are generally created in `~/.config/<name>` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).
|
|
54
|
+
*
|
|
55
|
+
* If the `STORM_DATA_DIRECTORY`, `STORM_CONFIG_DIRECTORY`, `STORM_CACHE_DIRECTORY`, `STORM_LOG_DIRECTORY`, or `STORM_TEMP_DIRECTORY` environment variables are set, they will be used instead of the default paths.
|
|
56
|
+
*
|
|
57
|
+
* @param options - Parameters used to determine the specific paths for the current project/runtime environment
|
|
58
|
+
* @returns An object containing the various paths for the runtime environment
|
|
59
|
+
*/
|
|
60
|
+
export declare function getEnvPaths(options?: GetEnvPathsOptions): EnvPaths;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{joinPaths as s}from"@stryke/path/utilities/join-paths";import{titleCase as f}from"@stryke/string-format/title-case";import{isString as R}from"@stryke/types/type-checks/is-string";import p from"node:os";import g from"node:path";const n=p.homedir(),o=p.tmpdir(),l=e=>{const r=s(n,"Library");return{data:s(r,"Application Support",e),config:s(r,"Preferences",e),cache:s(r,"Caches",e),log:s(r,"Logs",e),temp:s(o,e)}},E=e=>{const r=process.env.APPDATA||s(n,"AppData","Roaming"),t=process.env.LOCALAPPDATA||s(n,"AppData","Local"),a=f(e).trim().replace(/\s+/g,"");return{data:s(t,a,"Data"),config:s(r,a,"Config"),cache:s(t,"Cache",e),log:s(t,a,"Log"),temp:s(o,e)}},O=e=>{const r=g.basename(n);return{data:s(process.env.XDG_DATA_HOME||s(n,".local","share"),e),config:s(process.env.XDG_CONFIG_HOME||s(n,".config"),e),cache:s(process.env.XDG_CACHE_HOME||s(n,".cache"),e),log:s(process.env.XDG_STATE_HOME||s(n,".local","state"),e),temp:s(o,r,e)}};export function getEnvPaths(e={}){let r=e.orgId||"storm-software";if(!r)throw new Error("You need to provide an orgId to the `getEnvPaths` function");e.suffix&&(r+=`-${R(e.suffix)?e.suffix:"nodejs"}`);let t={};return process.platform==="darwin"?t=l(r):process.platform==="win32"?t=E(r):t=O(r),process.env.STORM_DATA_DIRECTORY?t.data=process.env.STORM_DATA_DIRECTORY:process.env.STORM_CONFIG_DIRECTORY?t.config=process.env.STORM_CONFIG_DIRECTORY:process.env.STORM_CACHE_DIRECTORY?t.cache=process.env.STORM_CACHE_DIRECTORY:process.env.STORM_LOG_DIRECTORY?t.log=process.env.STORM_LOG_DIRECTORY:process.env.STORM_TEMP_DIRECTORY&&(t.temp=process.env.STORM_TEMP_DIRECTORY),e.workspaceRoot&&(t.cache??=s(e.workspaceRoot,"node_modules",".cache",r),t.temp??=s(e.workspaceRoot,"tmp",r),t.log??=s(t.temp,"logs"),t.config??=s(e.workspaceRoot,".config",r)),Object.keys(t).reduce((a,c)=>{if(t[c]){const i=t[c];a[c]=e.appId&&e.appId!==e.orgId&&e.appId!==e.nestedDir?s(i,e.appId):i,e.nestedDir&&e.nestedDir!==e.orgId&&e.nestedDir!==e.appId&&(a[c]=s(a[c],e.nestedDir))}return a},{})}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ciChecks = require("./ci-checks.cjs");
|
|
7
|
+
Object.keys(_ciChecks).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ciChecks[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ciChecks[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _getEnvPaths = require("./get-env-paths.cjs");
|
|
18
|
+
Object.keys(_getEnvPaths).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _getEnvPaths[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _getEnvPaths[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _loadEnv = require("./load-env.cjs");
|
|
29
|
+
Object.keys(_loadEnv).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _loadEnv[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _loadEnv[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _providers = require("./providers.cjs");
|
|
40
|
+
Object.keys(_providers).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _providers[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _providers[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _runtimeChecks = require("./runtime-checks.cjs");
|
|
51
|
+
Object.keys(_runtimeChecks).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _runtimeChecks[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _runtimeChecks[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _types = require("./types.cjs");
|
|
62
|
+
Object.keys(_types).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _types[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The env library used by Storm Software for building NodeJS applications.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* A package containing utility functions to handle environment specific processes
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from "./ci-checks";
|
|
10
|
+
export * from "./get-env-paths";
|
|
11
|
+
export * from "./load-env";
|
|
12
|
+
export * from "./providers";
|
|
13
|
+
export * from "./runtime-checks";
|
|
14
|
+
export * from "./types";
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./ci-checks";export*from"./get-env-paths";export*from"./load-env";export*from"./providers";export*from"./runtime-checks";export*from"./types";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getEnvFilesForMode = getEnvFilesForMode;
|
|
7
|
+
exports.loadClientEnv = loadClientEnv;
|
|
8
|
+
exports.loadEnv = loadEnv;
|
|
9
|
+
exports.loadEnvFile = loadEnvFile;
|
|
10
|
+
exports.loadServerEnv = loadServerEnv;
|
|
11
|
+
var _dotenvx = require("@dotenvx/dotenvx");
|
|
12
|
+
var _readFile = require("@stryke/fs/files/read-file");
|
|
13
|
+
var _json = require("@stryke/json");
|
|
14
|
+
var _path = require("@stryke/path");
|
|
15
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function getEnvFilesForMode(n, r = "production") {
|
|
19
|
+
return [".env", ".env.local", `.env.${r}`, `.env.${r}.local`, `.env.local.${r}`].map(s => (0, _path.joinPaths)(n, s));
|
|
20
|
+
}
|
|
21
|
+
async function loadEnvFile(n, r = []) {
|
|
22
|
+
const s = Array.isArray(r) ? r : [r];
|
|
23
|
+
return (await Promise.all((r.length > 0 ? s.map(t => (0, _path.joinPaths)(t, n)) : [n]).map(t => {
|
|
24
|
+
if ((0, _path.existsSync)(t)) return (0, _readFile.readFile)(t);
|
|
25
|
+
}))).reduce((t, u) => {
|
|
26
|
+
if (!u) return t;
|
|
27
|
+
const a = (0, _dotenvx.parse)(u, {
|
|
28
|
+
processEnv: {
|
|
29
|
+
...process.env
|
|
30
|
+
},
|
|
31
|
+
privateKey: process.env.DOTENV_PRIVATE_KEY || process.env.STORM_PRIVATE_KEY
|
|
32
|
+
});
|
|
33
|
+
return (0, _defu.default)(a, t);
|
|
34
|
+
}, {});
|
|
35
|
+
}
|
|
36
|
+
async function loadEnv(n, r, s) {
|
|
37
|
+
if (r === "local") throw new Error('"local" cannot be used as a mode name because it conflicts with the .local postfix for .env files.');
|
|
38
|
+
const t = s ? Array.isArray(s) ? s : [s] : [],
|
|
39
|
+
u = Array.isArray(n) ? n : [n],
|
|
40
|
+
a = {},
|
|
41
|
+
l = u.reduce((e, i) => (e.push(...getEnvFilesForMode(i, r).filter(c => !e.includes(c))), e), []);
|
|
42
|
+
let o = (await Promise.all(l.map(e => loadEnvFile(e)))).reduce((e, i) => (0, _defu.default)(i, e), {});
|
|
43
|
+
if (o.NODE_ENV && process.env.VITE_USER_NODE_ENV === void 0 && (process.env.VITE_USER_NODE_ENV = _json.StormJSON.stringify(o.NODE_ENV)), o.BROWSER && process.env.BROWSER === void 0 && (process.env.BROWSER = _json.StormJSON.stringify(o.BROWSER)), o.BROWSER_ARGS && process.env.BROWSER_ARGS === void 0 && (process.env.BROWSER_ARGS = _json.StormJSON.stringify(o.BROWSER_ARGS)), o = (0, _defu.default)({
|
|
44
|
+
...process.env
|
|
45
|
+
}, o), t.length === 0) return o;
|
|
46
|
+
for (const [e, i] of Object.entries(o)) t.some(c => e.startsWith(c)) && (a[e] = String(i));
|
|
47
|
+
for (const e in process.env) t.some(i => e.startsWith(i)) && (a[e] = process.env[e]);
|
|
48
|
+
return a;
|
|
49
|
+
}
|
|
50
|
+
async function loadClientEnv(n, r, s = _types.ENV_PREFIXES) {
|
|
51
|
+
return loadEnv(n, r, s);
|
|
52
|
+
}
|
|
53
|
+
async function loadServerEnv(n, r) {
|
|
54
|
+
return loadEnv(n, r);
|
|
55
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type DotenvParseOutput } from "./types";
|
|
2
|
+
export declare function getEnvFilesForMode(envDir: string, mode?: string): string[];
|
|
3
|
+
/**
|
|
4
|
+
* Load environment variables from a .env file.
|
|
5
|
+
*
|
|
6
|
+
* @param envFile - The path to the .env file.
|
|
7
|
+
* @returns The environment variables.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadEnvFile(envFile: string, envDir?: string | string[]): Promise<DotenvParseOutput>;
|
|
10
|
+
/**
|
|
11
|
+
* Load environment variables from .env files.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:
|
|
15
|
+
* - `.env`
|
|
16
|
+
* - `.env.local`
|
|
17
|
+
* - `.env.production`
|
|
18
|
+
* - `.env.production.local`
|
|
19
|
+
*
|
|
20
|
+
* @param mode - The mode to load the environment variables for.
|
|
21
|
+
* @param envDir - The directory/directories to load the environment variables from.
|
|
22
|
+
* @param prefix - The prefix or prefixes to use for the environment variables.
|
|
23
|
+
* @returns The environment variables.
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadEnv(envDir: string | string[], mode?: string, prefix?: string | string[]): Promise<DotenvParseOutput>;
|
|
26
|
+
/**
|
|
27
|
+
* Load environment variables from .env files for a client-side environment.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:
|
|
31
|
+
* - `.env`
|
|
32
|
+
* - `.env.local`
|
|
33
|
+
* - `.env.production`
|
|
34
|
+
* - `.env.production.local`
|
|
35
|
+
*
|
|
36
|
+
* @param mode - The mode to load the environment variables for.
|
|
37
|
+
* @param envDir - The directory/directories to load the environment variables from.
|
|
38
|
+
* @param prefix - The prefix or prefixes to use for the environment variables.
|
|
39
|
+
* @returns The environment variables.
|
|
40
|
+
*/
|
|
41
|
+
export declare function loadClientEnv(envDir: string | string[], mode?: string, prefix?: string | string[]): Promise<DotenvParseOutput>;
|
|
42
|
+
/**
|
|
43
|
+
* Load environment variables from .env files for a server-side environment.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* This function loads environment variables from .env files based on the mode. For the `production` mode, it will load:
|
|
47
|
+
* - `.env`
|
|
48
|
+
* - `.env.local`
|
|
49
|
+
* - `.env.production`
|
|
50
|
+
* - `.env.production.local`
|
|
51
|
+
*
|
|
52
|
+
* @param mode - The mode to load the environment variables for.
|
|
53
|
+
* @param envDir - The directory/directories to load the environment variables from.
|
|
54
|
+
* @returns The environment variables.
|
|
55
|
+
*/
|
|
56
|
+
export declare function loadServerEnv(envDir: string | string[], mode: string): Promise<DotenvParseOutput>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as v}from"@dotenvx/dotenvx";import{readFile as g}from"@stryke/fs/files/read-file";import{StormJSON as p}from"@stryke/json";import{existsSync as R,joinPaths as f}from"@stryke/path";import E from"defu";import{ENV_PREFIXES as m}from"./types";export function getEnvFilesForMode(n,r="production"){return[".env",".env.local",`.env.${r}`,`.env.${r}.local`,`.env.local.${r}`].map(s=>f(n,s))}export async function loadEnvFile(n,r=[]){const s=Array.isArray(r)?r:[r];return(await Promise.all((r.length>0?s.map(t=>f(t,n)):[n]).map(t=>{if(R(t))return g(t)}))).reduce((t,u)=>{if(!u)return t;const a=v(u,{processEnv:{...process.env},privateKey:process.env.DOTENV_PRIVATE_KEY||process.env.STORM_PRIVATE_KEY});return E(a,t)},{})}export async function loadEnv(n,r,s){if(r==="local")throw new Error('"local" cannot be used as a mode name because it conflicts with the .local postfix for .env files.');const t=s?Array.isArray(s)?s:[s]:[],u=Array.isArray(n)?n:[n],a={},l=u.reduce((e,i)=>(e.push(...getEnvFilesForMode(i,r).filter(c=>!e.includes(c))),e),[]);let o=(await Promise.all(l.map(e=>loadEnvFile(e)))).reduce((e,i)=>E(i,e),{});if(o.NODE_ENV&&process.env.VITE_USER_NODE_ENV===void 0&&(process.env.VITE_USER_NODE_ENV=p.stringify(o.NODE_ENV)),o.BROWSER&&process.env.BROWSER===void 0&&(process.env.BROWSER=p.stringify(o.BROWSER)),o.BROWSER_ARGS&&process.env.BROWSER_ARGS===void 0&&(process.env.BROWSER_ARGS=p.stringify(o.BROWSER_ARGS)),o=E({...process.env},o),t.length===0)return o;for(const[e,i]of Object.entries(o))t.some(c=>e.startsWith(c))&&(a[e]=String(i));for(const e in process.env)t.some(i=>e.startsWith(i))&&(a[e]=process.env[e]);return a}export async function loadClientEnv(n,r,s=m){return loadEnv(n,r,s)}export async function loadServerEnv(n,r){return loadEnv(n,r)}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.providerInfo = exports.provider = void 0;
|
|
7
|
+
const r = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", {
|
|
8
|
+
ci: !0
|
|
9
|
+
}], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", {
|
|
10
|
+
ci: !0
|
|
11
|
+
}], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", {
|
|
12
|
+
ci: !1
|
|
13
|
+
}], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", {
|
|
14
|
+
ci: !1
|
|
15
|
+
}], ["VERCEL", "VERCEL_ENV", {
|
|
16
|
+
ci: !1
|
|
17
|
+
}], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", {
|
|
18
|
+
ci: !1
|
|
19
|
+
}], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", {
|
|
20
|
+
ci: !0
|
|
21
|
+
}], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", {
|
|
22
|
+
ci: !0
|
|
23
|
+
}]];
|
|
24
|
+
function I() {
|
|
25
|
+
if (globalThis.process?.env) for (const e of r) {
|
|
26
|
+
const E = e[1] || e[0];
|
|
27
|
+
if (globalThis.process?.env[E]) return {
|
|
28
|
+
name: e[0].toLowerCase(),
|
|
29
|
+
...e[2]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
|
|
33
|
+
name: "stackblitz",
|
|
34
|
+
ci: !1
|
|
35
|
+
} : {
|
|
36
|
+
name: "",
|
|
37
|
+
ci: !1
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const providerInfo = exports.providerInfo = I(),
|
|
41
|
+
provider = exports.provider = providerInfo.name;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ProviderName = "" | "appveyor" | "aws_amplify" | "azure_pipelines" | "azure_static" | "appcircle" | "bamboo" | "bitbucket" | "bitrise" | "buddy" | "buildkite" | "circle" | "cirrus" | "cloudflare_pages" | "codebuild" | "codefresh" | "drone" | "drone" | "dsari" | "github_actions" | "gitlab" | "gocd" | "layerci" | "hudson" | "jenkins" | "magnum" | "netlify" | "nevercode" | "render" | "sail" | "semaphore" | "screwdriver" | "shippable" | "solano" | "strider" | "teamcity" | "travis" | "vercel" | "appcenter" | "codesandbox" | "stackblitz" | "stormkit" | "cleavr" | "zeabur" | "codesphere" | "railway" | "deno-deploy" | "firebase_app_hosting";
|
|
2
|
+
export type ProviderInfo = {
|
|
3
|
+
name: ProviderName;
|
|
4
|
+
ci?: boolean;
|
|
5
|
+
[meta: string]: any;
|
|
6
|
+
};
|
|
7
|
+
/** Current provider info */
|
|
8
|
+
export declare const providerInfo: ProviderInfo;
|
|
9
|
+
export declare const provider: ProviderName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function I(){if(globalThis.process?.env)for(const e of r){const E=e[1]||e[0];if(globalThis.process?.env[E])return{name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}export const providerInfo=I(),provider=providerInfo.name;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.runtimeInfo = exports.runtime = exports.isWorkerd = exports.isNode = exports.isNetlify = exports.isFastly = exports.isEdgeLight = exports.isDeno = exports.isBun = void 0;
|
|
7
|
+
const isNode = exports.isNode = globalThis.process?.release?.name === "node",
|
|
8
|
+
isBun = exports.isBun = !!globalThis.Bun || !!globalThis.process?.versions?.bun,
|
|
9
|
+
isDeno = exports.isDeno = !!globalThis.Deno,
|
|
10
|
+
isFastly = exports.isFastly = !!globalThis.fastly,
|
|
11
|
+
isNetlify = exports.isNetlify = !!globalThis.Netlify,
|
|
12
|
+
isEdgeLight = exports.isEdgeLight = !!globalThis.EdgeRuntime,
|
|
13
|
+
isWorkerd = exports.isWorkerd = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
14
|
+
const n = [[isNetlify, "netlify"], [isEdgeLight, "edge-light"], [isWorkerd, "workerd"], [isFastly, "fastly"], [isDeno, "deno"], [isBun, "bun"], [isNode, "node"]];
|
|
15
|
+
function t() {
|
|
16
|
+
const e = n.find(o => o[0]);
|
|
17
|
+
if (e) return {
|
|
18
|
+
name: e[1]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const runtimeInfo = exports.runtimeInfo = t(),
|
|
22
|
+
runtime = exports.runtime = runtimeInfo?.name || "";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type RuntimeName = "workerd" | "deno" | "netlify" | "node" | "bun" | "edge-light" | "fastly" | "";
|
|
2
|
+
export type RuntimeInfo = {
|
|
3
|
+
name: RuntimeName;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Indicates if running in Node.js or a Node.js compatible runtime.
|
|
7
|
+
*
|
|
8
|
+
* **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.
|
|
9
|
+
*
|
|
10
|
+
* Use `runtime === "node"` if you need strict check for Node.js runtime.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isNode: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Indicates if running in Bun runtime.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isBun: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates if running in Deno runtime.
|
|
19
|
+
*/
|
|
20
|
+
export declare const isDeno: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Indicates if running in Fastly runtime.
|
|
23
|
+
*/
|
|
24
|
+
export declare const isFastly: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates if running in Netlify runtime.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isNetlify: boolean;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* Indicates if running in EdgeLight (Vercel Edge) runtime.
|
|
32
|
+
*/
|
|
33
|
+
export declare const isEdgeLight: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates if running in Cloudflare Workers runtime.
|
|
36
|
+
*/
|
|
37
|
+
export declare const isWorkerd: boolean;
|
|
38
|
+
export declare const runtimeInfo: RuntimeInfo | undefined;
|
|
39
|
+
export declare const runtime: RuntimeName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isNode=globalThis.process?.release?.name==="node",isBun=!!globalThis.Bun||!!globalThis.process?.versions?.bun,isDeno=!!globalThis.Deno,isFastly=!!globalThis.fastly,isNetlify=!!globalThis.Netlify,isEdgeLight=!!globalThis.EdgeRuntime,isWorkerd=globalThis.navigator?.userAgent==="Cloudflare-Workers";const n=[[isNetlify,"netlify"],[isEdgeLight,"edge-light"],[isWorkerd,"workerd"],[isFastly,"fastly"],[isDeno,"deno"],[isBun,"bun"],[isNode,"node"]];function t(){const e=n.find(o=>o[0]);if(e)return{name:e[1]}}export const runtimeInfo=t(),runtime=runtimeInfo?.name||"";
|
package/dist/types.cjs
ADDED
package/dist/types.d.ts
ADDED
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ENV_PREFIXES=["VITE_","ONE_","STORM_PUBLIC_","STORM_","NEXT_PUBLIC_"];
|
package/package.json
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stryke/env",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A package containing utility functions to handle environment specific processes",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "github",
|
|
8
|
+
"url": "https://github.com/storm-software/stryke.git",
|
|
9
|
+
"directory": "packages/env"
|
|
10
|
+
},
|
|
11
|
+
"private": false,
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@dotenvx/dotenvx": "1.35.0",
|
|
14
|
+
"defu": "^6.1.4",
|
|
15
|
+
"@stryke/fs": ">=0.1.4",
|
|
16
|
+
"@stryke/json": ">=0.1.1",
|
|
17
|
+
"@stryke/path": ">=0.1.1",
|
|
18
|
+
"@stryke/string-format": ">=0.1.3",
|
|
19
|
+
"@stryke/types": ">=0.1.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": { "@types/node": "^22.13.1" },
|
|
22
|
+
"publishConfig": { "access": "public" },
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"files": ["dist/**/*"],
|
|
25
|
+
"homepage": "https://stormsoftware.com",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://stormsoftware.com/support",
|
|
28
|
+
"email": "support@stormsoftware.com"
|
|
29
|
+
},
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"keywords": [
|
|
32
|
+
"stryke",
|
|
33
|
+
"typescript",
|
|
34
|
+
"utilities",
|
|
35
|
+
"storm-stack",
|
|
36
|
+
"storm-software",
|
|
37
|
+
"storm",
|
|
38
|
+
"storm-ops",
|
|
39
|
+
"cyclone-ui",
|
|
40
|
+
"sullivanpj",
|
|
41
|
+
"monorepo"
|
|
42
|
+
],
|
|
43
|
+
"funding": {
|
|
44
|
+
"type": "github",
|
|
45
|
+
"url": "https://github.com/sponsors/storm-software"
|
|
46
|
+
},
|
|
47
|
+
"author": {
|
|
48
|
+
"name": "Storm Software",
|
|
49
|
+
"email": "contact@stormsoftware.com",
|
|
50
|
+
"url": "https://stormsoftware.com"
|
|
51
|
+
},
|
|
52
|
+
"maintainers": [
|
|
53
|
+
{
|
|
54
|
+
"name": "Storm Software",
|
|
55
|
+
"email": "contact@stormsoftware.com",
|
|
56
|
+
"url": "https://stormsoftware.com"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"contributors": [
|
|
60
|
+
{
|
|
61
|
+
"name": "Storm Software",
|
|
62
|
+
"email": "contact@stormsoftware.com",
|
|
63
|
+
"url": "https://stormsoftware.com"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"exports": {
|
|
67
|
+
"./types": {
|
|
68
|
+
"import": { "types": "./dist/types.d.ts", "default": "./dist/types.mjs" },
|
|
69
|
+
"require": {
|
|
70
|
+
"types": "./dist/types.d.ts",
|
|
71
|
+
"default": "./dist/types.cjs"
|
|
72
|
+
},
|
|
73
|
+
"default": { "types": "./dist/types.d.ts", "default": "./dist/types.mjs" }
|
|
74
|
+
},
|
|
75
|
+
"./runtime-checks": {
|
|
76
|
+
"import": {
|
|
77
|
+
"types": "./dist/runtime-checks.d.ts",
|
|
78
|
+
"default": "./dist/runtime-checks.mjs"
|
|
79
|
+
},
|
|
80
|
+
"require": {
|
|
81
|
+
"types": "./dist/runtime-checks.d.ts",
|
|
82
|
+
"default": "./dist/runtime-checks.cjs"
|
|
83
|
+
},
|
|
84
|
+
"default": {
|
|
85
|
+
"types": "./dist/runtime-checks.d.ts",
|
|
86
|
+
"default": "./dist/runtime-checks.mjs"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"./providers": {
|
|
90
|
+
"import": {
|
|
91
|
+
"types": "./dist/providers.d.ts",
|
|
92
|
+
"default": "./dist/providers.mjs"
|
|
93
|
+
},
|
|
94
|
+
"require": {
|
|
95
|
+
"types": "./dist/providers.d.ts",
|
|
96
|
+
"default": "./dist/providers.cjs"
|
|
97
|
+
},
|
|
98
|
+
"default": {
|
|
99
|
+
"types": "./dist/providers.d.ts",
|
|
100
|
+
"default": "./dist/providers.mjs"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"./load-env": {
|
|
104
|
+
"import": {
|
|
105
|
+
"types": "./dist/load-env.d.ts",
|
|
106
|
+
"default": "./dist/load-env.mjs"
|
|
107
|
+
},
|
|
108
|
+
"require": {
|
|
109
|
+
"types": "./dist/load-env.d.ts",
|
|
110
|
+
"default": "./dist/load-env.cjs"
|
|
111
|
+
},
|
|
112
|
+
"default": {
|
|
113
|
+
"types": "./dist/load-env.d.ts",
|
|
114
|
+
"default": "./dist/load-env.mjs"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"./index": {
|
|
118
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
|
|
119
|
+
"require": {
|
|
120
|
+
"types": "./dist/index.d.ts",
|
|
121
|
+
"default": "./dist/index.cjs"
|
|
122
|
+
},
|
|
123
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
|
|
124
|
+
},
|
|
125
|
+
"./get-env-paths": {
|
|
126
|
+
"import": {
|
|
127
|
+
"types": "./dist/get-env-paths.d.ts",
|
|
128
|
+
"default": "./dist/get-env-paths.mjs"
|
|
129
|
+
},
|
|
130
|
+
"require": {
|
|
131
|
+
"types": "./dist/get-env-paths.d.ts",
|
|
132
|
+
"default": "./dist/get-env-paths.cjs"
|
|
133
|
+
},
|
|
134
|
+
"default": {
|
|
135
|
+
"types": "./dist/get-env-paths.d.ts",
|
|
136
|
+
"default": "./dist/get-env-paths.mjs"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"./environment-checks": {
|
|
140
|
+
"import": {
|
|
141
|
+
"types": "./dist/environment-checks.d.ts",
|
|
142
|
+
"default": "./dist/environment-checks.mjs"
|
|
143
|
+
},
|
|
144
|
+
"require": {
|
|
145
|
+
"types": "./dist/environment-checks.d.ts",
|
|
146
|
+
"default": "./dist/environment-checks.cjs"
|
|
147
|
+
},
|
|
148
|
+
"default": {
|
|
149
|
+
"types": "./dist/environment-checks.d.ts",
|
|
150
|
+
"default": "./dist/environment-checks.mjs"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"./ci-checks": {
|
|
154
|
+
"import": {
|
|
155
|
+
"types": "./dist/ci-checks.d.ts",
|
|
156
|
+
"default": "./dist/ci-checks.mjs"
|
|
157
|
+
},
|
|
158
|
+
"require": {
|
|
159
|
+
"types": "./dist/ci-checks.d.ts",
|
|
160
|
+
"default": "./dist/ci-checks.cjs"
|
|
161
|
+
},
|
|
162
|
+
"default": {
|
|
163
|
+
"types": "./dist/ci-checks.d.ts",
|
|
164
|
+
"default": "./dist/ci-checks.mjs"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
".": {
|
|
168
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
|
|
169
|
+
"require": {
|
|
170
|
+
"types": "./dist/index.d.ts",
|
|
171
|
+
"default": "./dist/index.cjs"
|
|
172
|
+
},
|
|
173
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
|
|
174
|
+
},
|
|
175
|
+
"./package.json": "./package.json"
|
|
176
|
+
},
|
|
177
|
+
"main": "./dist/index.cjs",
|
|
178
|
+
"module": "./dist/index.mjs",
|
|
179
|
+
"types": "./dist/index.d.ts"
|
|
180
|
+
}
|