envstash-cli 0.4.0 → 0.4.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/README.md +3 -2
- package/package.json +1 -1
- package/src/blob.mjs +8 -6
- package/src/ui.mjs +16 -0
package/README.md
CHANGED
|
@@ -177,8 +177,9 @@ Monorepos can track nested paths by listing them explicitly:
|
|
|
177
177
|
|
|
178
178
|
## Opaque files (service-account keys, certs)
|
|
179
179
|
|
|
180
|
-
A tracked name whose basename is not `.env
|
|
181
|
-
one encrypted file, rather than parsed into keys
|
|
180
|
+
A tracked name whose basename is not `.env`, `.env.*`, or `*.env` is stored
|
|
181
|
+
**whole**, as one encrypted file, rather than parsed into keys — dotenv-shaped
|
|
182
|
+
names, including the `.config/auth.env` convention, are parsed instead:
|
|
182
183
|
|
|
183
184
|
```json
|
|
184
185
|
{ "project": "demo-app", "files": [".env", ".config/service-account.json"] }
|
package/package.json
CHANGED
package/src/blob.mjs
CHANGED
|
@@ -2,15 +2,17 @@ import { createHash } from 'node:crypto'
|
|
|
2
2
|
import { basename } from 'node:path'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* How a tracked name is classified when the cloud has no say yet: `.env
|
|
6
|
-
* `.env
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* How a tracked name is classified when the cloud has no say yet: `.env`,
|
|
6
|
+
* `.env.*`, and `*.env` basenames are dotenv files parsed into keys — the
|
|
7
|
+
* trailing form covers the `.config/auth.env` convention, which is KEY=value
|
|
8
|
+
* content under a descriptive name. Everything else — a service-account JSON,
|
|
9
|
+
* a cert — is an opaque file stored whole. For names the cloud already knows,
|
|
10
|
+
* its recorded kind wins; this function only decides the kind of a file's
|
|
11
|
+
* first push.
|
|
10
12
|
*/
|
|
11
13
|
export function isEnvName(name) {
|
|
12
14
|
const base = basename(name)
|
|
13
|
-
return base === '.env' || base.startsWith('.env.')
|
|
15
|
+
return base === '.env' || base.startsWith('.env.') || base.endsWith('.env')
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/**
|
package/src/ui.mjs
CHANGED
|
@@ -32,6 +32,22 @@ export const style = {
|
|
|
32
32
|
cyan: wrap(36, 39),
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* `envs status | head` closes stdout after a few lines, and every write after
|
|
37
|
+
* that raises EPIPE — which Node treats as a crash, stack trace and all. A
|
|
38
|
+
* closed pipe is the reader saying "I have enough", not a failure, so leave
|
|
39
|
+
* the way a SIGPIPE-terminated process would: immediately and silently.
|
|
40
|
+
*/
|
|
41
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
42
|
+
stream.on('error', error => {
|
|
43
|
+
if (error?.code === 'EPIPE') {
|
|
44
|
+
process.exit(0)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
throw error
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
35
51
|
export function out(message = '') {
|
|
36
52
|
process.stdout.write(`${message}\n`)
|
|
37
53
|
}
|