@equinor/echo-cli 1.0.0-beta-23 → 1.0.0-beta-25
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.
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
3
|
import { ECHO_HOST_BUILD_OUTPUT_FOLDER, ECHO_MODULE_CONFIG_PATH, REQUIRED_REF } from '../../const/common.js';
|
|
4
4
|
import getFilePath, { getFile } from '../../utils/getFile.js';
|
|
5
5
|
import getPackageJson from './getPackageJson.js';
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
6
|
export async function defineInitOptions(echoBundleOptions, isDevelopment) {
|
|
9
7
|
const currentDir = process.cwd();
|
|
10
8
|
const echoModuleConfig = await getFile(currentDir, ECHO_MODULE_CONFIG_PATH);
|
|
11
9
|
const pkj = await getPackageJson(currentDir);
|
|
10
|
+
const topNodeModules = findTopNodeModulesWithEchoCli(currentDir);
|
|
11
|
+
if (!topNodeModules) {
|
|
12
|
+
throw new Error('Could not find top-level node_modules containing @equinor/echo-cli');
|
|
13
|
+
}
|
|
12
14
|
return {
|
|
13
15
|
...echoBundleOptions,
|
|
14
16
|
isProduction: isDevelopment ? false : true,
|
|
@@ -18,10 +20,24 @@ export async function defineInitOptions(echoBundleOptions, isDevelopment) {
|
|
|
18
20
|
peerDependencies: pkj.peerDependencies,
|
|
19
21
|
dependencies: pkj.dependencies,
|
|
20
22
|
devDependencies: pkj.devDependencies,
|
|
21
|
-
wwwRoot: path.
|
|
23
|
+
wwwRoot: path.join(topNodeModules, ECHO_HOST_BUILD_OUTPUT_FOLDER),
|
|
22
24
|
requireRef: REQUIRED_REF,
|
|
23
25
|
envPath: await getFilePath(currentDir, '/.env'),
|
|
24
26
|
echoModuleConfig
|
|
25
27
|
};
|
|
26
28
|
}
|
|
29
|
+
function findTopNodeModulesWithEchoCli(startDir) {
|
|
30
|
+
let dir = path.resolve(startDir);
|
|
31
|
+
let lastDir = null;
|
|
32
|
+
let topmost = undefined;
|
|
33
|
+
while (dir !== lastDir) {
|
|
34
|
+
const candidate = path.join(dir, 'node_modules', '@equinor', 'echo-cli');
|
|
35
|
+
if (fs.existsSync(candidate)) {
|
|
36
|
+
topmost = candidate;
|
|
37
|
+
}
|
|
38
|
+
lastDir = dir;
|
|
39
|
+
dir = path.dirname(dir);
|
|
40
|
+
}
|
|
41
|
+
return topmost;
|
|
42
|
+
}
|
|
27
43
|
//# sourceMappingURL=initOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initOptions.js","sourceRoot":"","sources":["../../../src/config/common/initOptions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"initOptions.js","sourceRoot":"","sources":["../../../src/config/common/initOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7G,OAAO,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,cAAc,MAAM,qBAAqB,CAAC;AA0BjD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,iBAA6C,EAC7C,aAAuB;IAEvB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAqB,MAAM,OAAO,CAAmB,UAAU,EAAE,uBAAuB,CAAC,CAAC;IAChH,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;IAE7C,MAAM,cAAc,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;IACjE,IAAI,CAAC,cAAc,EAAE,CAAC;QAClB,MAAM,IAAI,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.0.0-beta-25",
|
|
4
4
|
"description": "Command line interface for Echo Apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"source": "src/test.js",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"listr2": "8.3.3",
|
|
66
66
|
"ncp": "2.0.0",
|
|
67
67
|
"ora": "^8.2.0",
|
|
68
|
+
"package-directory": "^8.1.0",
|
|
68
69
|
"pem": "1.14.8",
|
|
69
70
|
"postcss": "8.5.3",
|
|
70
71
|
"react": "18.3.1",
|