docker-react 0.1.0-modernization-hotfix.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +11 -14
  2. package/dist/prep.js +5 -9
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -21,14 +21,11 @@ CLI & base image to deploy React applications with docker containers.
21
21
 
22
22
  ## Supported Tooling
23
23
 
24
- - [ ] Create React App
25
- - [x] Vite
26
- - [ ] React Static
24
+ - Vite
27
25
 
28
26
  ## Supported Validation
29
27
 
30
- - [x] Joi
31
- - [ ] Yup
28
+ - Zod
32
29
 
33
30
  ## Other TODOs
34
31
 
@@ -43,23 +40,23 @@ CLI & base image to deploy React applications with docker containers.
43
40
 
44
41
  ## Implementation Instructions
45
42
 
46
- 1. Install `docker-react` and `joi`
43
+ 1. Install `docker-react` and `zod` (zod version should match the peer dependency version exactly)
47
44
 
48
45
  ```sh
49
- npm i -S docker-react joi
46
+ npm i -S docker-react zod@4.1.12
50
47
  ```
51
48
 
52
- 2. Create environment variable schema (currently only Joi supported but the future others will be available)
49
+ 2. Create environment variable schema (currently only Zod supported but the future others will be available)
53
50
 
54
51
  ```js
55
52
  // env.schema.js
56
- const Joi = require('joi');
53
+ const { z } = require('zod');
57
54
 
58
- module.exports = Joi.object()
59
- .keys({
60
- VITE_API_URL: Joi.string().uri().required(),
61
- })
62
- .required();
55
+ const envSchema = z.object({
56
+ VITE_API_URL: z.string().uri().required(),
57
+ });
58
+
59
+ module.exports = envSchema;
63
60
  ```
64
61
 
65
62
  3. Add env import to your `index.html` head (in a future version this will be generated for you)
package/dist/prep.js CHANGED
@@ -1,5 +1,5 @@
1
- import path from 'path';
2
1
  import { promises as fs } from 'fs';
2
+ import path from 'path';
3
3
  const ENVIRONMENT_DEFINITION_FILE_NAME = 'window.env.js';
4
4
  export function addPrepCommand(program) {
5
5
  return program
@@ -13,15 +13,11 @@ export function addPrepCommand(program) {
13
13
  });
14
14
  }
15
15
  function validateEnvironmentVariables(schema, environmentVariables) {
16
- const joiResult = schema.validate(environmentVariables, {
17
- allowUnknown: true,
18
- abortEarly: false,
19
- stripUnknown: true,
20
- });
21
- if (joiResult.error) {
22
- throw new Error(joiResult.error.message);
16
+ const zodResult = schema.safeParse(environmentVariables);
17
+ if (zodResult.error) {
18
+ throw new Error(zodResult.error.message);
23
19
  }
24
- return joiResult.value;
20
+ return zodResult.data;
25
21
  }
26
22
  async function generateEnvironmentFile(schemaPath, destinationPath) {
27
23
  // Perform environment variable validation.
package/package.json CHANGED
@@ -31,10 +31,10 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "commander": "^14.0.2",
34
- "joi": "^17.5.0"
34
+ "zod": "4.1.12"
35
35
  },
36
36
  "peerDependencies": {
37
- "joi": "^17.5.0"
37
+ "zod": "4.1.12"
38
38
  },
39
- "version": "0.1.0-modernization-hotfix.0"
39
+ "version": "0.1.0"
40
40
  }