@karmaniverous/get-dotenv 3.1.5 → 3.1.6

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.
@@ -116,7 +116,7 @@ const getDotenvCli = function () {
116
116
  isDefault: true
117
117
  }).hook('preSubcommand', async thisCommand => {
118
118
  const rawOptions = thisCommand.opts();
119
- if (rawOptions.debug) logger('\n*** raw options ***\n', {
119
+ if (rawOptions.debug) logger('\n*** raw cli options ***\n', {
120
120
  rawOptions
121
121
  });
122
122
 
@@ -146,14 +146,14 @@ const getDotenvCli = function () {
146
146
  cliOptions.excludePublic = resolveExclusionAll(cliOptions.excludePublic, excludePublicOff, excludePublic);
147
147
  cliOptions.log = resolveExclusion(cliOptions.log, logOff, log);
148
148
  cliOptions.loadProcess = resolveExclusion(cliOptions.loadProcess, loadProcessOff, loadProcess);
149
- if (cliOptions.debug) logger('\n*** after default resolution ***\n', {
149
+ if (cliOptions.debug) logger('\n*** cli options after default resolution ***\n', {
150
150
  cliOptions
151
151
  });
152
152
 
153
153
  // Execute pre-hook.
154
154
  if (preHook) {
155
155
  cliOptions = (await preHook(cliOptions)) ?? cliOptions;
156
- if (cliOptions.debug) logger('\n*** after pre-hook ***\n', cliOptions);
156
+ if (cliOptions.debug) logger('\n*** cli options after pre-hook ***\n', cliOptions);
157
157
  }
158
158
 
159
159
  // Get getdotenv options from parent command.
@@ -163,23 +163,24 @@ const getDotenvCli = function () {
163
163
  ...parentGetdotenvOptions,
164
164
  ...cliGetdotenvOptions
165
165
  };
166
- if (cliOptions.debug) logger('\n*** after getdotenv option resolution ***\n', {
166
+ if (cliOptions.debug) logger('\n*** getdotenv option resolution ***\n', {
167
167
  parentGetdotenvOptions,
168
168
  cliGetdotenvOptions,
169
169
  getdotenvOptions
170
170
  });
171
171
 
172
172
  // Execute getdotenv.
173
- const dotenv = await (0, _getDotenv.getDotenv)({
173
+ thisCommand.getdotenvOptions = {
174
174
  ...getdotenvOptions,
175
175
  logger
176
- });
177
- if (cliOptions.debug) console.log('\n*** after getdotenv execution ***\n', {
178
- dotenv
176
+ };
177
+ thisCommand.dotenv = await (0, _getDotenv.getDotenv)(thisCommand.getdotenvOptions);
178
+ if (cliOptions.debug) console.log('\n*** resulting dotenv values ***\n', {
179
+ dotenv: thisCommand.dotenv
179
180
  });
180
181
 
181
182
  // Execute post-hook.
182
- if (postHook) await postHook(dotenv);
183
+ if (postHook) await postHook(thisCommand.dotenv);
183
184
 
184
185
  // Execute shell command.
185
186
  if (command) await (0, _execa.execaCommand)(command.replace(/ /g, '\\ '), {
@@ -338,7 +338,8 @@ export const getDotenvCli = ({
338
338
  .hook('preSubcommand', async (thisCommand) => {
339
339
  const rawOptions = thisCommand.opts();
340
340
 
341
- if (rawOptions.debug) logger('\n*** raw options ***\n', { rawOptions });
341
+ if (rawOptions.debug)
342
+ logger('\n*** raw cli options ***\n', { rawOptions });
342
343
 
343
344
  // Load options.
344
345
  let {
@@ -407,12 +408,15 @@ export const getDotenvCli = ({
407
408
  );
408
409
 
409
410
  if (cliOptions.debug)
410
- logger('\n*** after default resolution ***\n', { cliOptions });
411
+ logger('\n*** cli options after default resolution ***\n', {
412
+ cliOptions,
413
+ });
411
414
 
412
415
  // Execute pre-hook.
413
416
  if (preHook) {
414
417
  cliOptions = (await preHook(cliOptions)) ?? cliOptions;
415
- if (cliOptions.debug) logger('\n*** after pre-hook ***\n', cliOptions);
418
+ if (cliOptions.debug)
419
+ logger('\n*** cli options after pre-hook ***\n', cliOptions);
416
420
  }
417
421
 
418
422
  // Get getdotenv options from parent command.
@@ -428,20 +432,26 @@ export const getDotenvCli = ({
428
432
  };
429
433
 
430
434
  if (cliOptions.debug)
431
- logger('\n*** after getdotenv option resolution ***\n', {
435
+ logger('\n*** getdotenv option resolution ***\n', {
432
436
  parentGetdotenvOptions,
433
437
  cliGetdotenvOptions,
434
438
  getdotenvOptions,
435
439
  });
436
440
 
437
441
  // Execute getdotenv.
438
- const dotenv = await getDotenv({ ...getdotenvOptions, logger });
442
+ thisCommand.getdotenvOptions = {
443
+ ...getdotenvOptions,
444
+ logger,
445
+ };
446
+ thisCommand.dotenv = await getDotenv(thisCommand.getdotenvOptions);
439
447
 
440
448
  if (cliOptions.debug)
441
- console.log('\n*** after getdotenv execution ***\n', { dotenv });
449
+ console.log('\n*** resulting dotenv values ***\n', {
450
+ dotenv: thisCommand.dotenv,
451
+ });
442
452
 
443
453
  // Execute post-hook.
444
- if (postHook) await postHook(dotenv);
454
+ if (postHook) await postHook(thisCommand.dotenv);
445
455
 
446
456
  // Execute shell command.
447
457
  if (command)
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "bin": {
4
4
  "getdotenv": "bin/getdotenv/index.js"
5
5
  },
6
- "version": "3.1.5",
6
+ "version": "3.1.6",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },