@commercetools-frontend/cypress-environments 0.1.9 → 1.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/README.md
CHANGED
|
@@ -59,8 +59,7 @@ cypress/config
|
|
|
59
59
|
|──── .env.secrets.ci (Decrypred from `*.enc`)
|
|
60
60
|
|──── .env.config.local.template
|
|
61
61
|
|──── .env.secrets.local.template
|
|
62
|
-
|
|
63
|
-
└── vw_production_aws_eu-central-1_v1
|
|
62
|
+
└── ctp_production_aws_eu-central-1_v1
|
|
64
63
|
```
|
|
65
64
|
|
|
66
65
|
Would load the values from `.env.config` anytime the environment is `ctp_production_gcp_europe-west1_v1`. Additionally on CI (when `CI=true`) it would load the `.env.secrets.ci` file, otherwise it would attempt to load values from `.env.config.local` and `.env.secrets.local` (assuming they have been properly configured - see `*.template` files for reference).
|
|
@@ -42,7 +42,7 @@ var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
|
|
|
42
42
|
var pkgDir__default = /*#__PURE__*/_interopDefault(pkgDir);
|
|
43
43
|
|
|
44
44
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
45
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
45
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
46
46
|
const cypressEnvironmentsConfigExplorer = cosmiconfig.cosmiconfig('cypress-environments', {
|
|
47
47
|
searchStrategy: 'project'
|
|
48
48
|
});
|
|
@@ -57,14 +57,14 @@ function doesFileExist(filePath) {
|
|
|
57
57
|
}
|
|
58
58
|
function getParsedEnvFileContents(envPath) {
|
|
59
59
|
if (doesFileExist(envPath)) {
|
|
60
|
-
console.log(
|
|
60
|
+
console.log("\u2705 Found and loading environment variables from: '".concat(envPath, "'"));
|
|
61
61
|
const envFileContents = fs__default["default"].readFileSync(envPath, {
|
|
62
62
|
encoding: 'utf8'
|
|
63
63
|
});
|
|
64
64
|
const configuration = dotenv__default["default"].parse(envFileContents);
|
|
65
65
|
return configuration;
|
|
66
66
|
} else {
|
|
67
|
-
console.log(
|
|
67
|
+
console.log("\u2139\uFE0F No environment variables at: '".concat(envPath, "'. If needed create it or duplicate the template file."));
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -72,27 +72,27 @@ async function loadConfig() {
|
|
|
72
72
|
try {
|
|
73
73
|
return await cypressEnvironmentsConfigExplorer.search();
|
|
74
74
|
} catch (e) {
|
|
75
|
-
throw new Error(
|
|
75
|
+
throw new Error("Failed loading a Cypress environments configuration. Create a cosmiconfig for 'cypress-environments' for example 'cypress-environments.config.cjs'.");
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
async function getConfigurationForEnvironment(environmentName) {
|
|
79
|
-
var _context, _context2;
|
|
79
|
+
var _context, _context2, _context3;
|
|
80
80
|
// NOTE: On CI the *.ci secrests are not excluded. Locally the are in case
|
|
81
81
|
// decrypted files are available on a developer's machine.
|
|
82
82
|
const ignoredGlobs = ['**/*.enc', '**/*.template'];
|
|
83
83
|
const ignoredCIGlobs = ['**/*.ci'];
|
|
84
84
|
const allIgnoredGlobs = isCI ? ignoredGlobs : _concatInstanceProperty__default["default"](ignoredGlobs).call(ignoredGlobs, ignoredCIGlobs);
|
|
85
85
|
if (isCI) {
|
|
86
|
-
console.log(
|
|
86
|
+
console.log("\u2139\uFE0F 'CI' environment variable is defined. Assuming operating from a CI system.");
|
|
87
87
|
} else {
|
|
88
|
-
console.log(
|
|
88
|
+
console.log("\u2139\uFE0F 'CI' environment variable is not defined. Assuming you are running locally.");
|
|
89
89
|
}
|
|
90
|
-
console.log(
|
|
90
|
+
console.log("\u2139\uFE0F The ignored globs are: ".concat(allIgnoredGlobs.join(', '), "."));
|
|
91
91
|
const configResult = await loadConfig();
|
|
92
|
-
const allEnvironmentConfigs = configResult
|
|
92
|
+
const allEnvironmentConfigs = configResult === null || configResult === void 0 ? void 0 : configResult.config;
|
|
93
93
|
const configForEnvironment = _findInstanceProperty__default["default"](_context = allEnvironmentConfigs.environments).call(_context, environment => environment.name === environmentName);
|
|
94
94
|
if (!configForEnvironment) {
|
|
95
|
-
throw new Error(
|
|
95
|
+
throw new Error("No configuration for ".concat(environmentName, " defined in cosmiconfig for 'cypress-environments'. Please make sure it exists."));
|
|
96
96
|
}
|
|
97
97
|
const secretsFiles = await glob.glob(configForEnvironment.secrets.glob, {
|
|
98
98
|
ignore: allIgnoredGlobs
|
|
@@ -100,27 +100,27 @@ async function getConfigurationForEnvironment(environmentName) {
|
|
|
100
100
|
const configFiles = await glob.glob(configForEnvironment.config.glob, {
|
|
101
101
|
ignore: allIgnoredGlobs
|
|
102
102
|
});
|
|
103
|
-
console.log(
|
|
103
|
+
console.log(_concatInstanceProperty__default["default"](_context2 = "\u2139\uFE0F Found ".concat(secretsFiles.length, " secret file(s) and ")).call(_context2, configFiles.length, " config file(s) matching the defined globs."));
|
|
104
104
|
if (secretsFiles.length === 0 || configFiles.length === 0) {
|
|
105
|
-
console.log(
|
|
106
|
-
console.log(
|
|
105
|
+
console.log("\u2139\uFE0F Secrets files glob is: ".concat(configForEnvironment.secrets.glob));
|
|
106
|
+
console.log("\u2139\uFE0F Config files glob is: ".concat(configForEnvironment.config.glob));
|
|
107
107
|
}
|
|
108
|
-
const mergedConfigurationAndSecrests = _reduceInstanceProperty__default["default"](
|
|
108
|
+
const mergedConfigurationAndSecrests = _reduceInstanceProperty__default["default"](_context3 = [...configFiles, ...secretsFiles]).call(_context3, (previousParsedEnvFileContents, nextEnvFilePath) => {
|
|
109
109
|
const parsedEnvFileContents = getParsedEnvFileContents(nextEnvFilePath);
|
|
110
110
|
let matchingParsedEnvFileContentsForCIOrLocal = null;
|
|
111
111
|
if (!_endsWithInstanceProperty__default["default"](nextEnvFilePath).call(nextEnvFilePath, '.local') && !_endsWithInstanceProperty__default["default"](nextEnvFilePath).call(nextEnvFilePath, '.ci')) {
|
|
112
|
-
matchingParsedEnvFileContentsForCIOrLocal = isCI ? getParsedEnvFileContents(
|
|
112
|
+
matchingParsedEnvFileContentsForCIOrLocal = isCI ? getParsedEnvFileContents("".concat(nextEnvFilePath, ".ci")) : getParsedEnvFileContents("".concat(nextEnvFilePath, ".local"));
|
|
113
113
|
}
|
|
114
114
|
return _objectSpread(_objectSpread(_objectSpread({}, previousParsedEnvFileContents), parsedEnvFileContents), matchingParsedEnvFileContentsForCIOrLocal);
|
|
115
115
|
}, {});
|
|
116
116
|
const rootDir = await pkgDir__default["default"](__dirname);
|
|
117
117
|
let sharedEnvironmentConfiguration = null;
|
|
118
118
|
if (rootDir) {
|
|
119
|
-
const pathToSharedEnvironmentConfiguration = path__default["default"].join(rootDir, 'config',
|
|
119
|
+
const pathToSharedEnvironmentConfiguration = path__default["default"].join(rootDir, 'config', ".env.".concat(environmentName, ".config"));
|
|
120
120
|
if (doesFileExist(pathToSharedEnvironmentConfiguration)) {
|
|
121
121
|
sharedEnvironmentConfiguration = getParsedEnvFileContents(pathToSharedEnvironmentConfiguration);
|
|
122
122
|
} else {
|
|
123
|
-
console.log(
|
|
123
|
+
console.log("\u2139\uFE0F No shared configuration for ".concat(environmentName, " defined."));
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
const config = _objectSpread(_objectSpread({}, sharedEnvironmentConfiguration), mergedConfigurationAndSecrests);
|
|
@@ -42,7 +42,7 @@ var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
|
|
|
42
42
|
var pkgDir__default = /*#__PURE__*/_interopDefault(pkgDir);
|
|
43
43
|
|
|
44
44
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
45
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
45
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
46
46
|
const cypressEnvironmentsConfigExplorer = cosmiconfig.cosmiconfig('cypress-environments', {
|
|
47
47
|
searchStrategy: 'project'
|
|
48
48
|
});
|
|
@@ -57,14 +57,14 @@ function doesFileExist(filePath) {
|
|
|
57
57
|
}
|
|
58
58
|
function getParsedEnvFileContents(envPath) {
|
|
59
59
|
if (doesFileExist(envPath)) {
|
|
60
|
-
console.log(
|
|
60
|
+
console.log("\u2705 Found and loading environment variables from: '".concat(envPath, "'"));
|
|
61
61
|
const envFileContents = fs__default["default"].readFileSync(envPath, {
|
|
62
62
|
encoding: 'utf8'
|
|
63
63
|
});
|
|
64
64
|
const configuration = dotenv__default["default"].parse(envFileContents);
|
|
65
65
|
return configuration;
|
|
66
66
|
} else {
|
|
67
|
-
console.log(
|
|
67
|
+
console.log("\u2139\uFE0F No environment variables at: '".concat(envPath, "'. If needed create it or duplicate the template file."));
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -72,27 +72,27 @@ async function loadConfig() {
|
|
|
72
72
|
try {
|
|
73
73
|
return await cypressEnvironmentsConfigExplorer.search();
|
|
74
74
|
} catch (e) {
|
|
75
|
-
throw new Error(
|
|
75
|
+
throw new Error("Failed loading a Cypress environments configuration. Create a cosmiconfig for 'cypress-environments' for example 'cypress-environments.config.cjs'.");
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
async function getConfigurationForEnvironment(environmentName) {
|
|
79
|
-
var _context, _context2;
|
|
79
|
+
var _context, _context2, _context3;
|
|
80
80
|
// NOTE: On CI the *.ci secrests are not excluded. Locally the are in case
|
|
81
81
|
// decrypted files are available on a developer's machine.
|
|
82
82
|
const ignoredGlobs = ['**/*.enc', '**/*.template'];
|
|
83
83
|
const ignoredCIGlobs = ['**/*.ci'];
|
|
84
84
|
const allIgnoredGlobs = isCI ? ignoredGlobs : _concatInstanceProperty__default["default"](ignoredGlobs).call(ignoredGlobs, ignoredCIGlobs);
|
|
85
85
|
if (isCI) {
|
|
86
|
-
console.log(
|
|
86
|
+
console.log("\u2139\uFE0F 'CI' environment variable is defined. Assuming operating from a CI system.");
|
|
87
87
|
} else {
|
|
88
|
-
console.log(
|
|
88
|
+
console.log("\u2139\uFE0F 'CI' environment variable is not defined. Assuming you are running locally.");
|
|
89
89
|
}
|
|
90
|
-
console.log(
|
|
90
|
+
console.log("\u2139\uFE0F The ignored globs are: ".concat(allIgnoredGlobs.join(', '), "."));
|
|
91
91
|
const configResult = await loadConfig();
|
|
92
|
-
const allEnvironmentConfigs = configResult
|
|
92
|
+
const allEnvironmentConfigs = configResult === null || configResult === void 0 ? void 0 : configResult.config;
|
|
93
93
|
const configForEnvironment = _findInstanceProperty__default["default"](_context = allEnvironmentConfigs.environments).call(_context, environment => environment.name === environmentName);
|
|
94
94
|
if (!configForEnvironment) {
|
|
95
|
-
throw new Error(
|
|
95
|
+
throw new Error("No configuration for ".concat(environmentName, " defined in cosmiconfig for 'cypress-environments'. Please make sure it exists."));
|
|
96
96
|
}
|
|
97
97
|
const secretsFiles = await glob.glob(configForEnvironment.secrets.glob, {
|
|
98
98
|
ignore: allIgnoredGlobs
|
|
@@ -100,27 +100,27 @@ async function getConfigurationForEnvironment(environmentName) {
|
|
|
100
100
|
const configFiles = await glob.glob(configForEnvironment.config.glob, {
|
|
101
101
|
ignore: allIgnoredGlobs
|
|
102
102
|
});
|
|
103
|
-
console.log(
|
|
103
|
+
console.log(_concatInstanceProperty__default["default"](_context2 = "\u2139\uFE0F Found ".concat(secretsFiles.length, " secret file(s) and ")).call(_context2, configFiles.length, " config file(s) matching the defined globs."));
|
|
104
104
|
if (secretsFiles.length === 0 || configFiles.length === 0) {
|
|
105
|
-
console.log(
|
|
106
|
-
console.log(
|
|
105
|
+
console.log("\u2139\uFE0F Secrets files glob is: ".concat(configForEnvironment.secrets.glob));
|
|
106
|
+
console.log("\u2139\uFE0F Config files glob is: ".concat(configForEnvironment.config.glob));
|
|
107
107
|
}
|
|
108
|
-
const mergedConfigurationAndSecrests = _reduceInstanceProperty__default["default"](
|
|
108
|
+
const mergedConfigurationAndSecrests = _reduceInstanceProperty__default["default"](_context3 = [...configFiles, ...secretsFiles]).call(_context3, (previousParsedEnvFileContents, nextEnvFilePath) => {
|
|
109
109
|
const parsedEnvFileContents = getParsedEnvFileContents(nextEnvFilePath);
|
|
110
110
|
let matchingParsedEnvFileContentsForCIOrLocal = null;
|
|
111
111
|
if (!_endsWithInstanceProperty__default["default"](nextEnvFilePath).call(nextEnvFilePath, '.local') && !_endsWithInstanceProperty__default["default"](nextEnvFilePath).call(nextEnvFilePath, '.ci')) {
|
|
112
|
-
matchingParsedEnvFileContentsForCIOrLocal = isCI ? getParsedEnvFileContents(
|
|
112
|
+
matchingParsedEnvFileContentsForCIOrLocal = isCI ? getParsedEnvFileContents("".concat(nextEnvFilePath, ".ci")) : getParsedEnvFileContents("".concat(nextEnvFilePath, ".local"));
|
|
113
113
|
}
|
|
114
114
|
return _objectSpread(_objectSpread(_objectSpread({}, previousParsedEnvFileContents), parsedEnvFileContents), matchingParsedEnvFileContentsForCIOrLocal);
|
|
115
115
|
}, {});
|
|
116
116
|
const rootDir = await pkgDir__default["default"](__dirname);
|
|
117
117
|
let sharedEnvironmentConfiguration = null;
|
|
118
118
|
if (rootDir) {
|
|
119
|
-
const pathToSharedEnvironmentConfiguration = path__default["default"].join(rootDir, 'config',
|
|
119
|
+
const pathToSharedEnvironmentConfiguration = path__default["default"].join(rootDir, 'config', ".env.".concat(environmentName, ".config"));
|
|
120
120
|
if (doesFileExist(pathToSharedEnvironmentConfiguration)) {
|
|
121
121
|
sharedEnvironmentConfiguration = getParsedEnvFileContents(pathToSharedEnvironmentConfiguration);
|
|
122
122
|
} else {
|
|
123
|
-
console.log(
|
|
123
|
+
console.log("\u2139\uFE0F No shared configuration for ".concat(environmentName, " defined."));
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
const config = _objectSpread(_objectSpread({}, sharedEnvironmentConfiguration), mergedConfigurationAndSecrests);
|
|
@@ -19,7 +19,7 @@ import pkgDir from 'pkg-dir';
|
|
|
19
19
|
import { cosmiconfig } from 'cosmiconfig';
|
|
20
20
|
|
|
21
21
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
23
|
const cypressEnvironmentsConfigExplorer = cosmiconfig('cypress-environments', {
|
|
24
24
|
searchStrategy: 'project'
|
|
25
25
|
});
|
|
@@ -34,14 +34,14 @@ function doesFileExist(filePath) {
|
|
|
34
34
|
}
|
|
35
35
|
function getParsedEnvFileContents(envPath) {
|
|
36
36
|
if (doesFileExist(envPath)) {
|
|
37
|
-
console.log(
|
|
37
|
+
console.log("\u2705 Found and loading environment variables from: '".concat(envPath, "'"));
|
|
38
38
|
const envFileContents = fs.readFileSync(envPath, {
|
|
39
39
|
encoding: 'utf8'
|
|
40
40
|
});
|
|
41
41
|
const configuration = dotenv.parse(envFileContents);
|
|
42
42
|
return configuration;
|
|
43
43
|
} else {
|
|
44
|
-
console.log(
|
|
44
|
+
console.log("\u2139\uFE0F No environment variables at: '".concat(envPath, "'. If needed create it or duplicate the template file."));
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -49,27 +49,27 @@ async function loadConfig() {
|
|
|
49
49
|
try {
|
|
50
50
|
return await cypressEnvironmentsConfigExplorer.search();
|
|
51
51
|
} catch (e) {
|
|
52
|
-
throw new Error(
|
|
52
|
+
throw new Error("Failed loading a Cypress environments configuration. Create a cosmiconfig for 'cypress-environments' for example 'cypress-environments.config.cjs'.");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
async function getConfigurationForEnvironment(environmentName) {
|
|
56
|
-
var _context, _context2;
|
|
56
|
+
var _context, _context2, _context3;
|
|
57
57
|
// NOTE: On CI the *.ci secrests are not excluded. Locally the are in case
|
|
58
58
|
// decrypted files are available on a developer's machine.
|
|
59
59
|
const ignoredGlobs = ['**/*.enc', '**/*.template'];
|
|
60
60
|
const ignoredCIGlobs = ['**/*.ci'];
|
|
61
61
|
const allIgnoredGlobs = isCI ? ignoredGlobs : _concatInstanceProperty(ignoredGlobs).call(ignoredGlobs, ignoredCIGlobs);
|
|
62
62
|
if (isCI) {
|
|
63
|
-
console.log(
|
|
63
|
+
console.log("\u2139\uFE0F 'CI' environment variable is defined. Assuming operating from a CI system.");
|
|
64
64
|
} else {
|
|
65
|
-
console.log(
|
|
65
|
+
console.log("\u2139\uFE0F 'CI' environment variable is not defined. Assuming you are running locally.");
|
|
66
66
|
}
|
|
67
|
-
console.log(
|
|
67
|
+
console.log("\u2139\uFE0F The ignored globs are: ".concat(allIgnoredGlobs.join(', '), "."));
|
|
68
68
|
const configResult = await loadConfig();
|
|
69
|
-
const allEnvironmentConfigs = configResult
|
|
69
|
+
const allEnvironmentConfigs = configResult === null || configResult === void 0 ? void 0 : configResult.config;
|
|
70
70
|
const configForEnvironment = _findInstanceProperty(_context = allEnvironmentConfigs.environments).call(_context, environment => environment.name === environmentName);
|
|
71
71
|
if (!configForEnvironment) {
|
|
72
|
-
throw new Error(
|
|
72
|
+
throw new Error("No configuration for ".concat(environmentName, " defined in cosmiconfig for 'cypress-environments'. Please make sure it exists."));
|
|
73
73
|
}
|
|
74
74
|
const secretsFiles = await glob(configForEnvironment.secrets.glob, {
|
|
75
75
|
ignore: allIgnoredGlobs
|
|
@@ -77,27 +77,27 @@ async function getConfigurationForEnvironment(environmentName) {
|
|
|
77
77
|
const configFiles = await glob(configForEnvironment.config.glob, {
|
|
78
78
|
ignore: allIgnoredGlobs
|
|
79
79
|
});
|
|
80
|
-
console.log(
|
|
80
|
+
console.log(_concatInstanceProperty(_context2 = "\u2139\uFE0F Found ".concat(secretsFiles.length, " secret file(s) and ")).call(_context2, configFiles.length, " config file(s) matching the defined globs."));
|
|
81
81
|
if (secretsFiles.length === 0 || configFiles.length === 0) {
|
|
82
|
-
console.log(
|
|
83
|
-
console.log(
|
|
82
|
+
console.log("\u2139\uFE0F Secrets files glob is: ".concat(configForEnvironment.secrets.glob));
|
|
83
|
+
console.log("\u2139\uFE0F Config files glob is: ".concat(configForEnvironment.config.glob));
|
|
84
84
|
}
|
|
85
|
-
const mergedConfigurationAndSecrests = _reduceInstanceProperty(
|
|
85
|
+
const mergedConfigurationAndSecrests = _reduceInstanceProperty(_context3 = [...configFiles, ...secretsFiles]).call(_context3, (previousParsedEnvFileContents, nextEnvFilePath) => {
|
|
86
86
|
const parsedEnvFileContents = getParsedEnvFileContents(nextEnvFilePath);
|
|
87
87
|
let matchingParsedEnvFileContentsForCIOrLocal = null;
|
|
88
88
|
if (!_endsWithInstanceProperty(nextEnvFilePath).call(nextEnvFilePath, '.local') && !_endsWithInstanceProperty(nextEnvFilePath).call(nextEnvFilePath, '.ci')) {
|
|
89
|
-
matchingParsedEnvFileContentsForCIOrLocal = isCI ? getParsedEnvFileContents(
|
|
89
|
+
matchingParsedEnvFileContentsForCIOrLocal = isCI ? getParsedEnvFileContents("".concat(nextEnvFilePath, ".ci")) : getParsedEnvFileContents("".concat(nextEnvFilePath, ".local"));
|
|
90
90
|
}
|
|
91
91
|
return _objectSpread(_objectSpread(_objectSpread({}, previousParsedEnvFileContents), parsedEnvFileContents), matchingParsedEnvFileContentsForCIOrLocal);
|
|
92
92
|
}, {});
|
|
93
93
|
const rootDir = await pkgDir(__dirname);
|
|
94
94
|
let sharedEnvironmentConfiguration = null;
|
|
95
95
|
if (rootDir) {
|
|
96
|
-
const pathToSharedEnvironmentConfiguration = path.join(rootDir, 'config',
|
|
96
|
+
const pathToSharedEnvironmentConfiguration = path.join(rootDir, 'config', ".env.".concat(environmentName, ".config"));
|
|
97
97
|
if (doesFileExist(pathToSharedEnvironmentConfiguration)) {
|
|
98
98
|
sharedEnvironmentConfiguration = getParsedEnvFileContents(pathToSharedEnvironmentConfiguration);
|
|
99
99
|
} else {
|
|
100
|
-
console.log(
|
|
100
|
+
console.log("\u2139\uFE0F No shared configuration for ".concat(environmentName, " defined."));
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
const config = _objectSpread(_objectSpread({}, sharedEnvironmentConfiguration), mergedConfigurationAndSecrests);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/cypress-environments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Cypress package to setup environment configuration using dotenv files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"@babel/runtime-corejs3": "^7.21.0",
|
|
21
21
|
"cosmiconfig": "9.0.0",
|
|
22
22
|
"dotenv": "16.6.1",
|
|
23
|
-
"glob": "10.
|
|
23
|
+
"glob": "10.5.0",
|
|
24
24
|
"pkg-dir": "5.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@tsconfig/node20": "20.1.6",
|
|
28
28
|
"@types/glob": "8.1.0",
|
|
29
|
-
"@types/node": "22.
|
|
29
|
+
"@types/node": "22.19.1",
|
|
30
30
|
"typescript": "5.2.2"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|