navy 4.1.2-rc.2 → 5.0.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.
- package/lib/cli/config/index.js +57 -241
- package/lib/cli/config/wrapper.js +12 -36
- package/lib/cli/develop.js +63 -167
- package/lib/cli/doctor/clean-compose-files.js +19 -73
- package/lib/cli/doctor/index.js +34 -154
- package/lib/cli/doctor/invalid-compose-config.js +20 -110
- package/lib/cli/doctor/invalid-state.js +22 -115
- package/lib/cli/doctor/util.js +26 -93
- package/lib/cli/external-ip.js +9 -39
- package/lib/cli/health.js +18 -67
- package/lib/cli/https.js +92 -0
- package/lib/cli/import.js +22 -59
- package/lib/cli/index.js +11 -17
- package/lib/cli/lan-ip.js +18 -60
- package/lib/cli/launch.js +46 -127
- package/lib/cli/live.js +37 -111
- package/lib/cli/local-ip.js +16 -53
- package/lib/cli/logs.js +7 -35
- package/lib/cli/open.js +11 -45
- package/lib/cli/program.js +145 -167
- package/lib/cli/ps.js +36 -105
- package/lib/cli/refresh-config.js +18 -62
- package/lib/cli/run.js +8 -39
- package/lib/cli/status.js +41 -201
- package/lib/cli/updates.js +68 -160
- package/lib/cli/util/get-or-initialise-navy.js +14 -57
- package/lib/cli/util/import.js +33 -83
- package/lib/cli/util/index.js +10 -12
- package/lib/cli/util/reconfigure.js +12 -102
- package/lib/cli/wait-for-healthy.js +53 -100
- package/lib/config-provider.js +25 -127
- package/lib/config-providers/filesystem/index.js +58 -235
- package/lib/config-providers/npm/__tests__/util.js +3 -6
- package/lib/config-providers/npm/index.js +60 -231
- package/lib/config-providers/npm/util.js +6 -9
- package/lib/config.js +39 -76
- package/lib/driver-logging.js +23 -28
- package/lib/driver.js +5 -7
- package/lib/drivers/docker-compose/client.js +64 -172
- package/lib/drivers/docker-compose/index.js +153 -464
- package/lib/errors.js +27 -61
- package/lib/http-proxy.js +72 -158
- package/lib/index.js +26 -29
- package/lib/middleware/add-service-proxy-config.js +76 -0
- package/lib/middleware/develop.js +9 -23
- package/lib/middleware/helpers.js +20 -25
- package/lib/middleware/port-override.js +15 -37
- package/lib/middleware/set-env-vars.js +14 -18
- package/lib/middleware/set-image.js +12 -18
- package/lib/middleware/set-logging-driver.js +14 -18
- package/lib/middleware/tag-override.js +11 -19
- package/lib/navy/default-middleware.js +13 -27
- package/lib/navy/index.js +438 -1761
- package/lib/navy/middleware.js +15 -100
- package/lib/navy/plugin-interface.js +28 -108
- package/lib/navy/state.js +58 -147
- package/lib/navy/util.js +2 -1
- package/lib/service.js +5 -3
- package/lib/util/__tests__/external-ip.js +20 -96
- package/lib/util/__tests__/registry-client.js +11 -24
- package/lib/util/__tests__/service-host.js +19 -116
- package/lib/util/docker-client.js +10 -13
- package/lib/util/exec-async.js +9 -27
- package/lib/util/external-ip.js +48 -126
- package/lib/util/fs.js +7 -6
- package/lib/util/get-lan-ip.js +15 -52
- package/lib/util/has-update.js +23 -73
- package/lib/util/https.js +213 -0
- package/lib/util/navyrc.js +12 -50
- package/lib/util/registry-client.js +41 -112
- package/lib/util/service-host.js +40 -129
- package/lib/util/table.js +11 -21
- package/package.json +14 -14
- package/LICENSE +0 -21
- package/lib/middleware/add-virtual-hosts.js +0 -147
package/lib/config-provider.js
CHANGED
|
@@ -1,148 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
4
|
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.getImportOptionsForCLI = undefined;
|
|
7
|
-
|
|
8
|
-
var _regenerator = require('babel-runtime/regenerator');
|
|
9
|
-
|
|
10
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
|
11
|
-
|
|
12
|
-
var _getIterator2 = require('babel-runtime/core-js/get-iterator');
|
|
13
|
-
|
|
14
|
-
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
|
15
|
-
|
|
16
|
-
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
|
17
|
-
|
|
18
|
-
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
|
19
|
-
|
|
20
|
-
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
|
|
21
|
-
|
|
22
|
-
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
|
23
|
-
|
|
24
|
-
var getImportOptionsForCLI = exports.getImportOptionsForCLI = function () {
|
|
25
|
-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(opts) {
|
|
26
|
-
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, provider, optionsFromProvider;
|
|
27
|
-
|
|
28
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
29
|
-
while (1) {
|
|
30
|
-
switch (_context.prev = _context.next) {
|
|
31
|
-
case 0:
|
|
32
|
-
_iteratorNormalCompletion = true;
|
|
33
|
-
_didIteratorError = false;
|
|
34
|
-
_iteratorError = undefined;
|
|
35
|
-
_context.prev = 3;
|
|
36
|
-
_iterator = (0, _getIterator3.default)(PROVIDERS);
|
|
37
|
-
|
|
38
|
-
case 5:
|
|
39
|
-
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
|
|
40
|
-
_context.next = 15;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
provider = _step.value;
|
|
45
|
-
_context.next = 9;
|
|
46
|
-
return provider.getImportOptionsForCLI(opts);
|
|
47
|
-
|
|
48
|
-
case 9:
|
|
49
|
-
optionsFromProvider = _context.sent;
|
|
50
|
-
|
|
51
|
-
if (!optionsFromProvider) {
|
|
52
|
-
_context.next = 12;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return _context.abrupt('return', optionsFromProvider);
|
|
57
|
-
|
|
58
|
-
case 12:
|
|
59
|
-
_iteratorNormalCompletion = true;
|
|
60
|
-
_context.next = 5;
|
|
61
|
-
break;
|
|
62
|
-
|
|
63
|
-
case 15:
|
|
64
|
-
_context.next = 21;
|
|
65
|
-
break;
|
|
66
|
-
|
|
67
|
-
case 17:
|
|
68
|
-
_context.prev = 17;
|
|
69
|
-
_context.t0 = _context['catch'](3);
|
|
70
|
-
_didIteratorError = true;
|
|
71
|
-
_iteratorError = _context.t0;
|
|
72
|
-
|
|
73
|
-
case 21:
|
|
74
|
-
_context.prev = 21;
|
|
75
|
-
_context.prev = 22;
|
|
76
|
-
|
|
77
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
78
|
-
_iterator.return();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
case 24:
|
|
82
|
-
_context.prev = 24;
|
|
83
|
-
|
|
84
|
-
if (!_didIteratorError) {
|
|
85
|
-
_context.next = 27;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
throw _iteratorError;
|
|
90
|
-
|
|
91
|
-
case 27:
|
|
92
|
-
return _context.finish(24);
|
|
93
|
-
|
|
94
|
-
case 28:
|
|
95
|
-
return _context.finish(21);
|
|
96
|
-
|
|
97
|
-
case 29:
|
|
98
|
-
|
|
99
|
-
(0, _invariant2.default)(false, 'CLI_IMPORT_RESOLVE_OPTIONS_ERR: Could not resolve import options from CLI arguments');
|
|
100
|
-
|
|
101
|
-
case 30:
|
|
102
|
-
case 'end':
|
|
103
|
-
return _context.stop();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, _callee, this, [[3, 17, 21, 29], [22,, 24, 28]]);
|
|
107
|
-
}));
|
|
108
|
-
|
|
109
|
-
return function getImportOptionsForCLI(_x) {
|
|
110
|
-
return _ref.apply(this, arguments);
|
|
111
|
-
};
|
|
112
|
-
}();
|
|
113
|
-
|
|
114
|
-
exports.resolveConfigProviderFromName = resolveConfigProviderFromName;
|
|
115
8
|
exports.getImportCommandLineOptions = getImportCommandLineOptions;
|
|
9
|
+
exports.getImportOptionsForCLI = getImportOptionsForCLI;
|
|
10
|
+
exports.resolveConfigProviderFromName = resolveConfigProviderFromName;
|
|
116
11
|
|
|
117
|
-
var _invariant = require(
|
|
118
|
-
|
|
119
|
-
var _invariant2 = _interopRequireDefault(_invariant);
|
|
120
|
-
|
|
121
|
-
var _filesystem = require('./config-providers/filesystem');
|
|
122
|
-
|
|
123
|
-
var _filesystem2 = _interopRequireDefault(_filesystem);
|
|
124
|
-
|
|
125
|
-
var _npm = require('./config-providers/npm');
|
|
12
|
+
var _invariant = _interopRequireDefault(require("invariant"));
|
|
126
13
|
|
|
127
|
-
var
|
|
14
|
+
var _filesystem = _interopRequireDefault(require("./config-providers/filesystem"));
|
|
128
15
|
|
|
129
|
-
|
|
16
|
+
var _npm = _interopRequireDefault(require("./config-providers/npm"));
|
|
130
17
|
|
|
131
|
-
|
|
18
|
+
const PROVIDERS = [_npm.default, _filesystem.default];
|
|
132
19
|
|
|
133
20
|
function resolveConfigProviderFromName(providerName) {
|
|
134
21
|
switch (providerName) {
|
|
135
22
|
case 'filesystem':
|
|
136
|
-
return
|
|
23
|
+
return _filesystem.default;
|
|
24
|
+
|
|
137
25
|
case 'npm':
|
|
138
|
-
return
|
|
26
|
+
return _npm.default;
|
|
139
27
|
}
|
|
140
28
|
|
|
141
29
|
return null;
|
|
142
30
|
}
|
|
143
31
|
|
|
144
32
|
function getImportCommandLineOptions() {
|
|
145
|
-
return PROVIDERS.reduce(
|
|
146
|
-
|
|
147
|
-
|
|
33
|
+
return PROVIDERS.reduce((arr, provider) => [...arr, ...provider.importCliOptions], []);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function getImportOptionsForCLI(opts) {
|
|
37
|
+
for (const provider of PROVIDERS) {
|
|
38
|
+
const optionsFromProvider = await provider.getImportOptionsForCLI(opts);
|
|
39
|
+
|
|
40
|
+
if (optionsFromProvider) {
|
|
41
|
+
return optionsFromProvider;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
(0, _invariant.default)(false, "CLI_IMPORT_RESOLVE_OPTIONS_ERR: Could not resolve import options from CLI arguments");
|
|
148
46
|
}
|
|
@@ -1,269 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
4
|
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
|
|
7
|
-
var _regenerator = require('babel-runtime/regenerator');
|
|
8
|
-
|
|
9
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
|
10
|
-
|
|
11
|
-
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
|
12
|
-
|
|
13
|
-
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
|
14
|
-
|
|
15
|
-
var cwdHasValidDockerComposeConfig = function () {
|
|
16
|
-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
|
|
17
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
_context.prev = 0;
|
|
22
|
-
_context.next = 3;
|
|
23
|
-
return (0, _execAsync.execAsync)('docker-compose', ['config'], null, { maxBuffer: Infinity, cwd: process.cwd() });
|
|
24
|
-
|
|
25
|
-
case 3:
|
|
26
|
-
_context.next = 8;
|
|
27
|
-
break;
|
|
28
|
-
|
|
29
|
-
case 5:
|
|
30
|
-
_context.prev = 5;
|
|
31
|
-
_context.t0 = _context['catch'](0);
|
|
32
|
-
return _context.abrupt('return', false);
|
|
33
|
-
|
|
34
|
-
case 8:
|
|
35
|
-
return _context.abrupt('return', true);
|
|
36
|
-
|
|
37
|
-
case 9:
|
|
38
|
-
case 'end':
|
|
39
|
-
return _context.stop();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}, _callee, this, [[0, 5]]);
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
return function cwdHasValidDockerComposeConfig() {
|
|
46
|
-
return _ref.apply(this, arguments);
|
|
47
|
-
};
|
|
48
|
-
}();
|
|
49
|
-
|
|
50
8
|
exports.default = createFileSystemConfigProvider;
|
|
51
9
|
|
|
52
|
-
var _path = require(
|
|
53
|
-
|
|
54
|
-
var _path2 = _interopRequireDefault(_path);
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
55
11
|
|
|
56
|
-
var _invariant = require(
|
|
12
|
+
var _invariant = _interopRequireDefault(require("invariant"));
|
|
57
13
|
|
|
58
|
-
var
|
|
14
|
+
var _fs = _interopRequireDefault(require("../../util/fs"));
|
|
59
15
|
|
|
60
|
-
var
|
|
16
|
+
var _execAsync = require("../../util/exec-async");
|
|
61
17
|
|
|
62
|
-
|
|
18
|
+
async function cwdHasValidDockerComposeConfig() {
|
|
19
|
+
try {
|
|
20
|
+
await (0, _execAsync.execAsync)('docker-compose', ['config'], null, {
|
|
21
|
+
maxBuffer: Infinity,
|
|
22
|
+
cwd: process.cwd()
|
|
23
|
+
});
|
|
24
|
+
} catch (ex) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
63
27
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
67
30
|
|
|
68
31
|
function createFileSystemConfigProvider(navy) {
|
|
69
32
|
return {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return navy.getState();
|
|
81
|
-
|
|
82
|
-
case 2:
|
|
83
|
-
envState = _context2.sent;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
(0, _invariant2.default)(!!envState, 'STATE_NONEXISTANT: State doesn\'t exist for navy %s', navy.name);
|
|
87
|
-
(0, _invariant2.default)(!!envState.path, 'FILESYSTEM_PROVIDER_REQUIRES_PATH: File system config provider requires a path for %s', navy.name);
|
|
88
|
-
|
|
89
|
-
_context2.prev = 5;
|
|
90
|
-
_context2.next = 8;
|
|
91
|
-
return _fs2.default.statAsync(envState.path);
|
|
92
|
-
|
|
93
|
-
case 8:
|
|
94
|
-
_context2.next = 13;
|
|
95
|
-
break;
|
|
96
|
-
|
|
97
|
-
case 10:
|
|
98
|
-
_context2.prev = 10;
|
|
99
|
-
_context2.t0 = _context2['catch'](5);
|
|
100
|
-
|
|
101
|
-
(0, _invariant2.default)(false, 'FILESYSTEM_PROVIDER_INVALID_PATH: Invalid path given to navy: %s', navy.name);
|
|
102
|
-
|
|
103
|
-
case 13:
|
|
104
|
-
return _context2.abrupt('return', envState.path);
|
|
33
|
+
async getNavyPath() {
|
|
34
|
+
const envState = await navy.getState();
|
|
35
|
+
(0, _invariant.default)(!!envState, "STATE_NONEXISTANT: State doesn't exist for navy %s", navy.name);
|
|
36
|
+
(0, _invariant.default)(!!envState.path, "FILESYSTEM_PROVIDER_REQUIRES_PATH: File system config provider requires a path for %s", navy.name);
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
await _fs.default.statAsync(envState.path);
|
|
40
|
+
} catch (ex) {
|
|
41
|
+
(0, _invariant.default)(false, "FILESYSTEM_PROVIDER_INVALID_PATH: Invalid path given to navy: %s", navy.name);
|
|
42
|
+
}
|
|
105
43
|
|
|
106
|
-
|
|
107
|
-
case 'end':
|
|
108
|
-
return _context2.stop();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, _callee2, _this, [[5, 10]]);
|
|
112
|
-
}))();
|
|
44
|
+
return envState.path;
|
|
113
45
|
},
|
|
114
|
-
getNavyFilePath: function getNavyFilePath() {
|
|
115
|
-
var _this2 = this;
|
|
116
|
-
|
|
117
|
-
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
|
|
118
|
-
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
|
119
|
-
while (1) {
|
|
120
|
-
switch (_context3.prev = _context3.next) {
|
|
121
|
-
case 0:
|
|
122
|
-
_context3.t0 = _path2.default;
|
|
123
|
-
_context3.next = 3;
|
|
124
|
-
return _this2.getNavyPath();
|
|
125
46
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return _context3.abrupt('return', _context3.t0.join.call(_context3.t0, _context3.t1, 'Navyfile.js'));
|
|
129
|
-
|
|
130
|
-
case 5:
|
|
131
|
-
case 'end':
|
|
132
|
-
return _context3.stop();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, _callee3, _this2);
|
|
136
|
-
}))();
|
|
47
|
+
async getNavyFilePath() {
|
|
48
|
+
return _path.default.join(await this.getNavyPath(), 'Navyfile.js');
|
|
137
49
|
},
|
|
138
|
-
refreshConfig: function refreshConfig() {
|
|
139
|
-
var _this3 = this;
|
|
140
|
-
|
|
141
|
-
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
|
|
142
|
-
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
|
143
|
-
while (1) {
|
|
144
|
-
switch (_context4.prev = _context4.next) {
|
|
145
|
-
case 0:
|
|
146
|
-
return _context4.abrupt('return', false);
|
|
147
50
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}, _callee4, _this3);
|
|
154
|
-
}))();
|
|
51
|
+
async refreshConfig() {
|
|
52
|
+
// no-op
|
|
53
|
+
return false;
|
|
155
54
|
},
|
|
156
|
-
getLocationDisplayName: function getLocationDisplayName() {
|
|
157
|
-
var _this4 = this;
|
|
158
|
-
|
|
159
|
-
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5() {
|
|
160
|
-
var envState;
|
|
161
|
-
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
|
162
|
-
while (1) {
|
|
163
|
-
switch (_context5.prev = _context5.next) {
|
|
164
|
-
case 0:
|
|
165
|
-
_context5.next = 2;
|
|
166
|
-
return navy.getState();
|
|
167
|
-
|
|
168
|
-
case 2:
|
|
169
|
-
envState = _context5.sent;
|
|
170
|
-
|
|
171
55
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
case 5:
|
|
177
|
-
case 'end':
|
|
178
|
-
return _context5.stop();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}, _callee5, _this4);
|
|
182
|
-
}))();
|
|
56
|
+
async getLocationDisplayName() {
|
|
57
|
+
const envState = await navy.getState();
|
|
58
|
+
(0, _invariant.default)(!!envState, "STATE_NONEXISTANT: State doesn't exist for navy %s", navy.name);
|
|
59
|
+
return envState.path;
|
|
183
60
|
},
|
|
184
|
-
isDangling: function isDangling() {
|
|
185
|
-
var _this5 = this;
|
|
186
|
-
|
|
187
|
-
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6() {
|
|
188
|
-
var envState;
|
|
189
|
-
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
|
190
|
-
while (1) {
|
|
191
|
-
switch (_context6.prev = _context6.next) {
|
|
192
|
-
case 0:
|
|
193
|
-
_context6.next = 2;
|
|
194
|
-
return navy.getState();
|
|
195
|
-
|
|
196
|
-
case 2:
|
|
197
|
-
envState = _context6.sent;
|
|
198
|
-
|
|
199
|
-
if (!(!envState || !envState.path)) {
|
|
200
|
-
_context6.next = 5;
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return _context6.abrupt('return', true);
|
|
205
61
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
_context6.next = 8;
|
|
209
|
-
return _fs2.default.statAsync(envState.path);
|
|
62
|
+
async isDangling() {
|
|
63
|
+
const envState = await navy.getState();
|
|
210
64
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
case 10:
|
|
216
|
-
_context6.prev = 10;
|
|
217
|
-
_context6.t0 = _context6['catch'](5);
|
|
218
|
-
return _context6.abrupt('return', true);
|
|
65
|
+
if (!envState || !envState.path) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
219
68
|
|
|
220
|
-
|
|
221
|
-
|
|
69
|
+
try {
|
|
70
|
+
await _fs.default.statAsync(envState.path);
|
|
71
|
+
} catch (ex) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
222
74
|
|
|
223
|
-
|
|
224
|
-
case 'end':
|
|
225
|
-
return _context6.stop();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}, _callee6, _this5, [[5, 10]]);
|
|
229
|
-
}))();
|
|
75
|
+
return false;
|
|
230
76
|
}
|
|
77
|
+
|
|
231
78
|
};
|
|
232
79
|
}
|
|
233
80
|
|
|
234
81
|
createFileSystemConfigProvider.importCliOptions = [];
|
|
235
82
|
|
|
236
|
-
createFileSystemConfigProvider.getImportOptionsForCLI =
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
case 0:
|
|
243
|
-
_context7.next = 2;
|
|
244
|
-
return cwdHasValidDockerComposeConfig();
|
|
245
|
-
|
|
246
|
-
case 2:
|
|
247
|
-
hasValidComposeConfig = _context7.sent;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
(0, _invariant2.default)(hasValidComposeConfig, 'NO_DOCKER_COMPOSE_FILE: No docker-compose.yml (or valid Docker Compose config) found');
|
|
251
|
-
|
|
252
|
-
return _context7.abrupt('return', {
|
|
253
|
-
configProvider: 'filesystem',
|
|
254
|
-
path: process.cwd()
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
case 5:
|
|
258
|
-
case 'end':
|
|
259
|
-
return _context7.stop();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}, _callee7, undefined);
|
|
263
|
-
}));
|
|
264
|
-
|
|
265
|
-
return function (_x) {
|
|
266
|
-
return _ref2.apply(this, arguments);
|
|
83
|
+
createFileSystemConfigProvider.getImportOptionsForCLI = async opts => {
|
|
84
|
+
const hasValidComposeConfig = await cwdHasValidDockerComposeConfig();
|
|
85
|
+
(0, _invariant.default)(hasValidComposeConfig, "NO_DOCKER_COMPOSE_FILE: No docker-compose.yml (or valid Docker Compose config) found");
|
|
86
|
+
return {
|
|
87
|
+
configProvider: 'filesystem',
|
|
88
|
+
path: process.cwd()
|
|
267
89
|
};
|
|
268
|
-
}
|
|
90
|
+
};
|
|
91
|
+
|
|
269
92
|
module.exports = exports.default;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
var _chai = require(
|
|
3
|
+
var _chai = require("chai");
|
|
4
4
|
|
|
5
|
-
var _util = require(
|
|
5
|
+
var _util = require("../util");
|
|
6
6
|
|
|
7
7
|
/* eslint-env mocha */
|
|
8
|
-
|
|
9
8
|
describe('npm config provider', function () {
|
|
10
|
-
|
|
11
9
|
describe('pathToModule', function () {
|
|
12
|
-
|
|
13
10
|
it('should return the correct path to the module', function () {
|
|
14
11
|
(0, _chai.expect)((0, _util.pathToModule)('/root', 'my-environment')).to.equal('/root/my-environment');
|
|
15
12
|
(0, _chai.expect)((0, _util.pathToModule)('/root', '@my-org/my-environment')).to.equal('/root/@my-org/my-environment');
|