@toolsplus/nx-forge 1.4.0 → 2.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 +14 -9
- package/executors.json +6 -0
- package/package.json +8 -9
- package/src/executors/build/executor.d.ts +1 -1
- package/src/executors/build/executor.js +14 -24
- package/src/executors/build/executor.js.map +1 -1
- package/src/executors/build/lib/compile-webpack.d.ts +3 -2
- package/src/executors/build/lib/compile-webpack.js +4 -3
- package/src/executors/build/lib/compile-webpack.js.map +1 -1
- package/src/executors/build/lib/copy-forge-app-assets.js +2 -2
- package/src/executors/build/lib/copy-forge-app-assets.js.map +1 -1
- package/src/executors/build/lib/generate-package-json.d.ts +1 -1
- package/src/executors/build/lib/generate-package-json.js +1 -1
- package/src/executors/build/lib/generate-package-json.js.map +1 -1
- package/src/executors/build/lib/patch-manifest-yml.js +2 -2
- package/src/executors/build/lib/patch-manifest-yml.js.map +1 -1
- package/src/executors/build/lib/process-custom-ui-dependencies.d.ts +1 -1
- package/src/executors/build/lib/process-custom-ui-dependencies.js +5 -4
- package/src/executors/build/lib/process-custom-ui-dependencies.js.map +1 -1
- package/src/executors/build/schema.json +3 -2
- package/src/executors/deploy/executor.js +15 -18
- package/src/executors/deploy/executor.js.map +1 -1
- package/src/executors/deploy/schema.json +8 -3
- package/src/executors/tunnel/executor.d.ts +14 -0
- package/src/executors/tunnel/executor.js +74 -0
- package/src/executors/tunnel/executor.js.map +1 -0
- package/src/executors/tunnel/lib/extract-custom-ui-projects.d.ts +11 -0
- package/src/executors/tunnel/lib/extract-custom-ui-projects.js +63 -0
- package/src/executors/tunnel/lib/extract-custom-ui-projects.js.map +1 -0
- package/src/executors/tunnel/lib/run-tunnel.d.ts +21 -0
- package/src/executors/tunnel/lib/run-tunnel.js +59 -0
- package/src/executors/tunnel/lib/run-tunnel.js.map +1 -0
- package/src/executors/tunnel/lib/wait-until-server-is-listening.d.ts +8 -0
- package/src/executors/tunnel/lib/wait-until-server-is-listening.js +52 -0
- package/src/executors/tunnel/lib/wait-until-server-is-listening.js.map +1 -0
- package/src/executors/tunnel/schema.d.ts +5 -0
- package/src/executors/tunnel/schema.json +30 -0
- package/src/generators/application/files/README.md +12 -2
- package/src/generators/application/generator.d.ts +1 -1
- package/src/generators/application/generator.js +5 -5
- package/src/generators/application/generator.js.map +1 -1
- package/src/generators/application/lib/add-project.d.ts +1 -1
- package/src/generators/application/lib/add-project.js +1 -6
- package/src/generators/application/lib/add-project.js.map +1 -1
- package/src/generators/application/lib/create-files.d.ts +1 -1
- package/src/generators/application/lib/create-files.js +3 -3
- package/src/generators/application/lib/create-files.js.map +1 -1
- package/src/generators/application/lib/get-build-config.d.ts +1 -1
- package/src/generators/application/lib/get-build-config.js +1 -1
- package/src/generators/application/lib/get-build-config.js.map +1 -1
- package/src/generators/application/lib/get-deploy-config.d.ts +1 -1
- package/src/generators/application/lib/get-deploy-config.js +1 -1
- package/src/generators/application/lib/get-deploy-config.js.map +1 -1
- package/src/generators/application/lib/get-serve-config.d.ts +1 -1
- package/src/generators/application/lib/get-serve-config.js +3 -12
- package/src/generators/application/lib/get-serve-config.js.map +1 -1
- package/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/src/generators/application/lib/normalize-options.js +2 -2
- package/src/generators/application/lib/normalize-options.js.map +1 -1
- package/src/generators/application/schema.json +11 -8
- package/src/generators/init/generator.d.ts +1 -1
- package/src/generators/init/generator.js +4 -7
- package/src/generators/init/generator.js.map +1 -1
- package/src/generators/init/lib/add-dependencies.d.ts +1 -1
- package/src/generators/init/lib/add-dependencies.js +1 -1
- package/src/generators/init/lib/add-dependencies.js.map +1 -1
- package/src/generators/init/schema.json +4 -2
- package/src/utils/forge/load-manifest-yml.js.map +1 -0
- package/src/executors/build/lib/load-manifest-yml.js.map +0 -1
- /package/src/{executors/build/lib → utils/forge}/load-manifest-yml.d.ts +0 -0
- /package/src/{executors/build/lib → utils/forge}/load-manifest-yml.js +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nx Forge
|
|
2
2
|
|
|
3
3
|
[Nx plugin](https://nx.dev) for [Atlassian Forge](https://developer.atlassian.com/platform/forge/) that aims to assist in efficient, scalable app development and remove the mental overhead of how to set up a Forge project.
|
|
4
4
|
Building on top of Nx means shared code can easily be extracted into libraries, and [Custom UI](https://developer.atlassian.com/platform/forge/custom-ui/) can be integrated into the app and dev workflow without having to break with the monorepo structure that Nx provides.
|
|
@@ -16,10 +16,9 @@ You will be asked if you would like to use Nx Cloud or not (either option is fin
|
|
|
16
16
|
Finally, make sure your workspace has the following packages (peer dependencies) installed
|
|
17
17
|
|
|
18
18
|
```shell
|
|
19
|
-
npm install --save-dev @
|
|
19
|
+
npm install --save-dev @nx/node
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
## Setting up
|
|
24
23
|
|
|
25
24
|
### Install the plugin
|
|
@@ -50,9 +49,9 @@ Replacing `<forge-app-name>` with the name of the app you're wanting to create.
|
|
|
50
49
|
|
|
51
50
|
### Add a Custom UI module
|
|
52
51
|
|
|
53
|
-
Forge apps require at least one module before they can be deployed. Let's start with a simple Custom UI module to get started. If you have not yet installed `@
|
|
52
|
+
Forge apps require at least one module before they can be deployed. Let's start with a simple Custom UI module to get started. If you have not yet installed `@nx/react` in your workspace call `npm i -D @nx/react`. This allows us to generate a React application for our Custom UI:
|
|
54
53
|
|
|
55
|
-
nx g @
|
|
54
|
+
nx g @nx/react:app <custom-ui-app-name>
|
|
56
55
|
|
|
57
56
|
> Hint: You can use the `--dry-run` flag to see what will be generated.
|
|
58
57
|
|
|
@@ -67,7 +66,7 @@ To get this React app working as a Forge Custom UI update the `apps/<custom-ui-a
|
|
|
67
66
|
"projectType": "application",
|
|
68
67
|
"targets": {
|
|
69
68
|
"build": {
|
|
70
|
-
"executor": "@
|
|
69
|
+
"executor": "@nx/webpack:webpack",
|
|
71
70
|
"outputs": ["{options.outputPath}"],
|
|
72
71
|
"defaultConfiguration": "production",
|
|
73
72
|
"options": {
|
|
@@ -121,9 +120,7 @@ Finally, update the `apps/<forge-app-name>/project.json` file in the generated F
|
|
|
121
120
|
"root": "apps/<forge-app-name>",
|
|
122
121
|
"sourceRoot": "apps/<forge-app-name>/src",
|
|
123
122
|
"projectType": "application",
|
|
124
|
-
"targets": {
|
|
125
|
-
|
|
126
|
-
},
|
|
123
|
+
"targets": {...},
|
|
127
124
|
"implicitDependencies": ["<custom-ui-app-name>"]
|
|
128
125
|
}
|
|
129
126
|
```
|
|
@@ -159,6 +156,14 @@ That's it for the setup steps. You can now generate additional Custom UI resourc
|
|
|
159
156
|
|
|
160
157
|
Run `nx build <forge-app-name>` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
161
158
|
|
|
159
|
+
### Deploy
|
|
160
|
+
|
|
161
|
+
Run `nx deploy <forge-app-name>` to deploy the project. The build artifacts will be deployed using the Forge CLI deploy command.
|
|
162
|
+
|
|
163
|
+
### Tunnel
|
|
164
|
+
|
|
165
|
+
Run `nx serve <forge-app-name>` to serve the project. This will start the `serve` target for all Custom UI projects defined in the app `manifest.yml` on their specified tunnel port. After that, it will start a build process in watch mode for the Forge app itself, before ultimately, starting the `forge tunnel` process for the Forge app.
|
|
166
|
+
|
|
162
167
|
## Further help on how to develop with Nx
|
|
163
168
|
|
|
164
169
|
Visit the [Nx Documentation](https://nx.dev) to learn more.
|
package/executors.json
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"implementation": "./src/executors/deploy/executor",
|
|
11
11
|
"schema": "./src/executors/deploy/schema.json",
|
|
12
12
|
"description": "deploy executor"
|
|
13
|
+
},
|
|
14
|
+
"tunnel": {
|
|
15
|
+
"implementation": "./src/executors/tunnel/executor",
|
|
16
|
+
"schema": "./src/executors/tunnel/schema.json",
|
|
17
|
+
"description": "tunnel executor"
|
|
13
18
|
}
|
|
19
|
+
|
|
14
20
|
}
|
|
15
21
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolsplus/nx-forge",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Atlassian Forge plugin for Nx",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"generators": "./generators.json",
|
|
7
7
|
"executors": "./executors.json",
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@
|
|
10
|
-
"@
|
|
9
|
+
"@nx/node": "^16.0.0",
|
|
10
|
+
"@nx/workspace": "^16.0.0"
|
|
11
11
|
},
|
|
12
|
-
"types": "./src/index.d.ts",
|
|
13
12
|
"dependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"
|
|
16
|
-
"js-yaml": "4.1.0"
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
"@forge/manifest": "^4.4.1",
|
|
14
|
+
"fs-extra": "^10.0.1",
|
|
15
|
+
"js-yaml": "^4.1.0"
|
|
16
|
+
},
|
|
17
|
+
"types": "./src/index.d.ts"
|
|
19
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExecutorContext } from '@
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import { BuildExecutorOptions } from './schema';
|
|
3
3
|
export default function runExecutor(rawOptions: BuildExecutorOptions, context: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
@@ -5,26 +5,10 @@ const normalize_options_1 = require("./lib/normalize-options");
|
|
|
5
5
|
const process_custom_ui_dependencies_1 = require("./lib/process-custom-ui-dependencies");
|
|
6
6
|
const patch_manifest_yml_1 = require("./lib/patch-manifest-yml");
|
|
7
7
|
const generate_package_json_1 = require("./lib/generate-package-json");
|
|
8
|
-
const project_graph_1 = require("@nrwl/workspace/src/core/project-graph");
|
|
9
8
|
const compile_webpack_1 = require("./lib/compile-webpack");
|
|
10
9
|
const copy_forge_app_assets_1 = require("./lib/copy-forge-app-assets");
|
|
11
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
12
|
-
/**
|
|
13
|
-
* Try to read a cached project graph. If it does not exist
|
|
14
|
-
* trigger creation to ensure the project graph exists.
|
|
15
|
-
*/
|
|
16
|
-
function readOrCreateProjectGraph() {
|
|
17
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
try {
|
|
19
|
-
return (0, project_graph_1.readCachedProjectGraph)();
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
return (0, devkit_1.createProjectGraphAsync)();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
10
|
function runExecutor(rawOptions, context) {
|
|
27
|
-
var e_1,
|
|
11
|
+
var _a, e_1, _b, _c;
|
|
28
12
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
13
|
const { root, sourceRoot } = context.workspace.projects[context.projectName];
|
|
30
14
|
if (!sourceRoot) {
|
|
@@ -36,25 +20,31 @@ function runExecutor(rawOptions, context) {
|
|
|
36
20
|
const options = (0, normalize_options_1.normalizeOptions)(rawOptions, context.root, sourceRoot, root);
|
|
37
21
|
const compilation = (0, compile_webpack_1.compileWebpack)(options, context);
|
|
38
22
|
try {
|
|
39
|
-
for (var compilation_1 = tslib_1.__asyncValues(compilation), compilation_1_1; compilation_1_1 = yield compilation_1.next(),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
for (var _d = true, compilation_1 = tslib_1.__asyncValues(compilation), compilation_1_1; compilation_1_1 = yield compilation_1.next(), _a = compilation_1_1.done, !_a;) {
|
|
24
|
+
_c = compilation_1_1.value;
|
|
25
|
+
_d = false;
|
|
26
|
+
try {
|
|
27
|
+
const result = _c;
|
|
28
|
+
if (!result.success) {
|
|
29
|
+
throw new Error(`Failed to compile files for project ${context.projectName}.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
_d = true;
|
|
43
34
|
}
|
|
44
35
|
}
|
|
45
36
|
}
|
|
46
37
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
47
38
|
finally {
|
|
48
39
|
try {
|
|
49
|
-
if (
|
|
40
|
+
if (!_d && !_a && (_b = compilation_1.return)) yield _b.call(compilation_1);
|
|
50
41
|
}
|
|
51
42
|
finally { if (e_1) throw e_1.error; }
|
|
52
43
|
}
|
|
53
44
|
(0, copy_forge_app_assets_1.copyForgeAppAssets)(options);
|
|
54
45
|
const customUIResources = yield (0, process_custom_ui_dependencies_1.processCustomUIDependencies)(options, context);
|
|
55
46
|
yield (0, patch_manifest_yml_1.patchManifestYml)(options);
|
|
56
|
-
|
|
57
|
-
(0, generate_package_json_1.generatePackageJson)(context.projectName, projectGraph, customUIResources, options);
|
|
47
|
+
(0, generate_package_json_1.generatePackageJson)(context.projectName, context.projectGraph, customUIResources, options);
|
|
58
48
|
console.log('Executor ran for build');
|
|
59
49
|
return {
|
|
60
50
|
success: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/forge/src/executors/build/executor.ts"],"names":[],"mappings":";;;AAEA,+DAA2D;AAC3D,yFAAmF;AACnF,iEAA4D;AAC5D,uEAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/forge/src/executors/build/executor.ts"],"names":[],"mappings":";;;AAEA,+DAA2D;AAC3D,yFAAmF;AACnF,iEAA4D;AAC5D,uEAAkE;AAClE,2DAAuD;AACvD,uEAAiE;AAEjE,SAA8B,WAAW,CACvC,UAAgC,EAChC,OAAwB;;;QAExB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE7E,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,WAAW,8BAA8B,CAAC,CAAC;SACvE;QAED,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,WAAW,wBAAwB,CAAC,CAAC;SACjE;QAED,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,UAAU,EAAE,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7E,MAAM,WAAW,GAAG,IAAA,gCAAc,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;;YAErD,KAA2B,eAAA,gBAAA,sBAAA,WAAW,CAAA,iBAAA;gBAAX,2BAAW;gBAAX,WAAW;;oBAA3B,MAAM,MAAM,KAAA,CAAA;oBACrB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,MAAM,IAAI,KAAK,CACb,uCAAuC,OAAO,CAAC,WAAW,GAAG,CAC9D,CAAC;qBACH;;;;;aACF;;;;;;;;;QAED,IAAA,0CAAkB,EAAC,OAAO,CAAC,CAAC;QAC5B,MAAM,iBAAiB,GAAG,MAAM,IAAA,4DAA2B,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9E,MAAM,IAAA,qCAAgB,EAAC,OAAO,CAAC,CAAC;QAChC,IAAA,2CAAmB,EACjB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,YAAY,EACpB,iBAAiB,EACjB,OAAO,CACR,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;;CACH;AAvCD,8BAuCC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { ExecutorContext } from '@
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { WebpackExecutorEvent } from '@nx/webpack';
|
|
2
3
|
import { NormalizedOptions } from '../schema';
|
|
3
|
-
export declare function compileWebpack(options: NormalizedOptions, context: ExecutorContext): AsyncGenerator<
|
|
4
|
+
export declare function compileWebpack(options: NormalizedOptions, context: ExecutorContext): AsyncGenerator<WebpackExecutorEvent>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compileWebpack = void 0;
|
|
4
|
-
const devkit_1 = require("@
|
|
5
|
-
const
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const webpack_1 = require("@nx/webpack");
|
|
6
6
|
function compileWebpack(options, context) {
|
|
7
7
|
const builderOptions = {
|
|
8
|
+
target: 'node',
|
|
8
9
|
outputPath: (0, devkit_1.joinPathFragments)(options.outputPath, 'src'),
|
|
9
10
|
outputFileName: 'index.js',
|
|
10
11
|
tsConfig: `${options.projectRoot}/tsconfig.app.json`,
|
|
@@ -17,7 +18,7 @@ function compileWebpack(options, context) {
|
|
|
17
18
|
extractLicenses: false,
|
|
18
19
|
externalDependencies: 'all',
|
|
19
20
|
};
|
|
20
|
-
return (0,
|
|
21
|
+
return (0, webpack_1.webpackExecutor)(builderOptions, context);
|
|
21
22
|
}
|
|
22
23
|
exports.compileWebpack = compileWebpack;
|
|
23
24
|
//# sourceMappingURL=compile-webpack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-webpack.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/compile-webpack.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"compile-webpack.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/compile-webpack.ts"],"names":[],"mappings":";;;AAAA,uCAAgE;AAEhE,yCAAoE;AAGpE,SAAgB,cAAc,CAC5B,OAA0B,EAC1B,OAAwB;IAExB,MAAM,cAAc,GAA2B;QAC7C,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,IAAA,0BAAiB,EAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;QACxD,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE,GAAG,OAAO,CAAC,WAAW,oBAAoB;QACpD,IAAI,EAAE,GAAG,OAAO,CAAC,WAAW,eAAe;QAC3C,mBAAmB,EAAE,KAAK;QAC1B,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,YAAY,EAAE,EAAE;QAChB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,KAAK;QACtB,oBAAoB,EAAE,KAAK;KAC5B,CAAC;IAEF,OAAO,IAAA,yBAAe,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC;AApBD,wCAoBC"}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.copyForgeAppAssets = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
-
const devkit_1 = require("@
|
|
7
|
-
const fileutils_1 = require("@
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const fileutils_1 = require("@nx/workspace/src/utilities/fileutils");
|
|
8
8
|
function copyForgeAppAssets(options) {
|
|
9
9
|
devkit_1.logger.info('Copying Forge app assets...');
|
|
10
10
|
if (!(0, fileutils_1.directoryExists)(options.outputPath)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-forge-app-assets.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/copy-forge-app-assets.ts"],"names":[],"mappings":";;;AAAA,2BAA6C;AAC7C,+BAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"copy-forge-app-assets.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/copy-forge-app-assets.ts"],"names":[],"mappings":";;;AAAA,2BAA6C;AAC7C,+BAA4B;AAC5B,uCAAoC;AACpC,qEAAwE;AAGxE,SAAgB,kBAAkB,CAAC,OAA0B;IAC3D,eAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAE3C,IAAI,CAAC,IAAA,2BAAe,EAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACxC,IAAA,cAAS,EAAC,OAAO,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACpD;IAED,8EAA8E;IAC9E,0BAA0B;IAC1B,IAAA,iBAAY,EACV,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,EACvD,IAAA,WAAI,EAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CACzC,CAAC;IAEF,eAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AAChD,CAAC;AAfD,gDAeC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generatePackageJson = void 0;
|
|
4
|
-
const devkit_1 = require("@
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const object_sort_1 = require("nx/src/utils/object-sort");
|
|
6
6
|
/**
|
|
7
7
|
* Merges the existing package.json details with a generated package.json that includes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-package-json.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/generate-package-json.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generate-package-json.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/generate-package-json.ts"],"names":[],"mappings":";;;AACA,uCAAyE;AACzE,0DAA4D;AAI5D;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,KAAmB,EACnB,iBAA4B,EAC5B,OAA0B;;IAE1B,MAAM,WAAW,GAAG,iBAAiB,CACnC,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,OAAO,CACR,CAAC;IACF,WAAW,CAAC,IAAI,GAAG,MAAA,WAAW,CAAC,IAAI,mCAAI,OAAO,CAAC,cAAc,CAAC;IAC9D,OAAO,WAAW,C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AAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,IAAI,CAAC;KACb;AACH,CAAC"}
|
|
@@ -4,8 +4,8 @@ exports.patchManifestYml = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const js_yaml_1 = require("js-yaml");
|
|
7
|
-
const devkit_1 = require("@
|
|
8
|
-
const load_manifest_yml_1 = require("
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const load_manifest_yml_1 = require("../../../utils/forge/load-manifest-yml");
|
|
9
9
|
/**
|
|
10
10
|
* Patches the output manifest.yml file to replace resource path parameters to point to the actual Custom UI build
|
|
11
11
|
* artifacts instead of the Nx project reference.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-manifest-yml.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/patch-manifest-yml.ts"],"names":[],"mappings":";;;;AAAA,2BAAmC;AACnC,qCAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"patch-manifest-yml.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/patch-manifest-yml.ts"],"names":[],"mappings":";;;;AAAA,2BAAmC;AACnC,qCAA+B;AAC/B,uCAAuD;AAIvD,8EAAyE;AAEzE;;;;;;;GAOG;AACH,SAAsB,gBAAgB,CAAC,OAA0B;;QAC/D,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAE3E,eAAM,CAAC,IAAI,CAAC,YAAY,YAAY,KAAK,CAAC,CAAC;QAE3C,MAAM,cAAc,GAAG,MAAM,IAAA,mCAAe,EAAC,YAAY,CAAC,CAAC;QAE3D,MAAM,SAAS,GAAc,cAAc,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5D,MAAM,eAAe,mCAChB,cAAc,KACjB,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,GACxE,CAAC;QAEF,MAAM,sBAAsB,GAAG,IAAA,cAAI,EAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACzD,IAAA,kBAAa,EAAC,YAAY,EAAE,sBAAsB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAE1E,eAAM,CAAC,IAAI,CAAC,iBAAiB,YAAY,GAAG,CAAC,CAAC;IAChD,CAAC;CAAA;AAjBD,4CAiBC;AAED,SAAS,aAAa,CACpB,YAAoB,EACpB,QAA+B;IAE/B,uCACK,QAAQ,KACX,IAAI,EAAE,GAAG,YAAY,IAAI,QAAQ,CAAC,IAAI,EAAE,IACxC;AACJ,CAAC"}
|
|
@@ -4,8 +4,8 @@ exports.processCustomUIDependencies = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
|
-
const devkit_1 = require("@
|
|
8
|
-
const load_manifest_yml_1 = require("
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const load_manifest_yml_1 = require("../../../utils/forge/load-manifest-yml");
|
|
9
9
|
/**
|
|
10
10
|
* Verifies that Custom UI projects are correctly linked to the Nx Forge app and copies build artifacts into the app's
|
|
11
11
|
* output directory.
|
|
@@ -19,10 +19,11 @@ const load_manifest_yml_1 = require("./load-manifest-yml");
|
|
|
19
19
|
* @param context Executor context
|
|
20
20
|
*/
|
|
21
21
|
function processCustomUIDependencies(options, context) {
|
|
22
|
+
var _a;
|
|
22
23
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
24
|
const manifestPath = (0, devkit_1.joinPathFragments)(context.root, 'apps', context.projectName, 'manifest.yml');
|
|
24
25
|
const manifestSchema = yield (0, load_manifest_yml_1.loadManifestYml)(manifestPath);
|
|
25
|
-
const resources = manifestSchema.resources
|
|
26
|
+
const resources = (_a = manifestSchema.resources) !== null && _a !== void 0 ? _a : [];
|
|
26
27
|
resources.forEach((r) => verifyAndCopyCustomUIDependency(r, context, options));
|
|
27
28
|
return resources;
|
|
28
29
|
});
|
|
@@ -33,7 +34,7 @@ const verifyAndCopyCustomUIDependency = (resource, context, options) => {
|
|
|
33
34
|
const customUIProjectName = resource.path;
|
|
34
35
|
const customUIProjectConfiguration = context.workspace.projects[customUIProjectName];
|
|
35
36
|
if (!customUIProjectConfiguration) {
|
|
36
|
-
throw new Error(`Nx workspace is missing project for
|
|
37
|
+
throw new Error(`Nx workspace is missing project for Custom UI path ${customUIProjectName}. Make sure the Custom UI resource path references a project in your Nx workspace.`);
|
|
37
38
|
}
|
|
38
39
|
if (!((_a = context.workspace.projects[context.projectName].implicitDependencies) === null || _a === void 0 ? void 0 : _a.includes(customUIProjectName))) {
|
|
39
40
|
throw new Error(`Project ${customUIProjectName} is configured as Forge Custom UI resource but not listed as implicit dependency of the Forge project (${context.projectName}). Add ${customUIProjectName} to the 'implicitDependencies' array in this project's 'project.json', or remove the Custom UI resource from the app's manifest.yml.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-custom-ui-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/process-custom-ui-dependencies.ts"],"names":[],"mappings":";;;;AAAA,uCAAoC;AACpC,2BAA6C;AAE7C,
|
|
1
|
+
{"version":3,"file":"process-custom-ui-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/forge/src/executors/build/lib/process-custom-ui-dependencies.ts"],"names":[],"mappings":";;;;AAAA,uCAAoC;AACpC,2BAA6C;AAE7C,uCAAuD;AAIvD,8EAAyE;AAEzE;;;;;;;;;;;GAWG;AACH,SAAsB,2BAA2B,CAC/C,OAA0B,EAC1B,OAAwB;;;QAExB,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,OAAO,CAAC,IAAI,EACZ,MAAM,EACN,OAAO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C,CAAC,MAAM,KAAK,CAAC,EAC/D;QACA,MAAM,IAAI,KAAK,CACb,WAAW,mBAAmB,mGAAmG,CAClI,CAAC;KACH;IAED,eAAM,CAAC,IAAI,CAAC,WAAW,mBAAmB,+BAA+B,CAAC,CAAC;IAC3E,IAAA,mBAAQ,EACN,qCAAqC,EACrC,IAAA,0BAAiB,EACf,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,YAAY,EACpB,mBAAmB,CACpB,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;IACF,eAAM,CAAC,IAAI,CAAC,gBAAgB,mBAAmB,6BAA6B,CAAC,CAAC;AAChF,CAAC,CAAC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"version": 2,
|
|
3
3
|
"outputCapture": "direct-nodejs",
|
|
4
4
|
"$schema": "http://json-schema.org/schema",
|
|
5
|
-
"cli": "nx",
|
|
6
5
|
"title": "Forge application build target",
|
|
7
6
|
"description": "Forge application build target options for Build Facade",
|
|
8
7
|
"type": "object",
|
|
@@ -21,5 +20,7 @@
|
|
|
21
20
|
"default": false
|
|
22
21
|
}
|
|
23
22
|
},
|
|
24
|
-
"required": [
|
|
23
|
+
"required": [
|
|
24
|
+
"outputPath"
|
|
25
|
+
]
|
|
25
26
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
|
-
const devkit_1 = require("@
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
function runExecutor(options) {
|
|
7
7
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
8
|
const args = [
|
|
@@ -19,7 +19,20 @@ function runExecutor(options) {
|
|
|
19
19
|
cwd: options.outputPath,
|
|
20
20
|
stdio: [process.stdin, process.stdout, process.stderr],
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
// https://2ality.com/2018/05/child-process-streams.html#waiting-for-a-child-process-to-exit-via-a-promise
|
|
23
|
+
yield new Promise((resolve, reject) => {
|
|
24
|
+
deploymentProcess.once('exit', (code) => {
|
|
25
|
+
if (code === 0) {
|
|
26
|
+
resolve(undefined);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
reject(new Error('Exit with error code: ' + code));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
deploymentProcess.once('error', (err) => {
|
|
33
|
+
reject(err);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
23
36
|
devkit_1.logger.log('✅ Forge app deployed');
|
|
24
37
|
return {
|
|
25
38
|
success: true,
|
|
@@ -27,20 +40,4 @@ function runExecutor(options) {
|
|
|
27
40
|
});
|
|
28
41
|
}
|
|
29
42
|
exports.default = runExecutor;
|
|
30
|
-
// https://2ality.com/2018/05/child-process-streams.html#waiting-for-a-child-process-to-exit-via-a-promise
|
|
31
|
-
function onExit(childProcess) {
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
childProcess.once('exit', (code) => {
|
|
34
|
-
if (code === 0) {
|
|
35
|
-
resolve(undefined);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
reject(new Error('Exit with error code: ' + code));
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
childProcess.once('error', (err) => {
|
|
42
|
-
reject(err);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
43
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/forge/src/executors/deploy/executor.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/forge/src/executors/deploy/executor.ts"],"names":[],"mappings":";;;AAAA,iDAAsC;AACtC,uCAAoC;AAGpC,SAA8B,WAAW,CAAC,OAA8B;;QACtE,MAAM,IAAI,G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CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,eAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;CAAA;AApCD,8BAoCC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"version": 2,
|
|
3
3
|
"outputCapture": "direct-nodejs",
|
|
4
4
|
"$schema": "http://json-schema.org/schema",
|
|
5
|
-
"cli": "nx",
|
|
6
5
|
"title": "Forge application deploy target",
|
|
7
6
|
"description": "Forge application deploy target",
|
|
8
7
|
"type": "object",
|
|
@@ -14,7 +13,11 @@
|
|
|
14
13
|
},
|
|
15
14
|
"environment": {
|
|
16
15
|
"type": "string",
|
|
17
|
-
"enum": [
|
|
16
|
+
"enum": [
|
|
17
|
+
"development",
|
|
18
|
+
"staging",
|
|
19
|
+
"production"
|
|
20
|
+
],
|
|
18
21
|
"description": "Environment to deploy to: development, staging, production.",
|
|
19
22
|
"alias": "e",
|
|
20
23
|
"default": "development"
|
|
@@ -36,5 +39,7 @@
|
|
|
36
39
|
"default": false
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
|
-
"required": [
|
|
42
|
+
"required": [
|
|
43
|
+
"outputPath"
|
|
44
|
+
]
|
|
40
45
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { TunnelExecutorOptions } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* Forge tunnel executor that serves all Custom UI projects in the manifest.yml
|
|
5
|
+
* on the tunnel port configured in the manifest.yml.
|
|
6
|
+
*
|
|
7
|
+
* Additionally, this will start a build process for the Forge app in watch mode
|
|
8
|
+
* and launch the `forge tunnel` command in the configured output directory.
|
|
9
|
+
*
|
|
10
|
+
* @see https://github.com/nrwl/nx/issues/3748#issuecomment-990980640
|
|
11
|
+
* @see https://gist.github.com/chrisui/a3cdf050bf18eccd499fba29b609b90a
|
|
12
|
+
* @see https://github.com/nrwl/nx/blob/cded83b2c5bf3e4252c03d4dbcbb5b203b0faed0/packages/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl.ts
|
|
13
|
+
*/
|
|
14
|
+
export default function runTunnelExecutor(options: TunnelExecutorOptions, context: ExecutorContext): Promise<any>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
6
|
+
const run_tunnel_1 = require("./lib/run-tunnel");
|
|
7
|
+
const extract_custom_ui_projects_1 = require("./lib/extract-custom-ui-projects");
|
|
8
|
+
/**
|
|
9
|
+
* Forge tunnel executor that serves all Custom UI projects in the manifest.yml
|
|
10
|
+
* on the tunnel port configured in the manifest.yml.
|
|
11
|
+
*
|
|
12
|
+
* Additionally, this will start a build process for the Forge app in watch mode
|
|
13
|
+
* and launch the `forge tunnel` command in the configured output directory.
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/nrwl/nx/issues/3748#issuecomment-990980640
|
|
16
|
+
* @see https://gist.github.com/chrisui/a3cdf050bf18eccd499fba29b609b90a
|
|
17
|
+
* @see https://github.com/nrwl/nx/blob/cded83b2c5bf3e4252c03d4dbcbb5b203b0faed0/packages/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl.ts
|
|
18
|
+
*/
|
|
19
|
+
function runTunnelExecutor(options, context) {
|
|
20
|
+
var _a, e_1, _b, _c;
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const customUiProjectConfigs = yield (0, extract_custom_ui_projects_1.getCustomUiProjects)(context);
|
|
23
|
+
let runAllCustomUiServe = undefined;
|
|
24
|
+
if (customUiProjectConfigs.length > 0) {
|
|
25
|
+
const [customUiHeadConfig, ...customUiRestConfig] = customUiProjectConfigs;
|
|
26
|
+
// execute the serve target on custom UI projects
|
|
27
|
+
runAllCustomUiServe = yield (0, devkit_1.runExecutor)({ project: customUiHeadConfig.projectName, target: 'serve' }, { port: customUiHeadConfig.port }, context);
|
|
28
|
+
for (const { projectName, port } of customUiRestConfig !== null && customUiRestConfig !== void 0 ? customUiRestConfig : []) {
|
|
29
|
+
runAllCustomUiServe = (0, async_iterable_1.combineAsyncIterables)(runAllCustomUiServe, yield (0, devkit_1.runExecutor)({ project: projectName, target: 'serve' }, { port }, context));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const runForgeAppBuild = yield (0, devkit_1.runExecutor)({ project: context.projectName, target: 'build' }, { watch: true }, context);
|
|
33
|
+
// execute the tunnel target on the focused project
|
|
34
|
+
const runForgeTunnel = promiseToIterator((0, run_tunnel_1.default)(Object.assign(Object.assign({}, options), { customUiProjectConfigs }), context));
|
|
35
|
+
// once all executors are loaded, watch out for any failures
|
|
36
|
+
// we combine (interleave) all executor iterators here
|
|
37
|
+
const combined = (0, async_iterable_1.combineAsyncIterables)(runAllCustomUiServe, runForgeAppBuild, runForgeTunnel);
|
|
38
|
+
try {
|
|
39
|
+
try {
|
|
40
|
+
for (var _d = true, combined_1 = tslib_1.__asyncValues(combined), combined_1_1; combined_1_1 = yield combined_1.next(), _a = combined_1_1.done, !_a;) {
|
|
41
|
+
_c = combined_1_1.value;
|
|
42
|
+
_d = false;
|
|
43
|
+
try {
|
|
44
|
+
const output = _c;
|
|
45
|
+
if (!output.success)
|
|
46
|
+
return output;
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
_d = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
54
|
+
finally {
|
|
55
|
+
try {
|
|
56
|
+
if (!_d && !_a && (_b = combined_1.return)) yield _b.call(combined_1);
|
|
57
|
+
}
|
|
58
|
+
finally { if (e_1) throw e_1.error; }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
devkit_1.logger.error(`Failed to tunnel Forge app: ${err}`);
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
65
|
+
return { success: true };
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.default = runTunnelExecutor;
|
|
69
|
+
function promiseToIterator(v) {
|
|
70
|
+
return tslib_1.__asyncGenerator(this, arguments, function* promiseToIterator_1() {
|
|
71
|
+
yield yield tslib_1.__await(yield tslib_1.__await(v));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/forge/src/executors/tunnel/executor.ts"],"names":[],"mappings":";;;AAAA,uCAAkE;AAClE,wEAA4E;AAE5E,iDAAyC;AACzC,iFAAuE;AAEvE;;;;;;;;;;GAUG;AACH,SAA8B,iBAAiB,CAC7C,OAA8B,EAC9B,OAAwB;;;QAExB,MAAM,sBAAsB,GAAG,MAAM,IAAA,gDAAmB,EAAC,OAAO,CAAC,CAAC;QAClE,IAAI,mBAAmB,GAAG,SAAS,CAAC;QAEpC,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE;YACrC,MAAM,CAAC,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,GAAG,sBAAsB,CAAC;YAE3E,iDAAiD;YACjD,mBAAmB,GAAG,MAAM,IAAA,oBAAW,EACrC,EAAE,OAAO,EAAE,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,EAC5D,EAAE,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,EACjC,OAAO,CACR,CAAC;YAEF,KAAK,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,EAAE,EAAE;gBAC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el port for this Forge app.
|
|
4
|
+
*
|
|
5
|
+
* @param context Executor context for this call
|
|
6
|
+
* @returns Custom UI project names and the tunnel port on which they are required to serve their dev server.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCustomUiProjects(context: ExecutorContext): Promise<{
|
|
9
|
+
projectName: string;
|
|
10
|
+
port: number;
|
|
11
|
+
}[]>;
|