@firtoz/worker-helper 1.5.0 → 1.5.1
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/CHANGELOG.md +6 -0
- package/package.json +3 -3
- package/src/utils/prepare-env.ts +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @firtoz/worker-helper
|
|
2
2
|
|
|
3
|
+
## 1.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#60](https://github.com/firtoz/fullstack-toolkit/pull/60) [`f887a36`](https://github.com/firtoz/fullstack-toolkit/commit/f887a3683bfc1e3db3db0e399c1494755af4008c) Thanks [@firtoz](https://github.com/firtoz)! - `prepareEnvFiles` no longer copies `.env.example` / `.env.local.example` to real env files when `CI` or `GITHUB_ACTIONS` is set, so CI typegen does not create or rely on generated `.env` files.
|
|
8
|
+
|
|
3
9
|
## 1.5.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firtoz/worker-helper",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Type-safe Web Worker helper with Zod validation and Cloudflare Workers utilities (cf-typegen)",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"module": "./src/index.ts",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"zod": "^4.3.6"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@types/node": "^25.
|
|
70
|
+
"@types/node": "^25.5.0",
|
|
71
71
|
"@firtoz/maybe-error": "^1.5.2",
|
|
72
|
-
"bun-types": "^1.3.
|
|
72
|
+
"bun-types": "^1.3.11"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/utils/prepare-env.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
|
|
5
|
+
function isCiEnvironment(): boolean {
|
|
6
|
+
return Boolean(process.env.CI) || process.env.GITHUB_ACTIONS === "true";
|
|
7
|
+
}
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* Ensures a .env and .env.local file exists in the target directory.
|
|
6
11
|
* If it doesn't exist, copies from .env.example and .env.local.example.
|
|
7
12
|
*
|
|
13
|
+
* In CI, does not create those files — typegen uses `.env.example` / `.env.local.example` only when real files are absent.
|
|
14
|
+
*
|
|
8
15
|
* @param targetDir - The directory where the .env and .env.local files should exist
|
|
9
16
|
* @returns An array of the files that were created or already existed
|
|
10
17
|
*/
|
|
@@ -21,7 +28,9 @@ export function prepareEnvFiles(targetDir: string): string[] {
|
|
|
21
28
|
let envExists = fs.existsSync(envPath);
|
|
22
29
|
let envLocalExists = fs.existsSync(envLocalPath);
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
const allowCopies = !isCiEnvironment();
|
|
32
|
+
|
|
33
|
+
if (allowCopies && exampleEnvExists) {
|
|
25
34
|
if (!envExists) {
|
|
26
35
|
fs.cpSync(exampleEnvPath, envPath);
|
|
27
36
|
|
|
@@ -30,7 +39,7 @@ export function prepareEnvFiles(targetDir: string): string[] {
|
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
41
|
|
|
33
|
-
if (exampleLocalEnvExists) {
|
|
42
|
+
if (allowCopies && exampleLocalEnvExists) {
|
|
34
43
|
if (!envLocalExists) {
|
|
35
44
|
fs.cpSync(exampleEnvLocalPath, envLocalPath);
|
|
36
45
|
|