@equinor/echo-cli 1.0.0-beta-12 → 1.0.0-beta-14
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/echo-dev-host/webpack.config.js +6 -3
- package/lib/echo-build.d.ts +22 -0
- package/lib/echo-build.js +33 -3
- package/lib/echo-build.js.map +1 -1
- package/lib/echo-dev-host/webpack.config.js +6 -3
- package/lib/echo-update-dev-host-deps.d.ts +1 -1
- package/lib/echo-update-dev-host-deps.js +40 -11
- package/lib/echo-update-dev-host-deps.js.map +1 -1
- package/lib/tools/buildScripts/buildAndCopyDevHost.d.ts +11 -10
- package/lib/tools/buildScripts/buildAndCopyDevHost.js +38 -17
- package/lib/tools/buildScripts/buildAndCopyDevHost.js.map +1 -1
- package/lib/utils/printDevHostVersions.d.ts +1 -1
- package/lib/utils/printDevHostVersions.js +4 -7
- package/lib/utils/printDevHostVersions.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,13 +6,16 @@ import WebpackBar from 'webpackbar';
|
|
|
6
6
|
|
|
7
7
|
const webpackConfig = (env) => {
|
|
8
8
|
console.log('Building the dev host application for EchoCli.');
|
|
9
|
+
|
|
10
|
+
const buildOutputFolder = 'echo-dev-host-build';
|
|
11
|
+
|
|
9
12
|
return {
|
|
10
13
|
entry: ['@babel/polyfill', './src/index.tsx'],
|
|
11
14
|
mode: 'production',
|
|
12
15
|
devtool: 'source-map',
|
|
13
16
|
output: {
|
|
14
17
|
clean: true,
|
|
15
|
-
path: path.resolve(process.cwd(),
|
|
18
|
+
path: path.resolve(process.cwd(), buildOutputFolder),
|
|
16
19
|
filename: '[name].echo.bundle.js',
|
|
17
20
|
chunkFilename: 'assets/[name].[contenthash].chunk.js',
|
|
18
21
|
publicPath: '/'
|
|
@@ -117,11 +120,11 @@ const webpackConfig = (env) => {
|
|
|
117
120
|
patterns: [
|
|
118
121
|
{
|
|
119
122
|
from: path.resolve(import.meta.dirname, './public/index.css'),
|
|
120
|
-
to: path.resolve(process.cwd(),
|
|
123
|
+
to: path.resolve(process.cwd(), buildOutputFolder, 'index.css')
|
|
121
124
|
},
|
|
122
125
|
{
|
|
123
126
|
from: path.resolve(import.meta.dirname, './public/env-config.js'),
|
|
124
|
-
to: path.resolve(process.cwd(),
|
|
127
|
+
to: path.resolve(process.cwd(), buildOutputFolder, 'env-config.js')
|
|
125
128
|
}
|
|
126
129
|
]
|
|
127
130
|
})
|
package/lib/echo-build.d.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
|
+
/**
|
|
4
|
+
* @class CreateBundle
|
|
5
|
+
* @extends Command
|
|
6
|
+
* @description
|
|
7
|
+
* Command-line utility for creating an Echo Bundle. This command provides options to serve the Echo Client,
|
|
8
|
+
* build in development mode, copy the client to the build folder, and analyze the bundle with an interactive treemap.
|
|
9
|
+
*
|
|
10
|
+
* @flags
|
|
11
|
+
* - `--serve, -s`: Add the serve Echo Client with the app.
|
|
12
|
+
* - `--isDevelopment, -d`: Build in development mode (production is default).
|
|
13
|
+
* - `--copy, -c`: Copy the client to the build folder.
|
|
14
|
+
* - `--analyze, -b`: Analyze the bundle with an interactive treemap.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* The command checks for the presence of the `echo-dev-host` folder before proceeding.
|
|
18
|
+
* If not found, it prompts the user to build it. It also prints the versions of echo libraries used by the dev host.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```sh
|
|
22
|
+
* npx echo-build --serve --isDevelopment
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
3
25
|
export default class CreateBundle extends Command {
|
|
4
26
|
static description: string;
|
|
5
27
|
static flags: {
|
package/lib/echo-build.js
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command, Flags } from '@oclif/core';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import path from 'path';
|
|
4
6
|
import { echoWebpackBuild } from './tools/buildScripts/webpackBuilds.js';
|
|
5
7
|
import { echoCliLogo } from './utils/logo.js';
|
|
6
8
|
import { printDevHostVersions } from './utils/printDevHostVersions.js';
|
|
9
|
+
/**
|
|
10
|
+
* @class CreateBundle
|
|
11
|
+
* @extends Command
|
|
12
|
+
* @description
|
|
13
|
+
* Command-line utility for creating an Echo Bundle. This command provides options to serve the Echo Client,
|
|
14
|
+
* build in development mode, copy the client to the build folder, and analyze the bundle with an interactive treemap.
|
|
15
|
+
*
|
|
16
|
+
* @flags
|
|
17
|
+
* - `--serve, -s`: Add the serve Echo Client with the app.
|
|
18
|
+
* - `--isDevelopment, -d`: Build in development mode (production is default).
|
|
19
|
+
* - `--copy, -c`: Copy the client to the build folder.
|
|
20
|
+
* - `--analyze, -b`: Analyze the bundle with an interactive treemap.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* The command checks for the presence of the `echo-dev-host` folder before proceeding.
|
|
24
|
+
* If not found, it prompts the user to build it. It also prints the versions of echo libraries used by the dev host.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```sh
|
|
28
|
+
* npx echo-build --serve --isDevelopment
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
7
31
|
export default class CreateBundle extends Command {
|
|
8
32
|
static description = 'Creates Echo Bundle';
|
|
9
33
|
static flags = {
|
|
@@ -26,11 +50,17 @@ export default class CreateBundle extends Command {
|
|
|
26
50
|
};
|
|
27
51
|
async run() {
|
|
28
52
|
const options = await this.parse(CreateBundle);
|
|
53
|
+
const echoDevHostPath = path.resolve(__dirname, './echo-dev-host');
|
|
54
|
+
if (!fs.existsSync(echoDevHostPath)) {
|
|
55
|
+
this.log(chalk.red(`\n[echo-cli] The echo-dev-host folder was not found at ${echoDevHostPath}.\n` +
|
|
56
|
+
'Please ensure echo-dev-host is built and present in node_modules/@equinor/echo-cli before running this command.\n' +
|
|
57
|
+
'You can do this by running: npx echo-build-dev-host\n'));
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
29
60
|
echoCliLogo();
|
|
30
61
|
console.log(chalk.cyan('echo-cli runs your echo application with echo-dev-host, which is using the following echo lib versions:'));
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
printDevHostVersions();
|
|
62
|
+
// path determined from the script perspective
|
|
63
|
+
printDevHostVersions(path.resolve(echoDevHostPath, 'package.json'));
|
|
34
64
|
await echoWebpackBuild(options.flags, options.flags.isDevelopment);
|
|
35
65
|
}
|
|
36
66
|
}
|
package/lib/echo-build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-build.js","sourceRoot":"","sources":["../src/echo-build.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IACtC,MAAM,CAAC,WAAW,GAAG,qBAAqB,CAAC;IAE3C,MAAM,CAAC,KAAK,GAAG;QAClB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,oCAAoC;SACpD,CAAC;QACF,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC;YACzB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,oDAAoD;SACpE,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;YAChB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0CAA0C;SAC1D,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,OAAO,CA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AAE,uDAAuD;SACvE,CAAC;KACL,CAAC;IAEK,KAAK,CAAC,GAAG;QACZ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAE/C,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QACnE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,GAAG,CACJ,KAAK,CAAC,GAAG,CACL,0DAA0D,eAAe,KAAK;gBAC1E,mHAAmH;gBACnH,uDAAuD,CAC9D,CACJ,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,WAAW,EAAE,CAAC;QAEd,OAAO,CAAC,GAAG,CACP,KAAK,CAAC,IAAI,CACN,yGAAyG,CAC5G,CACJ,CAAC;QAEF,8CAA8C;QAC9C,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;QAEpE,MAAM,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACvE,CAAC;;AAGL,YAAY,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -6,13 +6,16 @@ import WebpackBar from 'webpackbar';
|
|
|
6
6
|
|
|
7
7
|
const webpackConfig = (env) => {
|
|
8
8
|
console.log('Building the dev host application for EchoCli.');
|
|
9
|
+
|
|
10
|
+
const buildOutputFolder = 'echo-dev-host-build';
|
|
11
|
+
|
|
9
12
|
return {
|
|
10
13
|
entry: ['@babel/polyfill', './src/index.tsx'],
|
|
11
14
|
mode: 'production',
|
|
12
15
|
devtool: 'source-map',
|
|
13
16
|
output: {
|
|
14
17
|
clean: true,
|
|
15
|
-
path: path.resolve(process.cwd(),
|
|
18
|
+
path: path.resolve(process.cwd(), buildOutputFolder),
|
|
16
19
|
filename: '[name].echo.bundle.js',
|
|
17
20
|
chunkFilename: 'assets/[name].[contenthash].chunk.js',
|
|
18
21
|
publicPath: '/'
|
|
@@ -117,11 +120,11 @@ const webpackConfig = (env) => {
|
|
|
117
120
|
patterns: [
|
|
118
121
|
{
|
|
119
122
|
from: path.resolve(import.meta.dirname, './public/index.css'),
|
|
120
|
-
to: path.resolve(process.cwd(),
|
|
123
|
+
to: path.resolve(process.cwd(), buildOutputFolder, 'index.css')
|
|
121
124
|
},
|
|
122
125
|
{
|
|
123
126
|
from: path.resolve(import.meta.dirname, './public/env-config.js'),
|
|
124
|
-
to: path.resolve(process.cwd(),
|
|
127
|
+
to: path.resolve(process.cwd(), buildOutputFolder, 'env-config.js')
|
|
125
128
|
}
|
|
126
129
|
]
|
|
127
130
|
})
|
|
@@ -26,7 +26,7 @@ import { Command } from '@oclif/core';
|
|
|
26
26
|
export default class UpdateDevHostEchoLibVersions extends Command {
|
|
27
27
|
static description: string;
|
|
28
28
|
static flags: {
|
|
29
|
-
all: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
all: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
30
30
|
};
|
|
31
31
|
run(): Promise<void>;
|
|
32
32
|
}
|
|
@@ -6,6 +6,7 @@ import fs from 'fs-extra';
|
|
|
6
6
|
import inquirer from 'inquirer';
|
|
7
7
|
import ora from 'ora';
|
|
8
8
|
import path from 'path';
|
|
9
|
+
import { buildAndCopyDevHost } from './tools/buildScripts/buildAndCopyDevHost.js';
|
|
9
10
|
/**
|
|
10
11
|
* @class UpdateDevHostEchoLibVersions
|
|
11
12
|
* @extends Command
|
|
@@ -39,18 +40,17 @@ export default class UpdateDevHostEchoLibVersions extends Command {
|
|
|
39
40
|
};
|
|
40
41
|
async run() {
|
|
41
42
|
const { flags } = await this.parse(UpdateDevHostEchoLibVersions);
|
|
42
|
-
const
|
|
43
|
-
this.log(chalk.cyan(`Trying to load echo lib dependencies from: ${chalk.yellow(
|
|
43
|
+
const devHostPkgPath = path.resolve(process.cwd(), 'node_modules', '@equinor', 'echo-cli', 'echo-dev-host', 'package.json');
|
|
44
|
+
this.log(chalk.cyan(`Trying to load echo lib dependencies from: ${chalk.yellow(devHostPkgPath)}`));
|
|
44
45
|
let pkg;
|
|
45
46
|
try {
|
|
46
|
-
pkg = fs.readJsonSync(
|
|
47
|
+
pkg = fs.readJsonSync(devHostPkgPath);
|
|
47
48
|
}
|
|
48
49
|
catch (error) {
|
|
49
|
-
this.error(`Could not read package.json at ${chalk.yellow(
|
|
50
|
+
this.error(`Could not read package.json at ${chalk.yellow(devHostPkgPath)}. You need to run "npx echo-build-dev-host" first to create the echo-dev-host-tmp folder and its package.json file.`);
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
53
|
const deps = pkg.dependencies || {};
|
|
53
|
-
// Find echo libraries
|
|
54
54
|
const echoLibs = Object.keys(deps).filter((name) => name.startsWith('@equinor/echo-'));
|
|
55
55
|
if (echoLibs.length === 0) {
|
|
56
56
|
this.log('No echo libraries found in dependencies.');
|
|
@@ -64,11 +64,34 @@ export default class UpdateDevHostEchoLibVersions extends Command {
|
|
|
64
64
|
latestVersions[lib] = await getLatestVersion(lib, spinner);
|
|
65
65
|
}
|
|
66
66
|
spinner.succeed('Fetched latest echo library versions.');
|
|
67
|
-
|
|
67
|
+
// Determine which libs are up to date and which are outdated
|
|
68
|
+
const upToDateLibs = echoLibs.filter((lib) => deps[lib] === latestVersions[lib]);
|
|
69
|
+
const outdatedLibs = echoLibs.filter((lib) => deps[lib] !== latestVersions[lib]);
|
|
70
|
+
// Log up-to-date libs
|
|
71
|
+
upToDateLibs.forEach((lib) => {
|
|
72
|
+
this.log(chalk.gray(`${lib} is already at latest version (${deps[lib]}), skipping.`));
|
|
73
|
+
});
|
|
74
|
+
if (outdatedLibs.length === 0) {
|
|
75
|
+
this.log(chalk.green('All echo libraries are already at their latest versions. No update needed.'));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let autoBump = flags.all;
|
|
79
|
+
if (!flags.all) {
|
|
80
|
+
const answer = await inquirer.prompt([
|
|
81
|
+
{
|
|
82
|
+
type: 'confirm',
|
|
83
|
+
name: 'autoBump',
|
|
84
|
+
message: `Do you want to automatically update all outdated echo libraries to their latest versions?\nIf you choose 'No', you will be prompted for each library.`,
|
|
85
|
+
default: true
|
|
86
|
+
}
|
|
87
|
+
]);
|
|
88
|
+
autoBump = answer.autoBump;
|
|
89
|
+
}
|
|
90
|
+
for (const lib of outdatedLibs) {
|
|
68
91
|
const current = deps[lib];
|
|
69
92
|
const latest = latestVersions[lib];
|
|
70
93
|
let newVersion = latest;
|
|
71
|
-
if (!
|
|
94
|
+
if (!autoBump) {
|
|
72
95
|
const answer = await inquirer.prompt([
|
|
73
96
|
{
|
|
74
97
|
type: 'input',
|
|
@@ -82,14 +105,20 @@ export default class UpdateDevHostEchoLibVersions extends Command {
|
|
|
82
105
|
if (newVersion !== current) {
|
|
83
106
|
deps[lib] = newVersion;
|
|
84
107
|
updated = true;
|
|
85
|
-
this.log(`Updated ${lib} to ${newVersion}`);
|
|
108
|
+
this.log(chalk.yellow(`Updated ${lib} to ${newVersion}`));
|
|
86
109
|
}
|
|
87
110
|
}
|
|
88
111
|
if (updated) {
|
|
89
112
|
pkg.dependencies = deps;
|
|
90
|
-
fs.writeJsonSync(
|
|
91
|
-
this.log('Dependencies updated.
|
|
92
|
-
|
|
113
|
+
fs.writeJsonSync(devHostPkgPath, pkg, { spaces: 2 });
|
|
114
|
+
this.log('Dependencies updated. Rebuilding echo-dev-host...');
|
|
115
|
+
const cliNodeModules = path.resolve(process.cwd(), 'node_modules', '@equinor', 'echo-cli');
|
|
116
|
+
const finalOutput = path.join(cliNodeModules, 'echo-dev-host');
|
|
117
|
+
await buildAndCopyDevHost({
|
|
118
|
+
consumerRoot: process.cwd(),
|
|
119
|
+
finalOutputDir: finalOutput,
|
|
120
|
+
reuseTmpFolder: false
|
|
121
|
+
});
|
|
93
122
|
}
|
|
94
123
|
else {
|
|
95
124
|
this.log('No changes made to dependencies.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-update-dev-host-deps.js","sourceRoot":"","sources":["../src/echo-update-dev-host-deps.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"echo-update-dev-host-deps.js","sourceRoot":"","sources":["../src/echo-update-dev-host-deps.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,OAAO;IAC7D,MAAM,CAAC,WAAW,GAAG,iEAAiE,CAAC;IAEvF,MAAM,CAAC,KAAK,GAAG;QACX,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;YACf,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,uDAAuD;SACvE,CAAC;KACL,CAAC;IAEF,KAAK,CAAC,GAAG;QACL,MAAM,EAAE,KAAK,EAAE,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AG,CAAC,kCAAkC,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;;AAGL,KAAK,UAAU,gBAAgB,CAAC,GAAW,EAAE,OAAY;IACrD,IAAI,CAAC;QACD,OAAO,CAAC,IAAI,GAAG,+BAA+B,GAAG,KAAK,CAAC;QACvD,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,GAAG,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;aACpF,QAAQ,EAAE;aACV,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,CAAC,IAAI,CAAC,wBAAwB,GAAG,GAAG,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,sCAAsC,GAAG,GAAG,CAAC,CAAC;QAC3D,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED,4BAA4B,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builds and copies the
|
|
2
|
+
* Builds and copies the Echo Dev Host application for local development.
|
|
3
3
|
*
|
|
4
|
-
* This function
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 3. Copies the build output to the specified final output directory, replacing any existing content.
|
|
4
|
+
* This function prepares a temporary folder for the dev host, optionally installs dependencies and builds the project,
|
|
5
|
+
* and then copies the build output to the specified final output directory. It can reuse an existing temporary folder
|
|
6
|
+
* or prompt the user for confirmation if not specified.
|
|
8
7
|
*
|
|
9
|
-
* @param params - The parameters for
|
|
10
|
-
* @param params.consumerRoot - The root directory of the consumer project
|
|
11
|
-
* @param params.finalOutputDir - The directory where the
|
|
12
|
-
* @param params.installAndBuild - Whether to run `npm install` and `npm run build` in the temporary folder
|
|
8
|
+
* @param params - The parameters for building and copying the dev host.
|
|
9
|
+
* @param params.consumerRoot - The root directory of the consumer project.
|
|
10
|
+
* @param params.finalOutputDir - The directory where the build output should be copied.
|
|
11
|
+
* @param params.installAndBuild - Whether to run `npm install` and `npm run build` in the temporary folder. Defaults to `true`.
|
|
12
|
+
* @param params.reuseTmpFolder - Whether to reuse the existing temporary folder. If undefined and the folder exists, prompts the user.
|
|
13
13
|
*
|
|
14
14
|
* @returns A promise that resolves when the build and copy process is complete.
|
|
15
15
|
*/
|
|
16
|
-
export declare function buildAndCopyDevHost({ consumerRoot, finalOutputDir, installAndBuild }: {
|
|
16
|
+
export declare function buildAndCopyDevHost({ consumerRoot, finalOutputDir, installAndBuild, reuseTmpFolder }: {
|
|
17
17
|
consumerRoot: string;
|
|
18
18
|
finalOutputDir: string;
|
|
19
19
|
installAndBuild?: boolean;
|
|
20
|
+
reuseTmpFolder?: boolean;
|
|
20
21
|
}): Promise<void>;
|
|
@@ -2,24 +2,25 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
import figlet from 'figlet';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import { printDevHostVersions } from '../../utils/printDevHostVersions.js';
|
|
7
8
|
/**
|
|
8
|
-
* Builds and copies the
|
|
9
|
+
* Builds and copies the Echo Dev Host application for local development.
|
|
9
10
|
*
|
|
10
|
-
* This function
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* 3. Copies the build output to the specified final output directory, replacing any existing content.
|
|
11
|
+
* This function prepares a temporary folder for the dev host, optionally installs dependencies and builds the project,
|
|
12
|
+
* and then copies the build output to the specified final output directory. It can reuse an existing temporary folder
|
|
13
|
+
* or prompt the user for confirmation if not specified.
|
|
14
14
|
*
|
|
15
|
-
* @param params - The parameters for
|
|
16
|
-
* @param params.consumerRoot - The root directory of the consumer project
|
|
17
|
-
* @param params.finalOutputDir - The directory where the
|
|
18
|
-
* @param params.installAndBuild - Whether to run `npm install` and `npm run build` in the temporary folder
|
|
15
|
+
* @param params - The parameters for building and copying the dev host.
|
|
16
|
+
* @param params.consumerRoot - The root directory of the consumer project.
|
|
17
|
+
* @param params.finalOutputDir - The directory where the build output should be copied.
|
|
18
|
+
* @param params.installAndBuild - Whether to run `npm install` and `npm run build` in the temporary folder. Defaults to `true`.
|
|
19
|
+
* @param params.reuseTmpFolder - Whether to reuse the existing temporary folder. If undefined and the folder exists, prompts the user.
|
|
19
20
|
*
|
|
20
21
|
* @returns A promise that resolves when the build and copy process is complete.
|
|
21
22
|
*/
|
|
22
|
-
export async function buildAndCopyDevHost({ consumerRoot, finalOutputDir, installAndBuild = true }) {
|
|
23
|
+
export async function buildAndCopyDevHost({ consumerRoot, finalOutputDir, installAndBuild = true, reuseTmpFolder }) {
|
|
23
24
|
console.log(`${chalk.cyan.bold('echo-dev-host')} - by Echo Core Team`);
|
|
24
25
|
console.log('Minimalistic host application for local development of Echo applications.\n');
|
|
25
26
|
console.log(figlet.textSync('Echo Dev Host', {
|
|
@@ -30,25 +31,45 @@ export async function buildAndCopyDevHost({ consumerRoot, finalOutputDir, instal
|
|
|
30
31
|
const cliNodeModules = path.resolve(consumerRoot, 'node_modules', '@equinor', 'echo-cli');
|
|
31
32
|
const devHostSrc = path.join(cliNodeModules, 'lib', 'echo-dev-host');
|
|
32
33
|
const tmpDevHostFolder = path.resolve(consumerRoot, 'echo-dev-host-tmp');
|
|
33
|
-
const buildOutput = path.join(tmpDevHostFolder, 'echo-dev-host');
|
|
34
|
+
const buildOutput = path.join(tmpDevHostFolder, 'echo-dev-host-build');
|
|
35
|
+
let shouldReuse = reuseTmpFolder;
|
|
36
|
+
if (fs.existsSync(tmpDevHostFolder) && typeof shouldReuse === 'undefined') {
|
|
37
|
+
const answer = await inquirer.prompt([
|
|
38
|
+
{
|
|
39
|
+
type: 'confirm',
|
|
40
|
+
name: 'reuse',
|
|
41
|
+
message: `Temporary folder "${tmpDevHostFolder}" exists. Do you want to reuse it to build echo-dev-host? If you chose 'No', it will be removed and a new one will be created.`,
|
|
42
|
+
default: true
|
|
43
|
+
}
|
|
44
|
+
]);
|
|
45
|
+
shouldReuse = answer.reuse;
|
|
46
|
+
}
|
|
34
47
|
// 1. Prepare echo-dev-host-tmp
|
|
35
|
-
if (!fs.existsSync(tmpDevHostFolder)) {
|
|
36
|
-
|
|
48
|
+
if (!fs.existsSync(tmpDevHostFolder) || shouldReuse === false) {
|
|
49
|
+
if (fs.existsSync(tmpDevHostFolder) && shouldReuse === false) {
|
|
50
|
+
console.log(chalk.yellowBright.bold(`\n[echo-dev-host] Removing existing temporary folder "${tmpDevHostFolder}"...\n`));
|
|
51
|
+
fs.removeSync(tmpDevHostFolder);
|
|
52
|
+
}
|
|
53
|
+
console.log(chalk.blueBright.bold(`\n[echo-dev-host] Copying echo-dev-host source to ${chalk.yellow(tmpDevHostFolder)}...\n`));
|
|
37
54
|
fs.copySync(devHostSrc, tmpDevHostFolder);
|
|
38
55
|
}
|
|
39
56
|
else {
|
|
40
|
-
console.log(chalk.blueBright.bold(`\n[echo-dev-host] Temporary folder exists. Reusing
|
|
57
|
+
console.log(chalk.blueBright.bold(`\n[echo-dev-host] Temporary folder "${tmpDevHostFolder}" exists. Reusing it.\n`));
|
|
58
|
+
// Always copy (overwrite) package.json from source to tmpDevHostFolder
|
|
59
|
+
const srcPkgJson = path.join(devHostSrc, 'package.json');
|
|
60
|
+
const destPkgJson = path.join(tmpDevHostFolder, 'package.json');
|
|
61
|
+
fs.copySync(srcPkgJson, destPkgJson, { overwrite: true });
|
|
41
62
|
}
|
|
42
63
|
// 2. npm install & build
|
|
43
64
|
if (installAndBuild) {
|
|
44
65
|
console.log(chalk.greenBright.bold('[echo-dev-host] Installing dependencies and building echo-dev-host...\n'));
|
|
45
|
-
console.log(chalk.greenBright.bold('[echo-dev-host] Using the following versions of echo libraries - run `npx echo-
|
|
46
|
-
printDevHostVersions();
|
|
66
|
+
console.log(chalk.greenBright.bold('[echo-dev-host] Using the following versions of echo libraries - run `npx update-echo-dev-host-deps` to update them:'));
|
|
67
|
+
printDevHostVersions(devHostSrc);
|
|
47
68
|
execSync('npm install', { cwd: tmpDevHostFolder, stdio: 'inherit' });
|
|
48
69
|
execSync('npm run build', { cwd: tmpDevHostFolder, stdio: 'inherit' });
|
|
49
70
|
}
|
|
50
71
|
// 3. Copy build output to final output directory
|
|
51
|
-
console.log(chalk.magentaBright.bold(`\n[echo-dev-host] Copying build output to ${chalk.yellow(finalOutputDir)}...\n`));
|
|
72
|
+
console.log(chalk.magentaBright.bold(`\n[echo-dev-host] Copying build output back to ${chalk.yellow(finalOutputDir)}...\n`));
|
|
52
73
|
fs.copySync(buildOutput, finalOutputDir);
|
|
53
74
|
console.log(chalk.green.bold('[echo-dev-host] Build and copy complete!\n'));
|
|
54
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAndCopyDevHost.js","sourceRoot":"","sources":["../../../src/tools/buildScripts/buildAndCopyDevHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACtC,YAAY,EACZ,cAAc,EACd,eAAe,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"buildAndCopyDevHost.js","sourceRoot":"","sources":["../../../src/tools/buildScripts/buildAndCopyDevHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,MAAM,M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CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC,CAAC;QAC/G,OAAO,CAAC,GAAG,CACP,KAAK,CAAC,WAAW,CAAC,IAAI,CAClB,sHAAsH,CACzH,CACJ,CAAC;QACF,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACjC,QAAQ,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACrE,QAAQ,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,iDAAiD;IACjD,OAAO,CAAC,GAAG,CACP,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,kDAAkD,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAClH,CAAC;IAEF,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAEzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function printDevHostVersions(): void;
|
|
1
|
+
export declare function printDevHostVersions(devHostPkgPath: string): void;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
|
-
|
|
4
|
-
export function printDevHostVersions() {
|
|
5
|
-
// Check for node_modules/@equinor/echo-cli/echo-dev-host/package.json
|
|
6
|
-
const devHostPkgPath = path.resolve(process.cwd(), 'node_modules', '@equinor', 'echo-cli', 'echo-dev-host', 'package.json');
|
|
3
|
+
export function printDevHostVersions(devHostPkgPath) {
|
|
7
4
|
if (fs.existsSync(devHostPkgPath)) {
|
|
8
5
|
try {
|
|
9
6
|
const pkg = fs.readJsonSync(devHostPkgPath);
|
|
@@ -14,15 +11,15 @@ export function printDevHostVersions() {
|
|
|
14
11
|
});
|
|
15
12
|
}
|
|
16
13
|
else {
|
|
17
|
-
console.log(chalk.gray(
|
|
14
|
+
console.log(chalk.gray(`No @equinor/echo- libraries found in ${devHostPkgPath}.`));
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
catch (err) {
|
|
21
|
-
console.log(chalk.red(
|
|
18
|
+
console.log(chalk.red(`Could not read ${devHostPkgPath}. Is it valid JSON?`));
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
21
|
else {
|
|
25
|
-
console.log(chalk.red(
|
|
22
|
+
console.log(chalk.red(`Could not read echo lib version numbers: ${devHostPkgPath} not found.`));
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
//# sourceMappingURL=printDevHostVersions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printDevHostVersions.js","sourceRoot":"","sources":["../../src/utils/printDevHostVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"printDevHostVersions.js","sourceRoot":"","sources":["../../src/utils/printDevHostVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,MAAM,UAAU,oBAAoB,CAAC,cAAsB;IACvD,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC;YACD,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;YAC5C,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CACtE,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CACpC,CAAC;YACF,IAAI,QAAQ,CAAC,MAAM,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