@karmaniverous/get-dotenv 3.1.15 → 3.1.17

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.
@@ -6,13 +6,18 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getDotenvCli = void 0;
7
7
  var _commander = require("commander");
8
8
  var _execa = require("execa");
9
+ var _os = _interopRequireDefault(require("os"));
9
10
  var _dotenvExpand = require("./dotenvExpand.js");
10
11
  var _getDotenv = require("./getDotenv.js");
11
12
  var _options = require("./options.js");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
  // npm imports
13
15
 
14
16
  // lib imports
15
17
 
18
+ // Discover platform.
19
+ const platform = _os.default.platform();
20
+
16
21
  /**
17
22
  * GetDotenv CLI Pre-hook Callback type. Transforms inbound options & executes side effects.
18
23
  *
@@ -108,7 +113,7 @@ const getDotenvCli = function () {
108
113
  const {
109
114
  args
110
115
  } = command;
111
- if (args.length) await (0, _execa.execaCommand)(args.join('\\ '), {
116
+ if (args.length) await (0, _execa.execaCommand)(args.join(platform === 'win32' ? '\\ ' : ' '), {
112
117
  stdio: 'inherit',
113
118
  shell: true
114
119
  });
@@ -184,7 +189,7 @@ const getDotenvCli = function () {
184
189
  if (postHook) await postHook(dotenv);
185
190
 
186
191
  // Execute shell command.
187
- if (command) await (0, _execa.execaCommand)(command.replace(/ /g, '\\ '), {
192
+ if (command) await (0, _execa.execaCommand)(platform === 'win32' ? command.replace(/ /g, '\\ ') : command, {
188
193
  env: {
189
194
  ...process.env,
190
195
  getdotenvOptions: JSON.stringify(getdotenvOptions)
@@ -17,11 +17,9 @@ const _dirname = (0, _path.dirname)((0, _url.fileURLToPath)(import.meta.url));
17
17
 
18
18
  // Load default options.
19
19
  const cliDefaultOptionsGlobalPath = (0, _path.resolve)(_dirname, '../getdotenv.config.json');
20
- const cliDefaultOptionsGlobal = (await _fsExtra.default.exists(cliDefaultOptionsGlobalPath)) ? JSON.parse(await _fsExtra.default.readFile(cliDefaultOptionsGlobalPath)) : {};
21
- exports.cliDefaultOptionsGlobal = cliDefaultOptionsGlobal;
20
+ const cliDefaultOptionsGlobal = exports.cliDefaultOptionsGlobal = (await _fsExtra.default.exists(cliDefaultOptionsGlobalPath)) ? JSON.parse(await _fsExtra.default.readFile(cliDefaultOptionsGlobalPath)) : {};
22
21
  const cliDefaultOptionsLocalPath = (0, _path.resolve)(await (0, _pkgDir.packageDirectory)(), 'getdotenv.config.json');
23
- const cliDefaultOptionsLocal = (await _fsExtra.default.exists(cliDefaultOptionsLocalPath)) ? JSON.parse(await _fsExtra.default.readFile(cliDefaultOptionsLocalPath)) : {};
24
- exports.cliDefaultOptionsLocal = cliDefaultOptionsLocal;
22
+ const cliDefaultOptionsLocal = exports.cliDefaultOptionsLocal = (await _fsExtra.default.exists(cliDefaultOptionsLocalPath)) ? JSON.parse(await _fsExtra.default.readFile(cliDefaultOptionsLocalPath)) : {};
25
23
  const cli2getdotenvOptions = function () {
26
24
  let {
27
25
  paths,
@@ -41,8 +39,7 @@ const cli2getdotenvOptions = function () {
41
39
  };
42
40
  };
43
41
  exports.cli2getdotenvOptions = cli2getdotenvOptions;
44
- const getdotenvDefaultOptions = cli2getdotenvOptions({
42
+ const getdotenvDefaultOptions = exports.getdotenvDefaultOptions = cli2getdotenvOptions({
45
43
  ...cliDefaultOptionsGlobal,
46
44
  ...cliDefaultOptionsLocal
47
- });
48
- exports.getdotenvDefaultOptions = getdotenvDefaultOptions;
45
+ });
@@ -1,6 +1,7 @@
1
1
  // npm imports
2
2
  import { Command, Option } from 'commander';
3
3
  import { execaCommand } from 'execa';
4
+ import Os from 'os';
4
5
 
5
6
  // lib imports
6
7
  import { dotenvExpand } from './dotenvExpand.js';
@@ -11,6 +12,9 @@ import {
11
12
  cliDefaultOptionsLocal,
12
13
  } from './options.js';
13
14
 
15
+ // Discover platform.
16
+ const platform = Os.platform();
17
+
14
18
  /**
15
19
  * GetDotenv CLI Pre-hook Callback type. Transforms inbound options & executes side effects.
16
20
  *
@@ -329,7 +333,7 @@ export const getDotenvCli = ({
329
333
  .action(async (options, command) => {
330
334
  const { args } = command;
331
335
  if (args.length)
332
- await execaCommand(args.join('\\ '), {
336
+ await execaCommand(args.join(platform === 'win32' ? '\\ ' : ' '), {
333
337
  stdio: 'inherit',
334
338
  shell: true,
335
339
  });
@@ -456,13 +460,16 @@ export const getDotenvCli = ({
456
460
 
457
461
  // Execute shell command.
458
462
  if (command)
459
- await execaCommand(command.replace(/ /g, '\\ '), {
460
- env: {
461
- ...process.env,
462
- getdotenvOptions: JSON.stringify(getdotenvOptions),
463
- },
464
- shell: true,
465
- stdio: 'inherit',
466
- });
463
+ await execaCommand(
464
+ platform === 'win32' ? command.replace(/ /g, '\\ ') : command,
465
+ {
466
+ env: {
467
+ ...process.env,
468
+ getdotenvOptions: JSON.stringify(getdotenvOptions),
469
+ },
470
+ shell: true,
471
+ stdio: 'inherit',
472
+ }
473
+ );
467
474
  });
468
475
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "bin": {
4
4
  "getdotenv": "bin/getdotenv/index.js"
5
5
  },
6
- "version": "3.1.15",
6
+ "version": "3.1.17",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -36,31 +36,31 @@
36
36
  ],
37
37
  "license": "BSD-3-Clause",
38
38
  "dependencies": {
39
- "commander": "^11.0.0",
39
+ "commander": "^11.1.0",
40
40
  "dotenv": "^16.3.1",
41
41
  "execa": "^8.0.1",
42
42
  "fs-extra": "^11.1.1",
43
43
  "lodash.frompairs": "^4.0.1",
44
44
  "lodash.pick": "^4.4.0",
45
45
  "lodash.pickby": "^4.6.0",
46
- "nanoid": "^4.0.2",
47
- "pkg-dir": "^7.0.0"
46
+ "nanoid": "^5.0.3",
47
+ "pkg-dir": "^8.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@babel/cli": "^7.22.15",
51
- "@babel/core": "^7.22.15",
52
- "@babel/eslint-parser": "^7.22.15",
53
- "@babel/preset-env": "^7.22.15",
50
+ "@babel/cli": "^7.23.4",
51
+ "@babel/core": "^7.23.3",
52
+ "@babel/eslint-parser": "^7.23.3",
53
+ "@babel/preset-env": "^7.23.3",
54
54
  "@babel/register": "^7.22.15",
55
- "@types/node": "^20.5.9",
56
- "chai": "^4.3.8",
55
+ "@types/node": "^20.9.5",
56
+ "chai": "^4.3.10",
57
57
  "concat-md": "^0.5.1",
58
- "eslint": "^8.48.0",
59
- "eslint-plugin-mocha": "^10.1.0",
58
+ "eslint": "^8.54.0",
59
+ "eslint-plugin-mocha": "^10.2.0",
60
60
  "eslint-plugin-promise": "^6.1.1",
61
61
  "jsdoc-to-markdown": "^8.0.0",
62
62
  "mocha": "^10.2.0",
63
- "release-it": "^16.1.5"
63
+ "release-it": "^17.0.0"
64
64
  },
65
65
  "exports": {
66
66
  ".": {