@kevinpatil/envguard 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +12 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  // src/index.ts
27
27
  var import_commander = require("commander");
28
28
  var import_path = __toESM(require("path"));
29
+ var import_fs2 = __toESM(require("fs"));
29
30
 
30
31
  // src/parser.ts
31
32
  var import_fs = __toESM(require("fs"));
@@ -292,9 +293,19 @@ function report(results, options = {}) {
292
293
 
293
294
  // src/index.ts
294
295
  var program = new import_commander.Command();
295
- program.name("envguard").description("Validate .env files against .env.example before your app ships").version("1.0.0").option("--env <file>", "path to .env file", ".env").option("--example <file>", "path to .env.example file", ".env.example").option("--strict", "exit with code 1 if any errors are found").option("--json", "output results as JSON").action((options) => {
296
+ program.name("envguard").description("Validate .env files against .env.example before your app ships").version("1.0.1").option("--env <file>", "path to .env file", ".env").option("--example <file>", "path to .env.example file", ".env.example").option("--strict", "exit with code 1 if any errors are found").option("--json", "output results as JSON").action((options) => {
296
297
  const envPath = import_path.default.resolve(process.cwd(), options.env);
297
298
  const examplePath = import_path.default.resolve(process.cwd(), options.example);
299
+ if (!import_fs2.default.existsSync(envPath)) {
300
+ console.error(`Error: ${options.env} not found in ${process.cwd()}`);
301
+ console.error(`Tip: Create a .env file or use --env to point to one.`);
302
+ process.exit(1);
303
+ }
304
+ if (!import_fs2.default.existsSync(examplePath)) {
305
+ console.error(`Error: ${options.example} not found in ${process.cwd()}`);
306
+ console.error(`Tip: Create a .env.example file or use --example to point to one.`);
307
+ process.exit(1);
308
+ }
298
309
  const env = parseEnvFile(envPath);
299
310
  const example = parseEnvExample(examplePath);
300
311
  const results = validate(env, example);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevinpatil/envguard",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "CLI tool that validates .env files against .env.example before your app ships",
5
5
  "main": "dist/index.js",
6
6
  "bin": {