@penvhq/cli 0.3.0 → 0.3.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/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
package/dist/index.js
CHANGED
|
@@ -683,15 +683,16 @@ import { pathToFileURL as pathToFileURL2 } from "url";
|
|
|
683
683
|
import {
|
|
684
684
|
accessPath as accessPath2,
|
|
685
685
|
checkNameCollisions as checkNameCollisions2,
|
|
686
|
+
jitiFor,
|
|
686
687
|
NameCollisionError,
|
|
687
688
|
PenvError as PenvError5,
|
|
688
689
|
ReservedTokenError as ReservedTokenError2,
|
|
689
690
|
resolveAll,
|
|
691
|
+
SCHEMA_HARVEST_ENV,
|
|
690
692
|
schemaFileOf,
|
|
691
693
|
validateConfig
|
|
692
694
|
} from "@penvhq/core";
|
|
693
695
|
import { defineCommand as defineCommand2 } from "citty";
|
|
694
|
-
import { createJiti } from "jiti";
|
|
695
696
|
var SCHEMA_EXPORT = "schema";
|
|
696
697
|
var LABELS = {
|
|
697
698
|
config: "Config",
|
|
@@ -770,9 +771,11 @@ function loadSchema(project, environment) {
|
|
|
770
771
|
return exclusively(() => loadSchemaExclusively(file, schemaPath, environment));
|
|
771
772
|
}
|
|
772
773
|
async function loadSchemaExclusively(file, schemaPath, environment) {
|
|
773
|
-
const jiti =
|
|
774
|
+
const jiti = jitiFor(file);
|
|
774
775
|
const previous = process.env.PENV_ENV;
|
|
776
|
+
const previousHarvest = process.env[SCHEMA_HARVEST_ENV];
|
|
775
777
|
process.env.PENV_ENV = environment;
|
|
778
|
+
process.env[SCHEMA_HARVEST_ENV] = "1";
|
|
776
779
|
let loaded;
|
|
777
780
|
try {
|
|
778
781
|
loaded = await jiti.import(file);
|
|
@@ -798,6 +801,11 @@ async function loadSchemaExclusively(file, schemaPath, environment) {
|
|
|
798
801
|
} else {
|
|
799
802
|
process.env.PENV_ENV = previous;
|
|
800
803
|
}
|
|
804
|
+
if (previousHarvest === void 0) {
|
|
805
|
+
delete process.env[SCHEMA_HARVEST_ENV];
|
|
806
|
+
} else {
|
|
807
|
+
process.env[SCHEMA_HARVEST_ENV] = previousHarvest;
|
|
808
|
+
}
|
|
801
809
|
}
|
|
802
810
|
const exported = typeof loaded === "object" && loaded !== null ? loaded[SCHEMA_EXPORT] : void 0;
|
|
803
811
|
if (!isZodType(exported)) {
|