@onivoro/onix 20.5.74 → 20.5.76
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/executors.json +5 -0
- package/package.json +1 -1
- package/src/executors/deploy-fullstack/executor.d.ts +4 -0
- package/src/executors/deploy-fullstack/executor.js +71 -0
- package/src/executors/deploy-fullstack/executor.js.map +1 -0
- package/src/executors/deploy-fullstack/schema.d.ts +6 -0
- package/src/executors/deploy-fullstack/schema.json +30 -0
- package/src/executors/openapi-gen/executor.js +5 -2
- package/src/executors/openapi-gen/executor.js.map +1 -1
- package/src/executors/openapi-gen/schema.d.ts +1 -0
- package/src/executors/openapi-gen/schema.json +4 -0
package/executors.json
CHANGED
|
@@ -74,6 +74,11 @@
|
|
|
74
74
|
"implementation": "./src/executors/terraform/executor",
|
|
75
75
|
"schema": "./src/executors/terraform/schema.json",
|
|
76
76
|
"description": "terraform"
|
|
77
|
+
},
|
|
78
|
+
"deploy-fullstack": {
|
|
79
|
+
"implementation": "./src/executors/deploy-fullstack/executor",
|
|
80
|
+
"schema": "./src/executors/deploy-fullstack/schema.json",
|
|
81
|
+
"description": "Builds a server project with embedded UI assets and publishes to npm"
|
|
77
82
|
}
|
|
78
83
|
}
|
|
79
84
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
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 child_process_1 = require("child_process");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const extract_project_build_outputs_function_1 = require("../../functions/extract-project-build-outputs.function");
|
|
9
|
+
const extract_project_build_assets_function_1 = require("../../functions/extract-project-build-assets.function");
|
|
10
|
+
const extract_project_configuration_function_1 = require("../../functions/extract-project-configuration.function");
|
|
11
|
+
const pmx_function_1 = require("../../functions/pmx.function");
|
|
12
|
+
const uiAssetFolderName = 'ui';
|
|
13
|
+
const executor = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const { ui, dryRun, tag = 'latest', access = 'public' } = options;
|
|
15
|
+
const serverProject = context.projectName;
|
|
16
|
+
try {
|
|
17
|
+
// Step 1: Build the server project (browser build runs first via dependsOn)
|
|
18
|
+
devkit_1.logger.info(`Building ${serverProject}...`);
|
|
19
|
+
(0, pmx_function_1.pmxSpawn)(context, `nx build ${serverProject}`, { NODE_ENV: 'production' });
|
|
20
|
+
// Step 2: Extract paths from project configurations
|
|
21
|
+
const [serverAssetPath] = (0, extract_project_build_assets_function_1.extractProjectBuildAssets)(context, serverProject);
|
|
22
|
+
const [serverOutput] = (0, extract_project_build_outputs_function_1.extractProjectBuildOutputs)(context, serverProject);
|
|
23
|
+
if (!serverOutput) {
|
|
24
|
+
throw new Error(`Could not determine build output path for "${serverProject}". Ensure targets.build.options.outputPath is configured.`);
|
|
25
|
+
}
|
|
26
|
+
// Step 3: Build UI and copy into server assets
|
|
27
|
+
if (!serverAssetPath) {
|
|
28
|
+
throw new Error(`Could not determine asset path for "${serverProject}". Ensure targets.build.options.assets is configured (e.g. ["./src/assets"]).`);
|
|
29
|
+
}
|
|
30
|
+
const [uiOutput] = (0, extract_project_build_outputs_function_1.extractProjectBuildOutputs)(context, ui);
|
|
31
|
+
if (!uiOutput) {
|
|
32
|
+
throw new Error(`Could not determine build output path for UI project "${ui}". Ensure it has a build target with outputPath configured.`);
|
|
33
|
+
}
|
|
34
|
+
// Build the UI project explicitly (may already be built via dependsOn, but ensure it)
|
|
35
|
+
devkit_1.logger.info(`Building UI project ${ui}...`);
|
|
36
|
+
(0, pmx_function_1.pmxSpawn)(context, `nx build ${ui}`, { NODE_ENV: 'production' });
|
|
37
|
+
if (!(0, fs_1.existsSync)(uiOutput)) {
|
|
38
|
+
throw new Error(`UI build output directory does not exist: ${uiOutput}. The UI build may have failed.`);
|
|
39
|
+
}
|
|
40
|
+
// Compute destination path: {serverDist}/assets/ui/
|
|
41
|
+
const serverConfig = (0, extract_project_configuration_function_1.extractProjectConfiguration)(context, serverProject);
|
|
42
|
+
const [distPrefix] = serverOutput.split(serverConfig.root);
|
|
43
|
+
const [, assetsRelativePath] = serverAssetPath.split(serverConfig.sourceRoot);
|
|
44
|
+
const uiDestination = (0, path_1.join)(distPrefix, serverConfig.root, assetsRelativePath, uiAssetFolderName);
|
|
45
|
+
devkit_1.logger.info(`Copying UI build from ${uiOutput} to ${uiDestination}`);
|
|
46
|
+
(0, child_process_1.execSync)(`cp -R ${uiOutput} ${uiDestination}`, { stdio: 'inherit' });
|
|
47
|
+
// Verify the copy succeeded
|
|
48
|
+
const indexHtml = (0, path_1.join)(uiDestination, 'index.html');
|
|
49
|
+
if (!(0, fs_1.existsSync)(indexHtml)) {
|
|
50
|
+
throw new Error(`UI asset copy verification failed: ${indexHtml} not found.`);
|
|
51
|
+
}
|
|
52
|
+
devkit_1.logger.info(`UI assets embedded successfully.`);
|
|
53
|
+
// Step 4: Publish to npm
|
|
54
|
+
if (dryRun) {
|
|
55
|
+
devkit_1.logger.info(`Dry run mode — skipping npm publish. Package is ready at: ${serverOutput}`);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const publishCmd = `npm publish ${serverOutput} --access ${access} --tag ${tag}`;
|
|
59
|
+
devkit_1.logger.info(`Publishing: ${publishCmd}`);
|
|
60
|
+
(0, child_process_1.execSync)(publishCmd, { stdio: 'inherit' });
|
|
61
|
+
devkit_1.logger.info(`Published successfully.`);
|
|
62
|
+
}
|
|
63
|
+
return { success: true };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
devkit_1.logger.error((error === null || error === void 0 ? void 0 : error.message) || error);
|
|
67
|
+
return { success: false };
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
exports.default = executor;
|
|
71
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 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AI,CAAC,kCAAkC,CAAC,CAAC;QAEhD,yBAAyB;QACzB,IAAI,MAAM,EAAE,CAAC;YACX,eAAM,CAAC,IAAI,CAAC,6DAA6D,YAAY,EAAE,CAAC,CAAC;QAC3F,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,GAAG,eAAe,YAAY,aAAa,MAAM,UAAU,GAAG,EAAE,CAAC;YACjF,eAAM,CAAC,IAAI,CAAC,eAAe,UAAU,EAAE,CAAC,CAAC;YACzC,IAAA,wBAAQ,EAAC,UAAU,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3C,eAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,KAAI,KAAK,CAAC,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Release Fullstack executor",
|
|
5
|
+
"description": "Builds a server project with embedded UI assets and publishes to npm",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"ui": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Name of the browser/UI project whose build output should be embedded in the server assets"
|
|
11
|
+
},
|
|
12
|
+
"dryRun": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "If true, performs the build and asset copy but skips npm publish",
|
|
15
|
+
"default": false
|
|
16
|
+
},
|
|
17
|
+
"tag": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "npm dist-tag to publish under (e.g. 'latest', 'next', 'beta')",
|
|
20
|
+
"default": "latest"
|
|
21
|
+
},
|
|
22
|
+
"access": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"enum": ["public", "restricted"],
|
|
25
|
+
"description": "npm publish access level",
|
|
26
|
+
"default": "public"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": ["ui"]
|
|
30
|
+
}
|
|
@@ -4,9 +4,12 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const executor_factory_function_1 = require("../../functions/executor-factory.function");
|
|
6
6
|
const DEFAULT_OPENAPI_GENERATOR_VERSION = 'v6.3.0';
|
|
7
|
-
exports.default = (0, executor_factory_function_1.executorFactory)((_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ flavor = 'typescript-axios', version = DEFAULT_OPENAPI_GENERATOR_VERSION, openapiJsonPath, outputPath }) {
|
|
7
|
+
exports.default = (0, executor_factory_function_1.executorFactory)((_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ flavor = 'typescript-axios', version = DEFAULT_OPENAPI_GENERATOR_VERSION, additionalProperties, openapiJsonPath, outputPath }) {
|
|
8
8
|
(0, child_process_1.execSync)(`rm -rf ${outputPath}`, { stdio: 'inherit' });
|
|
9
9
|
(0, child_process_1.execSync)(`mkdir -p ${outputPath}`, { stdio: 'inherit' });
|
|
10
|
-
|
|
10
|
+
const additionalPropertiesArg = additionalProperties
|
|
11
|
+
? ` --additional-properties ${additionalProperties}`
|
|
12
|
+
: '';
|
|
13
|
+
(0, child_process_1.execSync)(`docker run --rm -v .:/local openapitools/openapi-generator-cli:${version} generate -i local/${openapiJsonPath} -g ${flavor} -o local/${outputPath}${additionalPropertiesArg}`, { stdio: 'inherit' });
|
|
11
14
|
}));
|
|
12
15
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/openapi-gen/executor.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,yFAA4E;AAG5E,MAAM,iCAAiC,GAAG,QAAQ,CAAC;AAEnD,kBAAe,IAAA,2CAAe,EAAC,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/openapi-gen/executor.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,yFAA4E;AAG5E,MAAM,iCAAiC,GAAG,QAAQ,CAAC;AAEnD,kBAAe,IAAA,2CAAe,EAAC,KAAwJ,EAAE,oDAAnJ,EAAE,MAAM,GAAG,kBAAkB,EAAE,OAAO,GAAG,iCAAiC,EAAE,oBAAoB,EAAE,eAAe,EAAE,UAAU,EAAkB;IACnL,IAAA,wBAAQ,EAAC,UAAU,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACvD,IAAA,wBAAQ,EAAC,YAAY,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACzD,MAAM,uBAAuB,GAAG,oBAAoB;QAClD,CAAC,CAAC,4BAA4B,oBAAoB,EAAE;QACpD,CAAC,CAAC,EAAE,CAAC;IAEP,IAAA,wBAAQ,EAAC,kEAAkE,OAAO,sBAAsB,eAAe,OAAO,MAAM,aAAa,UAAU,GAAG,uBAAuB,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AACjN,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"type": "string",
|
|
14
14
|
"description": "Container version tag for openapitools/openapi-generator-cli. Defaults to 'v6.3.0'."
|
|
15
15
|
},
|
|
16
|
+
"additionalProperties": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Comma-separated key=value pairs passed to OpenAPI Generator CLI --additional-properties."
|
|
19
|
+
},
|
|
16
20
|
"openapiJsonPath": {
|
|
17
21
|
"type": "string",
|
|
18
22
|
"description": "Path to the openapi definition JSON file (or yml file)."
|