@envin/cli 0.0.1 → 1.1.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 +32 -0
- package/README.md +95 -0
- package/dist/cli/index.mjs +464 -55
- package/dist/preview/.next/BUILD_ID +1 -1
- package/dist/preview/.next/app-build-manifest.json +6 -6
- package/dist/preview/.next/build-manifest.json +5 -5
- package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/preview/.next/next-server.js.nft.json +1 -1
- package/dist/preview/.next/prerender-manifest.json +3 -3
- package/dist/preview/.next/required-server-files.json +1 -1
- package/dist/preview/.next/server/app/_not-found/page.js +1 -1
- package/dist/preview/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/preview/.next/server/app/_not-found.html +1 -1
- package/dist/preview/.next/server/app/_not-found.rsc +2 -2
- package/dist/preview/.next/server/app/favicon.ico/route.js +1 -1
- package/dist/preview/.next/server/app/index.html +1 -1
- package/dist/preview/.next/server/app/index.rsc +3 -3
- package/dist/preview/.next/server/app/page.js +8 -7
- package/dist/preview/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/preview/.next/server/chunks/191.js +10 -10
- package/dist/preview/.next/server/chunks/496.js +3 -3
- package/dist/preview/.next/server/chunks/601.js +4 -4
- package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
- package/dist/preview/.next/server/pages/404.html +1 -1
- package/dist/preview/.next/server/pages/500.html +1 -1
- package/dist/preview/.next/server/pages/_app.js +1 -1
- package/dist/preview/.next/server/pages/_document.js +1 -1
- package/dist/preview/.next/server/pages/_error.js +1 -1
- package/dist/preview/.next/server/server-reference-manifest.js +1 -1
- package/dist/preview/.next/server/server-reference-manifest.json +1 -1
- package/dist/preview/.next/server/webpack-runtime.js +1 -1
- package/dist/preview/.next/static/chunks/985-f32f025f8cdc74d3.js +1 -0
- package/dist/preview/.next/static/chunks/app/page-781d5c4076d3b10d.js +1 -0
- package/dist/preview/.next/static/chunks/webpack-464ea5083b838c17.js +1 -0
- package/dist/preview/.next/static/css/8b2927e38b2520cf.css +3 -0
- package/dist/preview/.next/trace +14 -13
- package/package.json +17 -6
- package/src/app/page.tsx +11 -2
- package/src/components/variables/context.tsx +30 -18
- package/src/lib/config.ts +1 -18
- package/src/lib/hooks/use-hot-reload.ts +31 -0
- package/src/lib/types.ts +10 -0
- package/src/lib/validate.ts +3 -1
- package/src/lib/variables/index.ts +28 -6
- package/src/utils/get-config-file.ts +2 -0
- package/dist/preview/.next/static/chunks/174-5a80ff32c1746c12.js +0 -1
- package/dist/preview/.next/static/chunks/app/page-5dac690b5d4c8e8b.js +0 -1
- package/dist/preview/.next/static/chunks/webpack-e84142516ca52ef7.js +0 -1
- package/dist/preview/.next/static/css/6842db20c57f3076.css +0 -3
- /package/dist/preview/.next/static/{v9TlUn5liPNhAPJYeB3QH → ti02qYR7TtWD2j2orEzoT}/_buildManifest.js +0 -0
- /package/dist/preview/.next/static/{v9TlUn5liPNhAPJYeB3QH → ti02qYR7TtWD2j2orEzoT}/_ssgManifest.js +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @envin/cli
|
|
2
|
+
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#22](https://github.com/turbostarter/envin/pull/22) [`5d278e1`](https://github.com/turbostarter/envin/commit/5d278e16b0ad7557c021bfd445ce0527727125c2) Thanks [@Bartek532](https://github.com/Bartek532)! - Minor enhancements and fixes
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`5d278e1`](https://github.com/turbostarter/envin/commit/5d278e16b0ad7557c021bfd445ce0527727125c2)]:
|
|
10
|
+
- envin@1.1.1
|
|
11
|
+
|
|
12
|
+
## 1.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#20](https://github.com/turbostarter/envin/pull/20) [`bd7f32f`](https://github.com/turbostarter/envin/commit/bd7f32fd796af56ffa0bdb986c681a9c9d41a8d3) Thanks [@Bartek532](https://github.com/Bartek532)! - Setup hot reloading for live preview
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`bd7f32f`](https://github.com/turbostarter/envin/commit/bd7f32fd796af56ffa0bdb986c681a9c9d41a8d3)]:
|
|
21
|
+
- envin@1.1.0
|
|
22
|
+
|
|
23
|
+
## 1.0.0
|
|
24
|
+
|
|
25
|
+
### Major Changes
|
|
26
|
+
|
|
27
|
+
- [`a0c59f1`](https://github.com/turbostarter/envin/commit/a0c59f1a12f8ad08096fcb68548cae7c622e8acf) Thanks [@Bartek532](https://github.com/Bartek532)! - Prepare documentation for the first release
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`a0c59f1`](https://github.com/turbostarter/envin/commit/a0c59f1a12f8ad08096fcb68548cae7c622e8acf)]:
|
|
32
|
+
- envin@1.0.0
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
> [!NOTE]
|
|
6
|
+
>
|
|
7
|
+
> This is an ESM only package that requires a tsconfig with a module resolution that can read package.json#exports (`NodeNext` if transpiling with `tsc`, `Bundler` if using a bundler).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Core package, no framework specific features
|
|
11
|
+
bun add envin
|
|
12
|
+
|
|
13
|
+
# CLI, used e.g. for live previews
|
|
14
|
+
bun add @envin/cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
For full documentation, see https://envin.turbostarter.dev
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
> [!NOTE]
|
|
22
|
+
>
|
|
23
|
+
> You may use any [Standard Schema](https://github.com/standard-schema/standard-schema) compliant validator of your choice.
|
|
24
|
+
|
|
25
|
+
This package supports the full power of [most popular schema libraries](https://github.com/standard-schema/standard-schema?tab=readme-ov-file#what-schema-libraries-implement-the-spec), meaning you can use `transforms` and `default` values.
|
|
26
|
+
|
|
27
|
+
### Define your schema
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// env.config.ts
|
|
31
|
+
import { defineEnv } from "envin";
|
|
32
|
+
import { z } from "zod";
|
|
33
|
+
|
|
34
|
+
export default defineEnv({
|
|
35
|
+
/*
|
|
36
|
+
* Shared environment variables, available on the client and server.
|
|
37
|
+
*/
|
|
38
|
+
shared: {
|
|
39
|
+
NODE_ENV: z.enum(["development", "production"]).default("development"),
|
|
40
|
+
},
|
|
41
|
+
/*
|
|
42
|
+
* Prefix for client environment variables.
|
|
43
|
+
*/
|
|
44
|
+
clientPrefix: "NEXT_PUBLIC_",
|
|
45
|
+
/*
|
|
46
|
+
* Environment variables available on the client (and server).
|
|
47
|
+
*
|
|
48
|
+
* 💡 You'll get type errors if these are not prefixed with NEXT_PUBLIC_.
|
|
49
|
+
*/
|
|
50
|
+
client: {
|
|
51
|
+
NEXT_PUBLIC_API_URL: z.string().url(),
|
|
52
|
+
},
|
|
53
|
+
/*
|
|
54
|
+
* Serverside Environment variables, not available on the client.
|
|
55
|
+
* Will throw if you access these variables on the client.
|
|
56
|
+
*/
|
|
57
|
+
server: {
|
|
58
|
+
DATABASE_URL: z.string().url(),
|
|
59
|
+
},
|
|
60
|
+
/*
|
|
61
|
+
* In some cases, we need to manually destructure environment variables to make sure all are included in bundle.
|
|
62
|
+
*
|
|
63
|
+
* 💡 You'll get type errors if not all variables are included here.
|
|
64
|
+
*/
|
|
65
|
+
envStrict: {
|
|
66
|
+
DATABASE_URL: process.env.DATABASE_URL,
|
|
67
|
+
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Use the schema in your app with autocompletion and type inference
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
// route.ts
|
|
76
|
+
import env from "~/env.config";
|
|
77
|
+
|
|
78
|
+
export const GET = (req: Request) => {
|
|
79
|
+
const DATABASE_URL = env.DATABASE_URL;
|
|
80
|
+
// use it...
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Live Preview
|
|
85
|
+
|
|
86
|
+
One of the most powerful features of this package is the ability to preview your environment variables in a livemode.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Run the CLI with your env.config.ts file
|
|
90
|
+
npx @envin/cli@latest dev
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
This will start a live preview server that will automatically update your environment variables when you change them allowing you to find and fix errors before deploying your app.
|