envlock-core 0.1.0 → 0.2.0
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 +17 -15
- package/dist/index.d.ts +13 -12
- package/dist/index.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Framework-agnostic 1Password + dotenvx secret injection logic.
|
|
4
4
|
|
|
5
|
-
> Most users should install [`envlock`](https://www.npmjs.com/package/envlock) instead. This package is for integrating envlock with frameworks other than Next.js.
|
|
5
|
+
> Most users should install [`envlock-next`](https://www.npmjs.com/package/envlock-next) instead. This package is for integrating envlock with frameworks other than Next.js.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -30,13 +30,13 @@ runWithSecrets({
|
|
|
30
30
|
|
|
31
31
|
**Options:**
|
|
32
32
|
|
|
33
|
-
| Option
|
|
34
|
-
|
|
35
|
-
| `envFile`
|
|
36
|
-
| `environment`
|
|
37
|
-
| `onePasswordEnvId` | `string`
|
|
38
|
-
| `command`
|
|
39
|
-
| `args`
|
|
33
|
+
| Option | Type | Description |
|
|
34
|
+
| ------------------ | ------------- | --------------------------------------------------------- |
|
|
35
|
+
| `envFile` | `string` | Path to the encrypted dotenvx env file |
|
|
36
|
+
| `environment` | `Environment` | Environment name (`development`, `staging`, `production`) |
|
|
37
|
+
| `onePasswordEnvId` | `string` | Your 1Password Environment ID |
|
|
38
|
+
| `command` | `string` | The command to run |
|
|
39
|
+
| `args` | `string[]` | Arguments to pass to the command |
|
|
40
40
|
|
|
41
41
|
### `validateOnePasswordEnvId(id)`
|
|
42
42
|
|
|
@@ -57,20 +57,22 @@ Calls `process.exit(1)` with a helpful message if `name` is not in `PATH`.
|
|
|
57
57
|
## Types
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
|
-
|
|
60
|
+
const ENVIRONMENTS = {
|
|
61
|
+
development: 'development',
|
|
62
|
+
staging: 'staging',
|
|
63
|
+
production: 'production',
|
|
64
|
+
} as const;
|
|
65
|
+
|
|
66
|
+
type Environment = keyof typeof ENVIRONMENTS;
|
|
61
67
|
|
|
62
68
|
interface EnvlockOptions {
|
|
63
69
|
onePasswordEnvId: string;
|
|
64
|
-
envFiles?:
|
|
65
|
-
development?: string;
|
|
66
|
-
staging?: string;
|
|
67
|
-
production?: string;
|
|
68
|
-
};
|
|
70
|
+
envFiles?: Partial<Record<Environment, string>>;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
interface RunWithSecretsOptions {
|
|
72
74
|
envFile: string;
|
|
73
|
-
environment:
|
|
75
|
+
environment: Environment;
|
|
74
76
|
onePasswordEnvId: string;
|
|
75
77
|
command: string;
|
|
76
78
|
args: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
declare const ENVIRONMENTS: {
|
|
2
|
+
readonly development: "development";
|
|
3
|
+
readonly staging: "staging";
|
|
4
|
+
readonly production: "production";
|
|
5
|
+
};
|
|
6
|
+
type Environment = keyof typeof ENVIRONMENTS;
|
|
7
|
+
interface EnvlockOptions {
|
|
8
|
+
onePasswordEnvId: string;
|
|
9
|
+
envFiles?: Partial<Record<Environment, string>>;
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
interface RunWithSecretsOptions {
|
|
2
13
|
envFile: string;
|
|
3
|
-
environment:
|
|
14
|
+
environment: Environment;
|
|
4
15
|
onePasswordEnvId: string;
|
|
5
16
|
command: string;
|
|
6
17
|
args: string[];
|
|
@@ -13,14 +24,4 @@ declare function checkBinary(name: string, installHint: string): void;
|
|
|
13
24
|
declare function validateOnePasswordEnvId(id: string): void;
|
|
14
25
|
declare function validateEnvFilePath(envFile: string, cwd: string): void;
|
|
15
26
|
|
|
16
|
-
type Environment
|
|
17
|
-
interface EnvlockOptions {
|
|
18
|
-
onePasswordEnvId: string;
|
|
19
|
-
envFiles?: {
|
|
20
|
-
development?: string;
|
|
21
|
-
staging?: string;
|
|
22
|
-
production?: string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { type Environment, type EnvlockOptions, type RunWithSecretsOptions, checkBinary, hasBinary, runWithSecrets, validateEnvFilePath, validateOnePasswordEnvId };
|
|
27
|
+
export { ENVIRONMENTS, type Environment, type EnvlockOptions, type RunWithSecretsOptions, checkBinary, hasBinary, runWithSecrets, validateEnvFilePath, validateOnePasswordEnvId };
|
package/dist/index.js
CHANGED
|
@@ -85,7 +85,15 @@ function validateEnvFilePath(envFile, cwd) {
|
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
|
|
89
|
+
// src/types.ts
|
|
90
|
+
var ENVIRONMENTS = {
|
|
91
|
+
development: "development",
|
|
92
|
+
staging: "staging",
|
|
93
|
+
production: "production"
|
|
94
|
+
};
|
|
88
95
|
export {
|
|
96
|
+
ENVIRONMENTS,
|
|
89
97
|
checkBinary,
|
|
90
98
|
hasBinary,
|
|
91
99
|
runWithSecrets,
|