@toolsplus/nx-forge 6.0.0-beta.1 → 6.0.1-beta.1
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/package.json +1 -1
- package/src/executors/build/lib/patch-manifest-yml.d.ts +5 -3
- package/src/executors/build/lib/patch-manifest-yml.js +37 -64
- package/src/executors/build/lib/patch-manifest-yml.js.map +1 -1
- package/src/executors/build/lib/process-resource-dependencies.d.ts +5 -3
- package/src/executors/build/lib/process-resource-dependencies.js +9 -5
- package/src/executors/build/lib/process-resource-dependencies.js.map +1 -1
- package/src/executors/build/schema.json +1 -1
- package/src/executors/package/schema.json +1 -1
- package/src/executors/tunnel/executor.d.ts +5 -4
- package/src/executors/tunnel/executor.js +31 -25
- package/src/executors/tunnel/executor.js.map +1 -1
- package/src/executors/tunnel/lib/extract-custom-ui-projects.js +7 -5
- package/src/executors/tunnel/lib/extract-custom-ui-projects.js.map +1 -1
- package/src/executors/tunnel/lib/run-tunnel.d.ts +17 -1
- package/src/executors/tunnel/lib/run-tunnel.js +71 -10
- package/src/executors/tunnel/lib/run-tunnel.js.map +1 -1
- package/src/executors/tunnel/lib/start-custom-uis.d.ts +7 -0
- package/src/executors/tunnel/lib/start-custom-uis.js +15 -0
- package/src/executors/tunnel/lib/start-custom-uis.js.map +1 -0
- package/src/executors/tunnel/schema.d.ts +1 -0
- package/src/executors/tunnel/schema.json +6 -0
- package/src/generators/application/files/webpack.config.js__tmpl__ +5 -0
- package/src/graph/create-dependencies.js +12 -12
- package/src/graph/create-dependencies.js.map +1 -1
- package/src/graph/create-nodes.js +2 -2
- package/src/graph/create-nodes.js.map +1 -1
- package/src/migrations/update-2-3-0/remove-implicit-custom-ui-dependencies.js +3 -3
- package/src/migrations/update-2-3-0/remove-implicit-custom-ui-dependencies.js.map +1 -1
- package/src/shared/manifest/util-manifest.d.ts +39 -0
- package/src/shared/manifest/util-manifest.js +90 -0
- package/src/shared/manifest/util-manifest.js.map +1 -0
- package/src/shared/targets/get-tunnel-config.d.ts +6 -0
- package/src/shared/targets/{get-serve-config.js → get-tunnel-config.js} +3 -3
- package/src/shared/targets/get-tunnel-config.js.map +1 -0
- package/src/utils/forge/manifest-yml.d.ts +4 -4
- package/src/utils/forge/manifest-yml.js +11 -10
- package/src/utils/forge/manifest-yml.js.map +1 -1
- package/src/shared/targets/get-serve-config.d.ts +0 -6
- package/src/shared/targets/get-serve-config.js.map +0 -1
package/package.json
CHANGED
|
@@ -3,10 +3,12 @@ type Options = Pick<NormalizedOptions, 'root' | 'outputPath' | 'uiKit2Packaging'
|
|
|
3
3
|
resourcePath: string;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
|
-
* Patches the output manifest.yml file to replace resource path parameters to
|
|
7
|
-
* artifacts instead of the Nx project
|
|
6
|
+
* Patches the output manifest.yml file to replace resource path parameters to
|
|
7
|
+
* point to the actual resource build artifacts instead of the Nx project
|
|
8
|
+
* reference.
|
|
8
9
|
*
|
|
9
|
-
* This assumes that resource artifacts have already been copied to the output
|
|
10
|
+
* This assumes that resource artifacts have already been copied to the output
|
|
11
|
+
* directory in a previous step.
|
|
10
12
|
*
|
|
11
13
|
* @param options Executor options
|
|
12
14
|
*/
|
|
@@ -6,11 +6,14 @@ const path_1 = require("path");
|
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const manifest_yml_1 = require("../../../utils/forge/manifest-yml");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
+
const util_manifest_1 = require("../../../shared/manifest/util-manifest");
|
|
9
10
|
/**
|
|
10
|
-
* Patches the output manifest.yml file to replace resource path parameters to
|
|
11
|
-
* artifacts instead of the Nx project
|
|
11
|
+
* Patches the output manifest.yml file to replace resource path parameters to
|
|
12
|
+
* point to the actual resource build artifacts instead of the Nx project
|
|
13
|
+
* reference.
|
|
12
14
|
*
|
|
13
|
-
* This assumes that resource artifacts have already been copied to the output
|
|
15
|
+
* This assumes that resource artifacts have already been copied to the output
|
|
16
|
+
* directory in a previous step.
|
|
14
17
|
*
|
|
15
18
|
* @param options Executor options
|
|
16
19
|
*/
|
|
@@ -26,72 +29,42 @@ function patchManifestYml(options) {
|
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
function patchManifestInternal(absoluteOutputPath, manifestSchema, options) {
|
|
29
|
-
var _a;
|
|
30
32
|
const resources = manifestSchema.resources || [];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const uiResources = resources.filter((0, util_manifest_1.isResourceType)(manifestSchema, ['ui-kit', 'custom-ui']));
|
|
34
|
+
const genericResources = resources.filter((0, util_manifest_1.isResourceType)(manifestSchema, ['generic']));
|
|
35
|
+
// Integrity check: We want to be sure that we are not losing any resource
|
|
36
|
+
// definitions when separating them into UI and generic resources.
|
|
37
|
+
const resourceKeySet = new Set(resources.map((r) => r.key));
|
|
38
|
+
const uiResourcesKeySet = new Set(uiResources.map((r) => r.key));
|
|
39
|
+
const genericResourcesKeySet = new Set(genericResources.map((r) => r.key));
|
|
40
|
+
const missingResourceKeys = [...resourceKeySet].filter((k) => !uiResourcesKeySet.has(k) && !genericResourcesKeySet.has(k));
|
|
41
|
+
if (missingResourceKeys.length > 0) {
|
|
42
|
+
devkit_1.logger.warn(`Failed to determine resource type for resource definitions with keys ${missingResourceKeys}.
|
|
43
|
+
|
|
44
|
+
This is most likely a plugin error and should be fixed. Please include the manifest.yml in the issue report.`);
|
|
37
45
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* property, it means the resource must be a Custom UI.
|
|
44
|
-
*
|
|
45
|
-
* @param modules Modules declared in the manifest
|
|
46
|
-
* @param resources Resources declared in the manifest
|
|
47
|
-
*/
|
|
48
|
-
function getResourceTypeIndex(modules, resources) {
|
|
49
|
-
const modulesEntries = Object.entries(modules);
|
|
50
|
-
const resourceKeys = resources.map((r) => r.key);
|
|
51
|
-
const indexModuleDefinition = (acc, moduleType, moduleDefinition) => {
|
|
52
|
-
var _a;
|
|
53
|
-
const moduleResourceKey = moduleDefinition['resource'];
|
|
54
|
-
if (resourceKeys.includes(moduleResourceKey)) {
|
|
55
|
-
const type = moduleDefinition['render'] === 'native' ? 'ui-kit-2' : 'custom-ui';
|
|
56
|
-
const existingIndexEntry = acc[moduleResourceKey];
|
|
57
|
-
if (existingIndexEntry && existingIndexEntry.type !== type) {
|
|
58
|
-
devkit_1.logger.warn(`Inconsistent resource mapping in manifest.yml: Module ${moduleType} (${moduleDefinition['key']}) declares its resource to be of type ${type} but other modules with keys [${existingIndexEntry.modules
|
|
59
|
-
.map(([, m]) => m['key'])
|
|
60
|
-
.join(', ')}] pointing to the same resource appear to be of a different type`);
|
|
61
|
-
}
|
|
62
|
-
const existingModules = (_a = existingIndexEntry === null || existingIndexEntry === void 0 ? void 0 : existingIndexEntry.modules) !== null && _a !== void 0 ? _a : [];
|
|
63
|
-
return Object.assign(Object.assign({}, acc), { [moduleResourceKey]: {
|
|
64
|
-
type,
|
|
65
|
-
modules: [...existingModules, [moduleType, moduleDefinition]],
|
|
66
|
-
} });
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
return acc;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const resourceTypeIndex = modulesEntries.reduce((acc, [moduleType, moduleDefinitions]) => {
|
|
73
|
-
return moduleDefinitions.reduce((innerAcc, moduleDefinition) => indexModuleDefinition(innerAcc, moduleType, moduleDefinition), acc);
|
|
74
|
-
}, {});
|
|
75
|
-
const resourceTypeIndexKeySet = new Set(Object.keys(resourceTypeIndex));
|
|
76
|
-
const resourceKeySet = new Set(resourceKeys);
|
|
77
|
-
if (resourceTypeIndexKeySet.size === resourceKeySet.size &&
|
|
78
|
-
[...resourceTypeIndexKeySet].every((k) => resourceKeySet.has(k))) {
|
|
79
|
-
return resourceTypeIndex;
|
|
46
|
+
if (!options.uiKit2Packaging) {
|
|
47
|
+
return Object.assign(Object.assign({}, manifestSchema), { resources: [
|
|
48
|
+
...uiResources.map((resource) => (Object.assign(Object.assign({}, resource), { path: `${options.resourcePath}/${resource.path}` }))),
|
|
49
|
+
...genericResources,
|
|
50
|
+
] });
|
|
80
51
|
}
|
|
81
52
|
else {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
53
|
+
const resourceTypeIndex = (0, util_manifest_1.getResourceTypeIndex)(manifestSchema);
|
|
54
|
+
return Object.assign(Object.assign({}, manifestSchema), { resources: [
|
|
55
|
+
...uiResources.map((r) => patchResource(options.resourcePath, r, absoluteOutputPath, resourceTypeIndex[r.key])),
|
|
56
|
+
...genericResources,
|
|
57
|
+
] });
|
|
85
58
|
}
|
|
86
59
|
}
|
|
87
60
|
/**
|
|
88
61
|
* Returns the final resource path based on the given resource type.
|
|
89
62
|
*
|
|
90
|
-
* Verifies that the path/file exists in the computed directory. UI Kit
|
|
63
|
+
* Verifies that the path/file exists in the computed directory. UI Kit builds are expected to produce an accepted
|
|
91
64
|
* bundle filename.
|
|
92
65
|
*
|
|
93
66
|
* @param resourcePath Path where all resource build artifacts are placed, relative to the app root directory
|
|
94
|
-
* @param resourceType Type of the given resource, `ui-kit
|
|
67
|
+
* @param resourceType Type of the given resource, `ui-kit` or `custom-ui`
|
|
95
68
|
* @param resource Resource to process
|
|
96
69
|
* @param absoluteOutputPath Absolute project output path
|
|
97
70
|
*/
|
|
@@ -106,28 +79,28 @@ function getVerifiedResourcePath(resourcePath, resourceType, resource, absoluteO
|
|
|
106
79
|
devkit_1.logger.info(`Detected resource '${resource.key}' as Custom UI dependency`);
|
|
107
80
|
return relativeResourcePath;
|
|
108
81
|
}
|
|
109
|
-
devkit_1.logger.info(`Detected resource '${resource.key}' as UI Kit
|
|
110
|
-
const
|
|
82
|
+
devkit_1.logger.info(`Detected resource '${resource.key}' as UI Kit dependency`);
|
|
83
|
+
const acceptedUiKitEntryPoints = [
|
|
111
84
|
'index.js',
|
|
112
85
|
'index.jsx',
|
|
113
86
|
'main.js',
|
|
114
87
|
'main.jsx',
|
|
115
88
|
];
|
|
116
|
-
const entryPointFile =
|
|
89
|
+
const entryPointFile = acceptedUiKitEntryPoints.find((entryPointFile) => (0, fs_1.existsSync)((0, path_1.join)(absoluteResourcePath, entryPointFile)));
|
|
117
90
|
if (entryPointFile) {
|
|
118
91
|
return `${relativeResourcePath}/${entryPointFile}`;
|
|
119
92
|
}
|
|
120
93
|
else {
|
|
121
|
-
throw new Error(`Failed to patch resource with key '${resource.key}': Could not find entry point file in ${absoluteResourcePath}. Make sure the UI Kit
|
|
94
|
+
throw new Error(`Failed to patch resource with key '${resource.key}': Could not find entry point file in ${absoluteResourcePath}. Make sure the UI Kit build produces a files with one of these names: [${acceptedUiKitEntryPoints.join(',')}]`);
|
|
122
95
|
}
|
|
123
96
|
}
|
|
124
|
-
function patchResource(resourcePath, resource, absoluteOutputPath,
|
|
97
|
+
function patchResource(resourcePath, resource, absoluteOutputPath, resourceType) {
|
|
125
98
|
devkit_1.logger.info(`Patching resource with key '${resource.key}'...`);
|
|
126
|
-
if (!
|
|
99
|
+
if (!resourceType) {
|
|
127
100
|
devkit_1.logger.warn(`Resource with key '${resource.key}' appears not to be used by any module. Skip patching.`);
|
|
128
101
|
return resource;
|
|
129
102
|
}
|
|
130
|
-
const verifiedResourcePath = getVerifiedResourcePath(resourcePath,
|
|
103
|
+
const verifiedResourcePath = getVerifiedResourcePath(resourcePath, resourceType, resource, absoluteOutputPath);
|
|
131
104
|
return Object.assign(Object.assign({}, resource), { path: verifiedResourcePath });
|
|
132
105
|
}
|
|
133
106
|
//# sourceMappingURL=patch-manifest-yml.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-manifest-yml.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/build/lib/patch-manifest-yml.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"patch-manifest-yml.js","sourceRoot":"","sources":["../../../../../../../pack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,GAAG,CACL,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CACpB,YAAoB,EACpB,QAA+B,EAC/B,kBAA0B,EAC1B,YAA2B;IAE3B,eAAM,CAAC,IAAI,CAAC,+BAA+B,QAAQ,CAAC,GAAG,MAAM,CAAC,CAAC;IAE/D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,eAAM,CAAC,IAAI,CACT,sBAAsB,QAAQ,CAAC,GAAG,wDAAwD,CAC3F,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,oBAAoB,GAAG,uBAAuB,CAClD,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,kBAAkB,CACnB,CAAC;IAEF,uCACK,QAAQ,KACX,IAAI,EAAE,oBAAoB,IAC1B;AACJ,CAAC"}
|
|
@@ -5,9 +5,11 @@ type Options = Pick<NormalizedOptions, 'root' | 'outputPath' | 'resourceOutputPa
|
|
|
5
5
|
resourcePath: string;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* Verifies that resource projects are correctly linked to the Nx Forge app
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Verifies that UI resource projects are correctly linked to the Nx Forge app
|
|
9
|
+
* and copies build artifacts into the app's output directory. In particular,
|
|
10
|
+
* this will make sure that each Custom UI or UI Kit resource listed in the
|
|
11
|
+
* manifest.yml has its path configured to point to a Nx project in this
|
|
12
|
+
* workspace.
|
|
11
13
|
*
|
|
12
14
|
* @param options Executor options
|
|
13
15
|
* @param context Executor context
|
|
@@ -6,10 +6,13 @@ const fs_extra_1 = require("fs-extra");
|
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
8
|
const manifest_yml_1 = require("../../../utils/forge/manifest-yml");
|
|
9
|
+
const util_manifest_1 = require("../../../shared/manifest/util-manifest");
|
|
9
10
|
/**
|
|
10
|
-
* Verifies that resource projects are correctly linked to the Nx Forge app
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Verifies that UI resource projects are correctly linked to the Nx Forge app
|
|
12
|
+
* and copies build artifacts into the app's output directory. In particular,
|
|
13
|
+
* this will make sure that each Custom UI or UI Kit resource listed in the
|
|
14
|
+
* manifest.yml has its path configured to point to a Nx project in this
|
|
15
|
+
* workspace.
|
|
13
16
|
*
|
|
14
17
|
* @param options Executor options
|
|
15
18
|
* @param context Executor context
|
|
@@ -20,8 +23,9 @@ function processResourceDependencies(options, context) {
|
|
|
20
23
|
const manifestPath = (0, devkit_1.joinPathFragments)(context.root, context.projectsConfigurations.projects[context.projectName].root, 'manifest.yml');
|
|
21
24
|
const manifestSchema = yield (0, manifest_yml_1.readManifestYml)(manifestPath);
|
|
22
25
|
const resources = (_a = manifestSchema.resources) !== null && _a !== void 0 ? _a : [];
|
|
23
|
-
resources.
|
|
24
|
-
|
|
26
|
+
const uiResources = resources.filter((0, util_manifest_1.isResourceType)(manifestSchema, ['ui-kit', 'custom-ui']));
|
|
27
|
+
uiResources.forEach((r) => verifyAndCopyResourceDependency(r, context, options));
|
|
28
|
+
return uiResources;
|
|
25
29
|
});
|
|
26
30
|
}
|
|
27
31
|
const getResourceOutputPath = (options, resourceProjectGraphNode, configurationName) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-resource-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/build/lib/process-resource-dependencies.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"process-resource-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/build/lib/process-resource-dependencies.ts"],"names":[],"mappings":";;AAgCA,kEAoBC;;AApDD,uCAAoC;AACpC,2BAA6C;AAC7C,uCAMoB;AAIpB,oEAAoE;AACpE,0EAAwE;AASxE;;;;;;;;;GASG;AACH,SAAsB,2BAA2B,CAC/C,OAAgB,EAChB,OAAwB;;;QAExB,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,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K,CAAC,EAC/D,CAAC;QACD,MAAM,IAAI,KAAK,CACb,WAAW,mBAAmB,gDAAgD,6BAA6B,+DAA+D,CAC3K,CAAC;IACJ,CAAC;IAED,eAAM,CAAC,IAAI,CAAC,WAAW,mBAAmB,8BAA8B,CAAC,CAAC;IAC1E,IAAA,mBAAQ,EACN,qCAAqC,EACrC,IAAA,0BAAiB,EACf,OAAO,CAAC,IAAI,EACZ,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,4BAA4B,CAAC,CAAC;AAC/E,CAAC,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import { TunnelExecutorOptions } from './schema';
|
|
3
3
|
/**
|
|
4
|
-
* Forge tunnel executor that serves
|
|
5
|
-
*
|
|
4
|
+
* Forge tunnel executor that serves dependent Custom UI projects on the tunnel
|
|
5
|
+
* port configured in the manifest.yml.
|
|
6
6
|
*
|
|
7
|
-
* Additionally, this will start a build process for the Forge app in watch mode
|
|
8
|
-
*
|
|
7
|
+
* Additionally, this will start a build process for the Forge app in watch mode,
|
|
8
|
+
* call the package executor once to copy Forge app assets to the output directory
|
|
9
|
+
* and launch the `forge tunnel` process in the configured output directory.
|
|
9
10
|
*
|
|
10
11
|
* @see https://github.com/nrwl/nx/issues/3748#issuecomment-990980640
|
|
11
12
|
* @see https://gist.github.com/chrisui/a3cdf050bf18eccd499fba29b609b90a
|
|
@@ -4,14 +4,16 @@ exports.default = runTunnelExecutor;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
7
|
-
const run_tunnel_1 = tslib_1.
|
|
7
|
+
const run_tunnel_1 = tslib_1.__importStar(require("./lib/run-tunnel"));
|
|
8
8
|
const extract_custom_ui_projects_1 = require("./lib/extract-custom-ui-projects");
|
|
9
|
+
const start_custom_uis_1 = require("./lib/start-custom-uis");
|
|
9
10
|
/**
|
|
10
|
-
* Forge tunnel executor that serves
|
|
11
|
-
*
|
|
11
|
+
* Forge tunnel executor that serves dependent Custom UI projects on the tunnel
|
|
12
|
+
* port configured in the manifest.yml.
|
|
12
13
|
*
|
|
13
|
-
* Additionally, this will start a build process for the Forge app in watch mode
|
|
14
|
-
*
|
|
14
|
+
* Additionally, this will start a build process for the Forge app in watch mode,
|
|
15
|
+
* call the package executor once to copy Forge app assets to the output directory
|
|
16
|
+
* and launch the `forge tunnel` process in the configured output directory.
|
|
15
17
|
*
|
|
16
18
|
* @see https://github.com/nrwl/nx/issues/3748#issuecomment-990980640
|
|
17
19
|
* @see https://gist.github.com/chrisui/a3cdf050bf18eccd499fba29b609b90a
|
|
@@ -20,45 +22,49 @@ const extract_custom_ui_projects_1 = require("./lib/extract-custom-ui-projects")
|
|
|
20
22
|
function runTunnelExecutor(options, context) {
|
|
21
23
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
24
|
var _a, e_1, _b, _c;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
var _d;
|
|
26
|
+
const customUIProjectConfigs = yield (0, extract_custom_ui_projects_1.getCustomUiProjects)(context);
|
|
27
|
+
const customUIIters = yield (0, start_custom_uis_1.startCustomUIs)(customUIProjectConfigs, context);
|
|
28
|
+
const forgeAppBuildIter = yield (0, devkit_1.runExecutor)({ project: context.projectName, target: 'build' }, { watch: true }, context);
|
|
29
|
+
yield (0, devkit_1.runExecutor)({ project: context.projectName, target: 'package' }, {}, context);
|
|
30
|
+
try {
|
|
31
|
+
const preTunnelTimeout = (_d = options.preTunnelTimeout) !== null && _d !== void 0 ? _d : 5000;
|
|
32
|
+
yield (0, run_tunnel_1.isTunnelPreparationComplete)(options.outputPath, preTunnelTimeout);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
devkit_1.logger.error(err.message);
|
|
36
|
+
return { success: false };
|
|
32
37
|
}
|
|
33
|
-
const runForgeAppBuild = yield (0, devkit_1.runExecutor)({ project: context.projectName, target: 'build' }, { watch: true }, context);
|
|
34
38
|
// execute the tunnel target on the focused project
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
// we combine (interleave) all executor iterators here
|
|
38
|
-
const combined = (0, async_iterable_1.combineAsyncIterables)(runAllCustomUiServe, runForgeAppBuild, runForgeTunnel);
|
|
39
|
+
const forgeTunnelIter = promiseToIterator((0, run_tunnel_1.default)(Object.assign(Object.assign({}, options), { customUIProjectConfigs }), context));
|
|
40
|
+
const combined = (0, async_iterable_1.combineAsyncIterables)(forgeAppBuildIter, ...customUIIters, forgeTunnelIter);
|
|
39
41
|
try {
|
|
40
42
|
try {
|
|
41
|
-
for (var
|
|
43
|
+
for (var _e = true, combined_1 = tslib_1.__asyncValues(combined), combined_1_1; combined_1_1 = yield combined_1.next(), _a = combined_1_1.done, !_a; _e = true) {
|
|
42
44
|
_c = combined_1_1.value;
|
|
43
|
-
|
|
45
|
+
_e = false;
|
|
44
46
|
const output = _c;
|
|
45
47
|
if (!output.success)
|
|
46
|
-
|
|
48
|
+
throw new Error(`A started process failed: ${JSON.stringify(output)}`);
|
|
49
|
+
if ((output === null || output === void 0 ? void 0 : output.id) === 'tunnel') {
|
|
50
|
+
devkit_1.logger.info('Tunnel process has been terminated.');
|
|
51
|
+
const { value } = yield combined.return({ success: true });
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
50
57
|
finally {
|
|
51
58
|
try {
|
|
52
|
-
if (!
|
|
59
|
+
if (!_e && !_a && (_b = combined_1.return)) yield _b.call(combined_1);
|
|
53
60
|
}
|
|
54
61
|
finally { if (e_1) throw e_1.error; }
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
64
|
catch (err) {
|
|
58
65
|
devkit_1.logger.error(`Failed to tunnel Forge app: ${err}`);
|
|
59
|
-
|
|
66
|
+
return yield combined.return({ success: false });
|
|
60
67
|
}
|
|
61
|
-
return { success: true };
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
70
|
function promiseToIterator(v) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/executors/tunnel/executor.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/executors/tunnel/executor.ts"],"names":[],"mappings":";;AAmBA,oCAmDC;;AAtED,uCAAkE;AAClE,wEAA4E;AAE5E,uEAA0E;AAC1E,iFAAuE;AACvE,6DAAwD;AAExD;;;;;;;;;;;GAWG;AACH,SAA8B,iBAAiB,CAC7C,OAA8B,EAC9B,OAAwB;;;;QAExB,MAAM,sBAAsB,GAAG,MAAM,IAAA,gDAAmB,EAAC,OAAO,CAAC,CAAC;QAElE,MAAM,aAAa,GAAG,MAAM,IAAA,iCAAc,EAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;QAE5E,MAAM,iBAAiB,GAAG,MAAM,IAAA,oBAAW,EACzC,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,EACjD,EAAE,KAAK,EAAE,IAAI,EAAE,EACf,OAAO,CACR,CAAC;QAEF,MAAM,IAAA,oBAAW,EACf,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,EACnD,EAAE,EACF,OAAO,CACR,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,MAAA,OAAO,CAAC,gBAAgB,mCAAI,IAAI,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AAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;CAAA;AAED,SAAgB,iBAAiB,CAG/B,CAAa;;QACb,4BAAM,sBAAM,CAAC,CAAA,CAAA,CAAC;IAChB,CAAC;CAAA"}
|
|
@@ -4,6 +4,7 @@ exports.getCustomUiProjects = getCustomUiProjects;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const manifest_yml_1 = require("../../../utils/forge/manifest-yml");
|
|
7
|
+
const util_manifest_1 = require("../../../shared/manifest/util-manifest");
|
|
7
8
|
/**
|
|
8
9
|
* Extracts all configured Custom UI resources and their tunnel port for this Forge app.
|
|
9
10
|
*
|
|
@@ -12,7 +13,7 @@ const manifest_yml_1 = require("../../../utils/forge/manifest-yml");
|
|
|
12
13
|
*/
|
|
13
14
|
function getCustomUiProjects(context) {
|
|
14
15
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
const projects = yield
|
|
16
|
+
const projects = yield extractVerifiedCustomUIProjects(context);
|
|
16
17
|
return projects.map((p) => ({
|
|
17
18
|
projectName: p.path,
|
|
18
19
|
port: p.tunnel.port,
|
|
@@ -26,19 +27,20 @@ function getCustomUiProjects(context) {
|
|
|
26
27
|
*
|
|
27
28
|
* - the Nx workspace has a project configured for each Custom UI project
|
|
28
29
|
* - each Custom UI project has a 'serve' target
|
|
29
|
-
* - each Custom UI project is listed as an implicit dependency of the Forge app
|
|
30
30
|
* - each Custom UI resource has a configured tunnel port in the Forge app's manifest.yml
|
|
31
31
|
*
|
|
32
32
|
* @param context Executor context for this call
|
|
33
33
|
* @returns All configured and verified Custom UI resources
|
|
34
34
|
*/
|
|
35
|
-
function
|
|
35
|
+
function extractVerifiedCustomUIProjects(context) {
|
|
36
36
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
var _a;
|
|
38
38
|
const manifestPath = (0, devkit_1.joinPathFragments)(context.root, context.projectsConfigurations.projects[context.projectName].root, 'manifest.yml');
|
|
39
39
|
const manifestSchema = yield (0, manifest_yml_1.readManifestYml)(manifestPath);
|
|
40
40
|
const resources = (_a = manifestSchema.resources) !== null && _a !== void 0 ? _a : [];
|
|
41
|
-
return resources
|
|
41
|
+
return resources
|
|
42
|
+
.filter((0, util_manifest_1.isResourceType)(manifestSchema, ['custom-ui']))
|
|
43
|
+
.map(verifyCustomUIDependency(context));
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
const verifyCustomUIDependency = (context) => (resource) => {
|
|
@@ -48,7 +50,7 @@ const verifyCustomUIDependency = (context) => (resource) => {
|
|
|
48
50
|
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.`);
|
|
49
51
|
}
|
|
50
52
|
if (!customUIProjectConfiguration.targets['serve']) {
|
|
51
|
-
throw new Error(`Custom UI project '${customUIProjectName}' targets is missing a 'serve' executor. Make sure the 'targets' property in the project's 'project.json' has a 'serve' executor configured.`);
|
|
53
|
+
throw new Error(`Custom UI project '${customUIProjectName}' targets is missing a 'serve' executor. Make sure the the project has a 'serve' target inferred, or the 'targets' property in the project's 'project.json' has a 'serve' executor configured.`);
|
|
52
54
|
}
|
|
53
55
|
if (!resource.tunnel || !Number.isInteger(resource.tunnel.port)) {
|
|
54
56
|
throw new Error(`Custom UI resource with key ${resource.key} is missing tunnel port in manifest.yml. Follow the Forge docs on how to add a tunnel port to the Custom UI resource with key ${resource.key}: https://developer.atlassian.com/platform/forge/tunneling/#connecting-the-tunnel-to-your-own-dev-server`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-custom-ui-projects.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/tunnel/lib/extract-custom-ui-projects.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"extract-custom-ui-projects.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/tunnel/lib/extract-custom-ui-projects.ts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BAAmB,oFAAoF,CAC9J,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,4BAA4B,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACb,sBAAsB,mBAAmB,gMAAgM,CAC1O,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CACb,+BAA+B,QAAQ,CAAC,GAAG,iIAAiI,QAAQ,CAAC,GAAG,0GAA0G,CACnS,CAAC;IACJ,CAAC;IAED,OAAO,QAAkC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import { TunnelExecutorOptions } from '../schema';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the tunnel executor is ready to run the Forge tunnel process.
|
|
5
|
+
*
|
|
6
|
+
* Checks if:
|
|
7
|
+
* - the manifest.yml exists in the output path
|
|
8
|
+
* - the `src` directory in the output path is non-empty
|
|
9
|
+
*
|
|
10
|
+
* This will perform these checks repeatedly with exponential backoff until,
|
|
11
|
+
* either the function times out, or all checks complete successfully.
|
|
12
|
+
*
|
|
13
|
+
* @param outputPath App output path
|
|
14
|
+
* @param timeoutMs Timeout in ms
|
|
15
|
+
* @param initialDelayMs Initial delay before re-checking the condition
|
|
16
|
+
*/
|
|
17
|
+
export declare function isTunnelPreparationComplete(outputPath: string, timeoutMs: number, initialDelayMs?: number): Promise<boolean>;
|
|
3
18
|
/**
|
|
4
19
|
* Starts the `forge tunnel` process in the app's output directory. The execution of `forge tunnel` will be delayed
|
|
5
20
|
* until all configured Custom UI dev servers are listening on their configured tunnel port.
|
|
@@ -12,10 +27,11 @@ import { TunnelExecutorOptions } from '../schema';
|
|
|
12
27
|
* @param context Executor context for this call
|
|
13
28
|
*/
|
|
14
29
|
export default function runTunnel(options: TunnelExecutorOptions & {
|
|
15
|
-
|
|
30
|
+
customUIProjectConfigs: {
|
|
16
31
|
projectName: string;
|
|
17
32
|
port: number;
|
|
18
33
|
}[];
|
|
19
34
|
}, context: ExecutorContext): Promise<{
|
|
35
|
+
id: 'tunnel';
|
|
20
36
|
success: boolean;
|
|
21
37
|
}>;
|
|
@@ -1,11 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTunnelPreparationComplete = isTunnelPreparationComplete;
|
|
3
4
|
exports.default = runTunnel;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const process = tslib_1.__importStar(require("node:process"));
|
|
8
9
|
const wait_until_server_is_listening_1 = require("./wait-until-server-is-listening");
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
12
|
+
/**
|
|
13
|
+
* Checks if the tunnel executor is ready to run the Forge tunnel process.
|
|
14
|
+
*
|
|
15
|
+
* Checks if:
|
|
16
|
+
* - the manifest.yml exists in the output path
|
|
17
|
+
* - the `src` directory in the output path is non-empty
|
|
18
|
+
*
|
|
19
|
+
* This will perform these checks repeatedly with exponential backoff until,
|
|
20
|
+
* either the function times out, or all checks complete successfully.
|
|
21
|
+
*
|
|
22
|
+
* @param outputPath App output path
|
|
23
|
+
* @param timeoutMs Timeout in ms
|
|
24
|
+
* @param initialDelayMs Initial delay before re-checking the condition
|
|
25
|
+
*/
|
|
26
|
+
function isTunnelPreparationComplete(outputPath_1, timeoutMs_1) {
|
|
27
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (outputPath, timeoutMs, initialDelayMs = 200) {
|
|
28
|
+
const manifestExists = () => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return (_b = (_a = (0, node_fs_1.statSync)(node_path_1.default.join(outputPath, 'manifest.yml'), {
|
|
31
|
+
throwIfNoEntry: false,
|
|
32
|
+
})) === null || _a === void 0 ? void 0 : _a.isFile()) !== null && _b !== void 0 ? _b : false;
|
|
33
|
+
};
|
|
34
|
+
const isOutputPathSrcDirNonEmpty = () => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
return (_b = (((_a = (0, node_fs_1.statSync)(node_path_1.default.join(outputPath, 'src'), {
|
|
37
|
+
throwIfNoEntry: false,
|
|
38
|
+
})) === null || _a === void 0 ? void 0 : _a.isDirectory()) &&
|
|
39
|
+
(0, node_fs_1.readdirSync)(node_path_1.default.join(outputPath, 'src')).length > 0)) !== null && _b !== void 0 ? _b : false;
|
|
40
|
+
};
|
|
41
|
+
const timeout = new Promise((_, reject) => {
|
|
42
|
+
setTimeout(() => reject(new Error(`Tunnel preparation timed out: Did not completed within ${timeoutMs} ms.
|
|
43
|
+
|
|
44
|
+
You can set a longer time out using the 'preTunnelTimeout' option of the tunnel executor.`)), timeoutMs);
|
|
45
|
+
});
|
|
46
|
+
const tunnelReadyCondition = function () {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
let delay = initialDelayMs;
|
|
49
|
+
while (true) {
|
|
50
|
+
try {
|
|
51
|
+
if (manifestExists() && isOutputPathSrcDirNonEmpty()) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
throw new Error(`Unexpected error checking tunnel preparation complete: ${err}`);
|
|
57
|
+
}
|
|
58
|
+
yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
59
|
+
delay *= 2;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
return Promise.race([tunnelReadyCondition(), timeout]);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
9
66
|
/**
|
|
10
67
|
* Starts the `forge tunnel` process in the app's output directory. The execution of `forge tunnel` will be delayed
|
|
11
68
|
* until all configured Custom UI dev servers are listening on their configured tunnel port.
|
|
@@ -19,23 +76,26 @@ const wait_until_server_is_listening_1 = require("./wait-until-server-is-listeni
|
|
|
19
76
|
*/
|
|
20
77
|
function runTunnel(options, context) {
|
|
21
78
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
79
|
+
if (options.customUIProjectConfigs.length > 0) {
|
|
80
|
+
devkit_1.logger.info(`Wait for all Custom UI 'serve' targets to have started and servers are listening...`);
|
|
81
|
+
yield Promise.all(options.customUIProjectConfigs.map(({ port }) => (0, wait_until_server_is_listening_1.waitUntilServerIsListening)(port, context)));
|
|
82
|
+
devkit_1.logger.info(`All Custom UI 'serve' targets have started and servers are listening`);
|
|
83
|
+
}
|
|
25
84
|
const args = [
|
|
26
85
|
'tunnel',
|
|
27
86
|
...(options.verbose === true ? ['--verbose'] : []),
|
|
28
87
|
...(options.debug === true ? ['--debug'] : []),
|
|
29
88
|
];
|
|
30
89
|
const command = `forge ${args.join(' ')}`;
|
|
31
|
-
devkit_1.logger.
|
|
90
|
+
devkit_1.logger.info(`Running: > ${command}`);
|
|
32
91
|
// https://2ality.com/2018/05/child-process-streams.html#running-commands-in-child-processes
|
|
33
|
-
const tunnelProcess = (0,
|
|
92
|
+
const tunnelProcess = (0, node_child_process_1.spawn)('forge', args, {
|
|
34
93
|
cwd: options.outputPath,
|
|
35
94
|
env: Object.assign(Object.assign({}, process.env), {
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
95
|
+
// Unset NODE_ENV, if this is set to 'development' it may cause issues
|
|
96
|
+
// starting the tunnel process
|
|
97
|
+
// https://stackoverflow.com/questions/69566849/installing-forge-cli-is-bringing-spawn-ts-node-enoent-error
|
|
98
|
+
NODE_ENV: undefined }),
|
|
39
99
|
stdio: 'inherit',
|
|
40
100
|
shell: true,
|
|
41
101
|
});
|
|
@@ -44,6 +104,7 @@ function runTunnel(options, context) {
|
|
|
44
104
|
if (code === 0) {
|
|
45
105
|
devkit_1.logger.info('Exiting the forge tunnel process...');
|
|
46
106
|
resolve({
|
|
107
|
+
id: 'tunnel',
|
|
47
108
|
success: true,
|
|
48
109
|
});
|
|
49
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-tunnel.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/tunnel/lib/run-tunnel.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"run-tunnel.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/tunnel/lib/run-tunnel.ts"],"names":[],"mappings":";;AAsBA,kEAiDC;AAaD,4BAkEC;;AAtJD,uCAAqD;AACrD,2DAA2C;AAC3C,8DAAwC;AAExC,qFAA8E;AAC9E,qCAAgD;AAChD,kEAA6B;AAE7B;;;;;;;;;;;;;GAaG;AACH,SAAsB,2BAA2B;iEAC/C,UAAkB,EAClB,SAAiB,EACjB,cAAc,GAAG,GAAG;QAEpB,MAAM,cAAc,GAAG,GAAG,EAAE;;YAC1B,OAAA,MAAA,MAAA,IAAA,kBAAQ,EAAC,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE;gBAC9C,cAAc,EAAE,KAAK;aACtB,CAAC,0CAAE,MAAM,EAAE,mCAAI,KAAK,CAAA;SAAA,CAAC;QACxB,MAAM,0BAA0B,GAAG,GAAG,EAAE;;YACtC,OAAA,MAAA,CAAC,CAAA,MAAA,IAAA,kBAAQ,EAAC,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE;gBACtC,cAAc,EAAE,KAAK;aACtB,CAAC,0CAAE,WAAW,EAAE;gBACf,IAAA,qBAAW,EAAC,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,mCACvD,KA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AAI,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;gBACzC,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,GAAG,GAAG,CAAC,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startCustomUIs = startCustomUIs;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function startCustomUIs(customUIProjectConfigs, context) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const customUIIters = [];
|
|
9
|
+
for (const config of customUIProjectConfigs) {
|
|
10
|
+
customUIIters.push(yield (0, devkit_1.runExecutor)({ project: config.projectName, target: 'serve' }, { port: config.port }, context));
|
|
11
|
+
}
|
|
12
|
+
return customUIIters;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=start-custom-uis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-custom-uis.js","sourceRoot":"","sources":["../../../../../../../packages/nx-forge/src/executors/tunnel/lib/start-custom-uis.ts"],"names":[],"mappings":";;AAEA,wCAgBC;;AAlBD,uCAA0D;AAE1D,SAAsB,cAAc,CAClC,sBAA+D,EAC/D,OAAwB;;QAExB,MAAM,aAAa,GAA0C,EAAE,CAAC;QAEhE,KAAK,MAAM,MAAM,IAAI,sBAAsB,EAAE,CAAC;YAC5C,aAAa,CAAC,IAAI,CAChB,MAAM,IAAA,oBAAW,EACf,EAAE,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,EAChD,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EACrB,OAAO,CACR,CACF,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CAAA"}
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
"description": "Run Forge tunnel in verbose mode.",
|
|
23
23
|
"alias": "v",
|
|
24
24
|
"default": false
|
|
25
|
+
},
|
|
26
|
+
"preTunnelTimeout": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"description": "Max milliseconds to wait for tunnel preparation tasks.",
|
|
29
|
+
"default": 5000,
|
|
30
|
+
"visible": false
|
|
25
31
|
}
|
|
26
32
|
},
|
|
27
33
|
"required": ["outputPath"]
|
|
@@ -19,6 +19,11 @@ module.exports = {
|
|
|
19
19
|
assets: <%- JSON.stringify(webpackPluginOptions.assets) %>,
|
|
20
20
|
optimization: false,
|
|
21
21
|
outputHashing: 'none',
|
|
22
|
+
// Do not delete all the files in the output path. This is required to maintain the
|
|
23
|
+
// manifest.yml in the output path when running the tunnel executor. By default,
|
|
24
|
+
// Webpack still cleans the src folder in the output directory (dist/apps/<my-app>/src)
|
|
25
|
+
// but not the project root (refer to Webpack option `output.clean`).
|
|
26
|
+
deleteOutputPath: false,
|
|
22
27
|
})
|
|
23
28
|
],
|
|
24
29
|
};
|
|
@@ -4,13 +4,13 @@ exports.createDependencies = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const manifest_yml_1 = require("../utils/forge/manifest-yml");
|
|
7
|
-
const
|
|
7
|
+
const getUIResourceDependencies = (_a, context_1) => tslib_1.__awaiter(void 0, [_a, context_1], void 0, function* ([projectName, manifestFile], context) {
|
|
8
8
|
const manifestSchema = yield (0, manifest_yml_1.readManifestYml)(manifestFile.file);
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
throw new Error(`Failed to find
|
|
9
|
+
const uiResourceProjectNames = (0, manifest_yml_1.extractUIResourceProjectNames)(manifestSchema);
|
|
10
|
+
const getUIResourceStaticDependency = (uiResourceProjectName) => {
|
|
11
|
+
const uiResourceProjectConfiguration = context.projects[uiResourceProjectName];
|
|
12
|
+
if (!uiResourceProjectConfiguration) {
|
|
13
|
+
throw new Error(`Failed to find UI resource project in Nx workspace: The UI resource dependency to project ${uiResourceProjectName} declared in the Forge manifest.yml of project ${projectName} cannot be found. Make sure the path property of the resource definition references a project in the Nx workspace.`);
|
|
14
14
|
}
|
|
15
15
|
const projectConfiguration = context.projects[projectName];
|
|
16
16
|
if (!projectConfiguration) {
|
|
@@ -19,16 +19,16 @@ const getCustomUIDependencies = (_a, context_1) => tslib_1.__awaiter(void 0, [_a
|
|
|
19
19
|
return {
|
|
20
20
|
sourceFile: manifestFile.file,
|
|
21
21
|
source: projectName,
|
|
22
|
-
target:
|
|
22
|
+
target: uiResourceProjectName,
|
|
23
23
|
type: devkit_1.DependencyType.static,
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
return
|
|
26
|
+
return uiResourceProjectNames.reduce((acc, uiResourceProjectName) => {
|
|
27
27
|
return (manifestFile.deps || []).find(([source, target, type]) => type === 'static' &&
|
|
28
|
-
target ===
|
|
28
|
+
target === uiResourceProjectName &&
|
|
29
29
|
source === projectName)
|
|
30
30
|
? acc // Dependency already exists, skip adding it again.
|
|
31
|
-
: [...acc,
|
|
31
|
+
: [...acc, getUIResourceStaticDependency(uiResourceProjectName)];
|
|
32
32
|
}, []);
|
|
33
33
|
});
|
|
34
34
|
const createDependencies = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -42,8 +42,8 @@ const createDependencies = (options, context) => tslib_1.__awaiter(void 0, void
|
|
|
42
42
|
_d = false;
|
|
43
43
|
const manifestFile = _c;
|
|
44
44
|
devkit_1.logger.info(`[nx-forge] Processing ${projectName}:${manifestFile.file}`);
|
|
45
|
-
const
|
|
46
|
-
dependencies = dependencies.concat(
|
|
45
|
+
const uiResourceDependencies = yield getUIResourceDependencies([projectName, manifestFile], context);
|
|
46
|
+
dependencies = dependencies.concat(uiResourceDependencies);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-dependencies.js","sourceRoot":"","sources":["../../../../../packages/nx-forge/src/graph/create-dependencies.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,8DAGqC;AAErC,MAAM,
|
|
1
|
+
{"version":3,"file":"create-dependencies.js","sourceRoot":"","sources":["../../../../../packages/nx-forge/src/graph/create-dependencies.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,8DAGqC;AAErC,MAAM,yBAAyB,GAAG,gBAGM,EAAE,+DAFxC,CAAC,WAAW,EAAE,YAAY,CAAqB,EAC/C,OAAkC;IAElC,MAAM,cAAc,GAAG,MAAM,IAAA,8BAAe,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAChE,MAAM,sBAAsB,GAAG,IAAA,4CAA6B,EAAC,cAAc,CAAC,CAAC;IAE7E,MAAM,6BAA6B,GAAG,CACpC,qBAA6B,EACF,EAAE;QAC7B,MAAM,8BAA8B,GAClC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QAE1C,IAAI,CAAC,8BAA8B,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,6FAA6F,qBAAqB,kDAAkD,WAAW,oHAAoH,CACpS,CAAC;QACJ,CAAC;QAED,MAAM,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAE3D,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,6DAA6D,WAAW,EAAE,CAC3E,CAAC;QACJ,CAAC;QAED,OAAO;YACL,UAAU,EAAE,YAAY,CAAC,IAAI;YAC7B,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,qBAAqB;YAC7B,IAAI,EAAE,uBAAc,CAAC,MAAM;SAC5B,CAAC;IACJ,CAAC,CA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;;;;;;;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAA,CAAC;AArBW,QAAA,kBAAkB,sBAqB7B"}
|
|
@@ -5,7 +5,7 @@ const fs_1 = require("fs");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const get_register_config_1 = require("../shared/targets/get-register-config");
|
|
8
|
-
const
|
|
8
|
+
const get_tunnel_config_1 = require("../shared/targets/get-tunnel-config");
|
|
9
9
|
const get_deploy_config_1 = require("../shared/targets/get-deploy-config");
|
|
10
10
|
const get_install_config_1 = require("../shared/targets/get-install-config");
|
|
11
11
|
const get_forge_cli_config_1 = require("../shared/targets/get-forge-cli-config");
|
|
@@ -17,7 +17,7 @@ const buildForgeProjectTargets = (projectRoot) => {
|
|
|
17
17
|
const targets = {};
|
|
18
18
|
targets.register = (0, get_register_config_1.getRegisterConfig)({ outputPath });
|
|
19
19
|
targets.package = (0, get_package_config_1.getPackageConfig)({ outputPath });
|
|
20
|
-
targets.
|
|
20
|
+
targets.tunnel = (0, get_tunnel_config_1.getTunnelConfig)({ outputPath });
|
|
21
21
|
targets.deploy = (0, get_deploy_config_1.getDeployConfig)({ outputPath });
|
|
22
22
|
targets.install = (0, get_install_config_1.getInstallConfig)({ outputPath });
|
|
23
23
|
targets.forge = (0, get_forge_cli_config_1.getForgeCliConfig)({ outputPath });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-nodes.js","sourceRoot":"","sources":["../../../../../packages/nx-forge/src/graph/create-nodes.ts"],"names":[],"mappings":";;;AAAA,2BAAiC;AACjC,+BAAqC;AACrC,uCAKoB;AACpB,+EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"create-nodes.js","sourceRoot":"","sources":["../../../../../packages/nx-forge/src/graph/create-nodes.ts"],"names":[],"mappings":";;;AAAA,2BAAiC;AACjC,+BAAqC;AACrC,uCAKoB;AACpB,+EAA0E;AAC1E,2EAAsE;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gBAAgB,CAAC,CAAC;IAE9C,uDAAuD;IACvD,MAAM,YAAY,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;IAC3E,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAC3C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE;YACR,CAAC,WAAW,CAAC,EAAE;gBACb,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,wBAAwB,CAAC,WAAW,CAAC;aAC/C;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -10,15 +10,15 @@ function update(host) {
|
|
|
10
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
11
|
var _a;
|
|
12
12
|
const projects = (0, devkit_1.getProjects)(host);
|
|
13
|
-
const
|
|
13
|
+
const isForgeProject = (config) => {
|
|
14
14
|
return (config.projectType === 'application' &&
|
|
15
15
|
host.exists((0, devkit_1.joinPathFragments)(config.root, 'manifest.yml')));
|
|
16
16
|
};
|
|
17
17
|
for (const [name, config] of projects.entries()) {
|
|
18
|
-
if (config &&
|
|
18
|
+
if (config && isForgeProject(config)) {
|
|
19
19
|
if (((_a = config.implicitDependencies) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
20
20
|
const manifest = yield (0, manifest_1.readManifestYml)(host, (0, devkit_1.joinPathFragments)(config.root, 'manifest.yml'));
|
|
21
|
-
const customUIProjectNames = (0, manifest_yml_1.
|
|
21
|
+
const customUIProjectNames = (0, manifest_yml_1.extractUIResourceProjectNames)(manifest);
|
|
22
22
|
config.implicitDependencies = config.implicitDependencies.filter((d) => !customUIProjectNames.includes(d));
|
|
23
23
|
(0, devkit_1.updateProjectConfiguration)(host, name, config);
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-implicit-custom-ui-dependencies.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/migrations/update-2-3-0/remove-implicit-custom-ui-dependencies.ts"],"names":[],"mappings":";;AAWA,yBAyBC;;AApCD,sDAAsD;AACtD,uCAMoB;AACpB,
|
|
1
|
+
{"version":3,"file":"remove-implicit-custom-ui-dependencies.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/migrations/update-2-3-0/remove-implicit-custom-ui-dependencies.ts"],"names":[],"mappings":";;AAWA,yBAyBC;;AApCD,sDAAsD;AACtD,uCAMoB;AACpB,iEAA+E;AAC/E,+CAAmD;AAEnD,SAA8B,MAAM,CAAC,IAAU;;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,MAAM,cAAc,GAAG,CAAC,MAA4B,EAAW,EAAE;YAC/D,OAAO,CACL,MAAM,CAAC,WAAW,KAAK,aAAa;gBACpC,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAC5D,CAAC;QACJ,CAAC,CAAC;QAEF,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,IAAI,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;gBACrC,IAAI,CAAA,MAAA,MAAM,CAAC,oBAAoB,0CAAE,MAAM,IAAG,CAAC,EAAE,CAAC;oBAC5C,MAAM,QAAQ,GAAG,MAAM,IAAA,0BAAe,EACpC,IAAI,EACJ,IAAA,0BAAiB,EAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAC/C,CAAC;oBACF,MAAM,oBAAoB,GAAG,IAAA,4CAA6B,EAAC,QAAQ,CAAC,CAAC;oBACrE,MAAM,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAC9D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CACzC,CAAC;oBACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ManifestSchema } from '@forge/manifest';
|
|
2
|
+
import { HostedResourcesSchema } from '@forge/manifest/out/schema/manifest';
|
|
3
|
+
export type ResourceType = 'ui-kit' | 'custom-ui' | 'generic';
|
|
4
|
+
export type ResourceTypeIndex = {
|
|
5
|
+
[resourceKey: string]: ResourceType;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Computes an index from resource key to resource type which is either `ui-kit`,
|
|
9
|
+
* `custom-ui` or `generic`. The resource type is inferred from the module
|
|
10
|
+
* declaration. If a module has both the `resource` property and `render: native`
|
|
11
|
+
* declared, its resource must be of type UI Kit. If a module, only declares the
|
|
12
|
+
* `resource` property and its `render` property (if exists) is not `native`,
|
|
13
|
+
* its resource must be a Custom UI. In all other cases, the resource type is
|
|
14
|
+
* Generic.
|
|
15
|
+
*
|
|
16
|
+
* @param manifestSchema Complete manifest definition to analyze
|
|
17
|
+
*/
|
|
18
|
+
export declare const getResourceTypeIndex: (manifestSchema: ManifestSchema) => ResourceTypeIndex;
|
|
19
|
+
/**
|
|
20
|
+
* Determines if type of the given resource. If the resource is not referenced
|
|
21
|
+
* by any module it is considered a generic resource.
|
|
22
|
+
*
|
|
23
|
+
* @param manifestSchema Complete manifest definition
|
|
24
|
+
* @param resource Resource to resolve against the manifest definition
|
|
25
|
+
*/
|
|
26
|
+
export declare const resourceTypeByResourceDefinition: (manifestSchema: ManifestSchema) => (resource: HostedResourcesSchema) => ResourceType;
|
|
27
|
+
/**
|
|
28
|
+
* Determines if the given resource definition is of a specific type. The
|
|
29
|
+
* predicate can be configured with the accepted resource types.
|
|
30
|
+
*
|
|
31
|
+
* To determine if a resource is of a specific type, this will try to find a
|
|
32
|
+
* module definition that references the key of the given resource definition
|
|
33
|
+
* as its resource property.
|
|
34
|
+
*
|
|
35
|
+
* @param manifestSchema Complete manifest definition
|
|
36
|
+
* @param acceptedResourceTypes Allows to filer for specific resource types
|
|
37
|
+
* @param resource Resource to resolve against the manifest definition
|
|
38
|
+
*/
|
|
39
|
+
export declare const isResourceType: (manifestSchema: ManifestSchema, acceptedResourceTypes: ResourceType[]) => (resource: HostedResourcesSchema) => boolean;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isResourceType = exports.resourceTypeByResourceDefinition = exports.getResourceTypeIndex = void 0;
|
|
4
|
+
const manifest_1 = require("@forge/manifest");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
// https://stackoverflow.com/a/8511350/5115898
|
|
7
|
+
const isObject = (v) => typeof v === 'object' && v !== null;
|
|
8
|
+
/**
|
|
9
|
+
* Determines the resource type based on the module definition.
|
|
10
|
+
*
|
|
11
|
+
* The criteria are as follows:
|
|
12
|
+
* - UI Kit: module has the `resource` property and the `render` property is
|
|
13
|
+
* `native`
|
|
14
|
+
* - Custom UI: module has the `resource` property and the `render` property is
|
|
15
|
+
* not `native` or missing
|
|
16
|
+
* - Generic: none of the above, consider it a generic resource
|
|
17
|
+
*
|
|
18
|
+
* @param moduleDefinition Module definition to analyze
|
|
19
|
+
*/
|
|
20
|
+
const resourceTypeByModuleDefinition = (moduleDefinition) => {
|
|
21
|
+
if (!!moduleDefinition['resource'] && moduleDefinition['render'] === 'native')
|
|
22
|
+
return 'ui-kit';
|
|
23
|
+
if (!!moduleDefinition['resource'] && moduleDefinition['render'] !== 'native')
|
|
24
|
+
return 'custom-ui';
|
|
25
|
+
return 'generic';
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Computes an index from resource key to resource type which is either `ui-kit`,
|
|
29
|
+
* `custom-ui` or `generic`. The resource type is inferred from the module
|
|
30
|
+
* declaration. If a module has both the `resource` property and `render: native`
|
|
31
|
+
* declared, its resource must be of type UI Kit. If a module, only declares the
|
|
32
|
+
* `resource` property and its `render` property (if exists) is not `native`,
|
|
33
|
+
* its resource must be a Custom UI. In all other cases, the resource type is
|
|
34
|
+
* Generic.
|
|
35
|
+
*
|
|
36
|
+
* @param manifestSchema Complete manifest definition to analyze
|
|
37
|
+
*/
|
|
38
|
+
const getResourceTypeIndex = (manifestSchema) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return (0, manifest_1.getAllModules)((_a = manifestSchema.modules) !== null && _a !== void 0 ? _a : {}).reduce((acc, moduleDefinition) => {
|
|
41
|
+
if (isObject(moduleDefinition) &&
|
|
42
|
+
Object.hasOwn(moduleDefinition, 'resource') &&
|
|
43
|
+
typeof moduleDefinition['resource'] === 'string') {
|
|
44
|
+
const resourceKey = moduleDefinition['resource'];
|
|
45
|
+
const resourceType = resourceTypeByModuleDefinition(moduleDefinition);
|
|
46
|
+
const existingIndexEntry = acc[resourceKey];
|
|
47
|
+
if (existingIndexEntry && existingIndexEntry !== resourceType) {
|
|
48
|
+
devkit_1.logger.warn(`Inconsistent resource mapping in manifest.yml: Module with key ${moduleDefinition['key']} declares its resource to be of type ${resourceType} but other modules pointing to the same resource appear to be of a different type`);
|
|
49
|
+
}
|
|
50
|
+
return Object.assign(Object.assign({}, acc), { [resourceKey]: resourceType });
|
|
51
|
+
}
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
};
|
|
55
|
+
exports.getResourceTypeIndex = getResourceTypeIndex;
|
|
56
|
+
/**
|
|
57
|
+
* Determines if type of the given resource. If the resource is not referenced
|
|
58
|
+
* by any module it is considered a generic resource.
|
|
59
|
+
*
|
|
60
|
+
* @param manifestSchema Complete manifest definition
|
|
61
|
+
* @param resource Resource to resolve against the manifest definition
|
|
62
|
+
*/
|
|
63
|
+
const resourceTypeByResourceDefinition = (manifestSchema) => (resource) => {
|
|
64
|
+
var _a;
|
|
65
|
+
for (const moduleDefinition of (0, manifest_1.getAllModules)((_a = manifestSchema.modules) !== null && _a !== void 0 ? _a : {})) {
|
|
66
|
+
if (isObject(moduleDefinition) &&
|
|
67
|
+
Object.hasOwn(moduleDefinition, 'resource') &&
|
|
68
|
+
typeof moduleDefinition['resource'] === 'string' &&
|
|
69
|
+
moduleDefinition['resource'] === resource.key) {
|
|
70
|
+
return resourceTypeByModuleDefinition(moduleDefinition);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return 'generic';
|
|
74
|
+
};
|
|
75
|
+
exports.resourceTypeByResourceDefinition = resourceTypeByResourceDefinition;
|
|
76
|
+
/**
|
|
77
|
+
* Determines if the given resource definition is of a specific type. The
|
|
78
|
+
* predicate can be configured with the accepted resource types.
|
|
79
|
+
*
|
|
80
|
+
* To determine if a resource is of a specific type, this will try to find a
|
|
81
|
+
* module definition that references the key of the given resource definition
|
|
82
|
+
* as its resource property.
|
|
83
|
+
*
|
|
84
|
+
* @param manifestSchema Complete manifest definition
|
|
85
|
+
* @param acceptedResourceTypes Allows to filer for specific resource types
|
|
86
|
+
* @param resource Resource to resolve against the manifest definition
|
|
87
|
+
*/
|
|
88
|
+
const isResourceType = (manifestSchema, acceptedResourceTypes) => (resource) => acceptedResourceTypes.includes((0, exports.resourceTypeByResourceDefinition)(manifestSchema)(resource));
|
|
89
|
+
exports.isResourceType = isResourceType;
|
|
90
|
+
//# sourceMappingURL=util-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util-manifest.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/shared/manifest/util-manifest.ts"],"names":[],"mappings":";;;AAAA,8CAAgE;AAEhE,uCAAoC;AAEpC,8CAA8C;AAC9C,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAe,EAAE,CAC3C,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC;AAItC;;;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B7B;AAEJ;;;;;;GAMG;AACI,MAAM,gCAAgC,GAC3C,CAAC,cAA8B,EAAE,EAAE,CACnC,CAAC,QAA+B,EAAgB,EAAE;;IAChD,KAAK,MAAM,gBAAgB,IAAI,IAAA,wBAAa,EAC1C,MAAA,cAAc,CAAC,OAAO,mCAAI,EAAE,CAC7B,EAAE,CAAC;QACF,IACE,QAAQ,CAAC,gBAAgB,CAAC;YAC1B,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC;YAC3C,OAAO,gBAAgB,CAAC,UAAU,CAAC,KAAK,QAAQ;YAChD,gBAAgB,CAAC,UAAU,CAAC,KAAK,QAAQ,CAAC,GAAG,EAC7C,CAAC;YACD,OAAO,8BAA8B,CAAC,gBAAgB,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAhBS,QAAA,gCAAgC,oCAgBzC;AAEJ;;;;;;;;;;;GAWG;AACI,MAAM,cAAc,GACzB,CAAC,cAA8B,EAAE,qBAAqC,EAAE,EAAE,CAC1E,CAAC,QAA+B,EAAW,EAAE,CAC3C,qBAAqB,CAAC,QAAQ,CAC5B,IAAA,wCAAgC,EAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAC3D,CAAC;AALO,QAAA,cAAc,kBAKrB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
function
|
|
3
|
+
exports.getTunnelConfig = getTunnelConfig;
|
|
4
|
+
function getTunnelConfig(options) {
|
|
5
5
|
return {
|
|
6
6
|
executor: '@toolsplus/nx-forge:tunnel',
|
|
7
7
|
options: {
|
|
@@ -13,4 +13,4 @@ function getServeConfig(options) {
|
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=get-
|
|
16
|
+
//# sourceMappingURL=get-tunnel-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tunnel-config.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/shared/targets/get-tunnel-config.ts"],"names":[],"mappings":";;AAKA,0CAaC;AAbD,SAAgB,eAAe,CAC7B,OAA+B;IAE/B,OAAO;QACL,QAAQ,EAAE,4BAA4B;QACtC,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;QACD,QAAQ,EAAE;YACR,YAAY,EAAE,CAAC,OAAO,CAAC;YACvB,WAAW,EAAE,uBAAuB;SACrC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -8,9 +8,9 @@ export declare const readManifestYml: (path: string) => Promise<ManifestSchema>;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const writeManifestYml: (path: string, value: ManifestSchema) => void;
|
|
10
10
|
/**
|
|
11
|
-
* Extracts the
|
|
11
|
+
* Extracts the UI resource project names from the given manifest.
|
|
12
12
|
*
|
|
13
|
-
* @param manifest Forge manifest to scan for
|
|
14
|
-
* @returns List of project names representing
|
|
13
|
+
* @param manifest Forge manifest to scan for UI resource projects.
|
|
14
|
+
* @returns List of project names representing UI resource projects.
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const extractUIResourceProjectNames: (manifest: ManifestSchema) => string[];
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.extractUIResourceProjectNames = exports.writeManifestYml = exports.readManifestYml = exports.validateManifestContent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const manifest_1 = require("@forge/manifest");
|
|
6
6
|
const FULL_SCHEMA = tslib_1.__importStar(require("@forge/manifest/out/schema/manifest-schema.json"));
|
|
7
7
|
const js_yaml_1 = require("js-yaml");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
+
const util_manifest_1 = require("../../shared/manifest/util-manifest");
|
|
9
10
|
class ManifestYmlValidator extends manifest_1.AbstractValidationProcessor {
|
|
10
11
|
constructor() {
|
|
11
12
|
super([
|
|
@@ -21,9 +22,7 @@ const schemaContentValidator = (manifestContent) => new manifest_1.SchemaValidat
|
|
|
21
22
|
});
|
|
22
23
|
const validateManifestSchema = (validator) => (input) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
23
24
|
const { manifestObject, success: isManifestParseSuccess, errors, } = yield validator(input);
|
|
24
|
-
if (!isManifestParseSuccess ||
|
|
25
|
-
!manifestObject ||
|
|
26
|
-
!manifestObject.typedContent) {
|
|
25
|
+
if (!isManifestParseSuccess || !(manifestObject === null || manifestObject === void 0 ? void 0 : manifestObject.typedContent)) {
|
|
27
26
|
throw new Error(`Failed to validate manifest input: ${(errors || [])
|
|
28
27
|
.map((e) => e.message)
|
|
29
28
|
.join('\n')}`);
|
|
@@ -49,13 +48,15 @@ const writeManifestYml = (path, value) => {
|
|
|
49
48
|
};
|
|
50
49
|
exports.writeManifestYml = writeManifestYml;
|
|
51
50
|
/**
|
|
52
|
-
* Extracts the
|
|
51
|
+
* Extracts the UI resource project names from the given manifest.
|
|
53
52
|
*
|
|
54
|
-
* @param manifest Forge manifest to scan for
|
|
55
|
-
* @returns List of project names representing
|
|
53
|
+
* @param manifest Forge manifest to scan for UI resource projects.
|
|
54
|
+
* @returns List of project names representing UI resource projects.
|
|
56
55
|
*/
|
|
57
|
-
const
|
|
58
|
-
return (manifest.resources || [])
|
|
56
|
+
const extractUIResourceProjectNames = (manifest) => {
|
|
57
|
+
return (manifest.resources || [])
|
|
58
|
+
.filter((0, util_manifest_1.isResourceType)(manifest, ['ui-kit', 'custom-ui']))
|
|
59
|
+
.map((r) => r.path);
|
|
59
60
|
};
|
|
60
|
-
exports.
|
|
61
|
+
exports.extractUIResourceProjectNames = extractUIResourceProjectNames;
|
|
61
62
|
//# sourceMappingURL=manifest-yml.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-yml.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/utils/forge/manifest-yml.ts"],"names":[],"mappings":";;;;AAAA,8CAMyB;AACzB,qGAA+E;AAC/E,qCAA+B;AAC/B,2BAAmC;
|
|
1
|
+
{"version":3,"file":"manifest-yml.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/utils/forge/manifest-yml.ts"],"names":[],"mappings":";;;;AAAA,8CAMyB;AACzB,qGAA+E;AAC/E,qCAA+B;AAC/B,2BAAmC;AAEnC,uEAAqE;AAErE,MAAM,oBAAqB,SAAQ,sCAA2C;IAC5E;QACE,KAAK,CAAC;YACJ,IAAI,wBAAa,EAAE;YACnB,IAAI,wBAAa,EAAE;YACnB,IAAI,0BAAe,CAAC,WAAW,CAAC;SACjC,CAAC,CAAC;IACL,CAAC;CACF;AAMD,MAAM,sBAAsB,GAAoC,CAC9D,gBAAwB,EACxB,EAAE,CAAC,IAAI,oBAAoB,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE1D,MAAM,sBAAsB,GAA4C,CACtE,eAA+B,EAC/B,EAAE,CACF,IAAI,0BAAe,CAAiB,WAAW,CAAC,CAAC,QAAQ,CAAC;IACxD,WAAW,EAAE,eAAe;CAC7B,CAAC,CAAC;AAEL,MAAM,sBAAsB,GAC1B,CAAI,SAAqC,EAAE,EAAE,CAC7C,CAAO,KAAQ,EAAE,EAAE;IACjB,MAAM,EACJ,cAAc,EACd,OAAO,EAAE,sBAAsB,EAC/B,MAAM,GACP,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAI,CAAC,sBAAsB,IAAI,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,YAAY,CAAA,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CACb,sCAAsC,CAAC,MAAM,IAAI,EAAE,CAAC;aACjD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CA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
{"version":3,"file":"get-serve-config.js","sourceRoot":"","sources":["../../../../../../packages/nx-forge/src/shared/targets/get-serve-config.ts"],"names":[],"mappings":";;AAKA,wCAaC;AAbD,SAAgB,cAAc,CAC5B,OAA8B;IAE9B,OAAO;QACL,QAAQ,EAAE,4BAA4B;QACtC,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;QACD,QAAQ,EAAE;YACR,YAAY,EAAE,CAAC,OAAO,CAAC;YACvB,WAAW,EAAE,uBAAuB;SACrC;KACF,CAAC;AACJ,CAAC"}
|