@onivoro/onix 3.3.11 → 3.3.13
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/constants/build-target-name.constant.d.ts +1 -0
- package/src/constants/build-target-name.constant.js +5 -0
- package/src/constants/build-target-name.constant.js.map +1 -0
- package/src/constants/onix-config-glob.constant.d.ts +1 -0
- package/src/constants/onix-config-glob.constant.js +5 -0
- package/src/constants/onix-config-glob.constant.js.map +1 -0
- package/src/functions/add-db-target.function.d.ts +3 -0
- package/src/functions/add-db-target.function.js +31 -0
- package/src/functions/add-db-target.function.js.map +1 -0
- package/src/functions/add-db-targets.function.d.ts +3 -0
- package/src/functions/add-db-targets.function.js +10 -0
- package/src/functions/add-db-targets.function.js.map +1 -0
- package/src/functions/add-docker-target.function.d.ts +3 -0
- package/src/functions/add-docker-target.function.js +22 -0
- package/src/functions/add-docker-target.function.js.map +1 -0
- package/src/functions/add-docker-targets.function.d.ts +3 -0
- package/src/functions/add-docker-targets.function.js +10 -0
- package/src/functions/add-docker-targets.function.js.map +1 -0
- package/src/functions/add-gen-target.function.d.ts +3 -0
- package/src/functions/add-gen-target.function.js +30 -0
- package/src/functions/add-gen-target.function.js.map +1 -0
- package/src/functions/add-serve-target.function.d.ts +3 -0
- package/src/functions/add-serve-target.function.js +28 -0
- package/src/functions/add-serve-target.function.js.map +1 -0
- package/src/functions/add-serve-targets.function.d.ts +3 -0
- package/src/functions/add-serve-targets.function.js +10 -0
- package/src/functions/add-serve-targets.function.js.map +1 -0
- package/src/functions/build-onix-targets.function.d.ts +4 -0
- package/src/functions/build-onix-targets.function.js +31 -0
- package/src/functions/build-onix-targets.function.js.map +1 -0
- package/src/functions/create-nodes-internal.function.d.ts +0 -0
- package/src/functions/create-nodes-internal.function.js +1 -0
- package/src/functions/create-nodes-internal.function.js.map +1 -0
- package/src/functions/normalize-options.function.d.ts +2 -0
- package/src/functions/normalize-options.function.js +15 -0
- package/src/functions/normalize-options.function.js.map +1 -0
- package/src/functions/normalize-output-path.function.d.ts +1 -0
- package/src/functions/normalize-output-path.function.js +28 -0
- package/src/functions/normalize-output-path.function.js.map +1 -0
- package/src/functions/read-targets-cache.function.d.ts +2 -0
- package/src/functions/read-targets-cache.function.js +9 -0
- package/src/functions/read-targets-cache.function.js.map +1 -0
- package/src/functions/write-targets-to-cache.function.d.ts +2 -0
- package/src/functions/write-targets-to-cache.function.js +9 -0
- package/src/functions/write-targets-to-cache.function.js.map +1 -0
- package/src/index.d.ts +8 -0
- package/src/index.js +8 -0
- package/src/index.js.map +1 -1
- package/src/plugins/plugin.d.ts +1 -8
- package/src/plugins/plugin.js +13 -124
- package/src/plugins/plugin.js.map +1 -1
- package/src/types/onix-config.type.d.ts +11 -9
- package/src/types/onix-plugin-options.type.d.ts +8 -0
- package/src/types/onix-plugin-options.type.js +3 -0
- package/src/types/onix-plugin-options.type.js.map +1 -0
- package/src/types/onix-targets.type.d.ts +2 -0
- package/src/types/onix-targets.type.js +3 -0
- package/src/types/onix-targets.type.js.map +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildTargetName = "build";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-target-name.constant.js","sourceRoot":"","sources":["../../../../onix/src/constants/build-target-name.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const onixConfigGlob = "**/onix.config.{js,ts,mjs,mts,cjs,cts}";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onix-config-glob.constant.js","sourceRoot":"","sources":["../../../../onix/src/constants/onix-config-glob.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TargetConfiguration } from "@nx/devkit";
|
|
2
|
+
import { TOnixEnvironmentConfig } from "../types/onix-config.type";
|
|
3
|
+
export declare function addDbTarget(environment: string, config: TOnixEnvironmentConfig, targets: Record<string, TargetConfiguration<any>>, projectJson: any, namedInputs: any): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDbTarget = addDbTarget;
|
|
4
|
+
const build_target_name_constant_1 = require("../constants/build-target-name.constant");
|
|
5
|
+
function addDbTarget(environment, config, targets, projectJson, namedInputs) {
|
|
6
|
+
const { envKey, envPath, ormConfigPath } = config;
|
|
7
|
+
if (ormConfigPath) {
|
|
8
|
+
['run', 'revert'].forEach(runOrRevert => {
|
|
9
|
+
const targetName = `onix-db-${(runOrRevert === 'run') ? 'migrate' : runOrRevert}-${environment}`;
|
|
10
|
+
targets[targetName] = {
|
|
11
|
+
command: `export ${envKey}=${envPath} && npm run typeorm -- -d ${ormConfigPath} migration:${runOrRevert} -t=false`,
|
|
12
|
+
options: { cwd: process.cwd() },
|
|
13
|
+
cache: true,
|
|
14
|
+
dependsOn: [`^${build_target_name_constant_1.buildTargetName}`],
|
|
15
|
+
inputs: [
|
|
16
|
+
...('production' in namedInputs
|
|
17
|
+
? ['production', '^production']
|
|
18
|
+
: ['default', '^default']),
|
|
19
|
+
{
|
|
20
|
+
externalDependencies: [],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
metadata: {
|
|
24
|
+
technologies: ['TypeORM, ts-node', 'npm'],
|
|
25
|
+
description: `Runs the docker image locally`,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=add-db-target.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-db-target.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-db-target.function.ts"],"names":[],"mappings":";;AAIA,kCA2BC;AA7BD,wFAA0E;AAE1E,SAAgB,WAAW,CAAC,WAAmB,EAAE,MAA8B,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IAC/J,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAElD,IAAI,aAAa,EAAE,CAAC;QAClB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YACtC,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,IAAI,WAAW,EAAE,CAAC;YAEjG,OAAO,CAAC,UAAU,CAAC,GAAG;gBACpB,OAAO,EAAE,UAAU,MAAM,IAAI,OAAO,6BAA6B,aAAa,cAAc,WAAW,WAAW;gBAClH,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE;gBAC/B,KAAK,EAAE,IAAI;gBACX,SAAS,EAAE,CAAC,IAAI,4CAAe,EAAE,CAAC;gBAClC,MAAM,EAAE;oBACN,GAAG,CAAC,YAAY,IAAI,WAAW;wBAC7B,CAAC,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC;wBAC/B,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;oBAC5B;wBACE,oBAAoB,EAAE,EAAE;qBACzB;iBACF;gBACD,QAAQ,EAAE;oBACR,YAAY,EAAE,CAAC,kBAAkB,EAAE,KAAK,CAAC;oBACzC,WAAW,EAAE,+BAA+B;iBAC7C;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDbTargets = addDbTargets;
|
|
4
|
+
const add_db_target_function_1 = require("./add-db-target.function");
|
|
5
|
+
function addDbTargets(onixConfig, targets, projectJson, namedInputs) {
|
|
6
|
+
Object.entries(onixConfig.environments || {}).forEach(([environment, config]) => {
|
|
7
|
+
(0, add_db_target_function_1.addDbTarget)(environment, config, targets, projectJson, namedInputs);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=add-db-targets.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-db-targets.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-db-targets.function.ts"],"names":[],"mappings":";;AAIA,oCAIC;AAND,qEAAuD;AAEvD,SAAgB,YAAY,CAAC,UAAuB,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IAClI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE;QAC5E,IAAA,oCAAW,EAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TargetConfiguration } from "@nx/devkit";
|
|
2
|
+
import { TOnixEnvironmentConfig } from "../types/onix-config.type";
|
|
3
|
+
export declare function addDockerTarget(environment: string, config: TOnixEnvironmentConfig, targets: Record<string, TargetConfiguration<any>>, projectJson: any, namedInputs: any): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDockerTarget = addDockerTarget;
|
|
4
|
+
function addDockerTarget(environment, config, targets, projectJson, namedInputs) {
|
|
5
|
+
const targetName = `onix-serve-docker-${environment}`;
|
|
6
|
+
const { envPath, envKey, ecr, port } = config;
|
|
7
|
+
const localPort = (Number(port) + 2000);
|
|
8
|
+
if (ecr) {
|
|
9
|
+
targets[targetName] = {
|
|
10
|
+
command: `open http://localhost:${localPort} & docker run -p ${localPort}:${port} --env="PORT=${port}" --env-file "${envPath}" "${ecr}"`,
|
|
11
|
+
options: { cwd: process.cwd() },
|
|
12
|
+
cache: true,
|
|
13
|
+
inputs: [],
|
|
14
|
+
outputs: [],
|
|
15
|
+
metadata: {
|
|
16
|
+
technologies: ['Docker'],
|
|
17
|
+
description: `Runs the docker image locally`,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=add-docker-target.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-docker-target.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-docker-target.function.ts"],"names":[],"mappings":";;AAGA,0CAkBC;AAlBD,SAAgB,eAAe,CAAC,WAAmB,EAAE,MAA8B,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IACjK,MAAM,UAAU,GAAG,qBAAqB,WAAW,EAAE,CAAC;IACtD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAExC,IAAI,GAAG,EAAE,CAAC;QACN,OAAO,CAAC,UAAU,CAAC,GAAG;YAClB,OAAO,EAAE,yBAAyB,SAAS,oBAAoB,SAAS,IAAI,IAAI,gBAAgB,IAAI,iBAAiB,OAAO,MAAM,GAAG,GAAG;YACxI,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE;YAC/B,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE;gBACN,YAAY,EAAE,CAAC,QAAQ,CAAC;gBACxB,WAAW,EAAE,+BAA+B;aAC/C;SACJ,CAAC;IACN,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDockerTargets = addDockerTargets;
|
|
4
|
+
const add_docker_target_function_1 = require("./add-docker-target.function");
|
|
5
|
+
function addDockerTargets(onixConfig, targets, projectJson, namedInputs) {
|
|
6
|
+
Object.entries(onixConfig.environments || {}).forEach(([environment, config]) => {
|
|
7
|
+
(0, add_docker_target_function_1.addDockerTarget)(environment, config, targets, projectJson, namedInputs);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=add-docker-targets.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-docker-targets.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-docker-targets.function.ts"],"names":[],"mappings":";;AAIA,4CAIG;AANH,6EAA+D;AAE/D,SAAgB,gBAAgB,CAAC,UAAuB,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IACtI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE;QAC9E,IAAA,4CAAe,EAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addGenTarget = addGenTarget;
|
|
4
|
+
const build_target_name_constant_1 = require("../constants/build-target-name.constant");
|
|
5
|
+
function addGenTarget(onixConfig, targets, projectJson, namedInputs) {
|
|
6
|
+
const { moniker } = onixConfig;
|
|
7
|
+
if (moniker) {
|
|
8
|
+
const targetName = `onix-generate-axios`;
|
|
9
|
+
const command = `rm -rf libs/axios/${moniker}/src/lib && mkdir -p libs/axios/${moniker}/src/lib && docker run --rm -v .:/local openapitools/openapi-generator-cli:v6.3.0 generate -i local/api-dox/app-api-${moniker}.json -g typescript-axios -o local/libs/axios/${moniker}/src/lib`;
|
|
10
|
+
targets[targetName] = {
|
|
11
|
+
command,
|
|
12
|
+
options: { cwd: process.cwd() },
|
|
13
|
+
cache: true,
|
|
14
|
+
dependsOn: [`^${build_target_name_constant_1.buildTargetName}`],
|
|
15
|
+
inputs: [
|
|
16
|
+
...('production' in namedInputs
|
|
17
|
+
? ['production', '^production']
|
|
18
|
+
: ['default', '^default']),
|
|
19
|
+
{
|
|
20
|
+
externalDependencies: [],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
metadata: {
|
|
24
|
+
technologies: ['openapi', 'docker'],
|
|
25
|
+
description: `Generates the openapi client`,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=add-gen-target.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-gen-target.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-gen-target.function.ts"],"names":[],"mappings":";;AAIA,oCA2BC;AA7BD,wFAA0E;AAE1E,SAAgB,YAAY,CAAC,UAAuB,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IAClI,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAE/B,IAAI,OAAO,EAAE,CAAC;QACV,MAAM,UAAU,GAAG,qBAAqB,CAAC;QAEzC,MAAM,OAAO,GAAG,qBAAqB,OAAO,mCAAmC,OAAO,uHAAuH,OAAO,iDAAiD,OAAO,UAAU,CAAC;QAEvR,OAAO,CAAC,UAAU,CAAC,GAAG;YACpB,OAAO;YACP,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE;YAC/B,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,CAAC,IAAI,4CAAe,EAAE,CAAC;YAClC,MAAM,EAAE;gBACN,GAAG,CAAC,YAAY,IAAI,WAAW;oBAC7B,CAAC,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC;oBAC/B,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;gBAC5B;oBACE,oBAAoB,EAAE,EAAE;iBACzB;aACF;YACD,QAAQ,EAAE;gBACR,YAAY,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;gBACnC,WAAW,EAAE,8BAA8B;aAC5C;SACF,CAAC;IACN,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TargetConfiguration } from "@nx/devkit";
|
|
2
|
+
import { TOnixEnvironmentConfig } from "../types/onix-config.type";
|
|
3
|
+
export declare function addServeTarget(environment: string, config: TOnixEnvironmentConfig, targets: Record<string, TargetConfiguration<any>>, projectJson: any, namedInputs: any): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addServeTarget = addServeTarget;
|
|
4
|
+
function addServeTarget(environment, config, targets, projectJson, namedInputs) {
|
|
5
|
+
const buildTargetName = `build`;
|
|
6
|
+
const targetName = `onix-serve-${environment}`;
|
|
7
|
+
const { envPath, envKey } = config;
|
|
8
|
+
targets[targetName] = {
|
|
9
|
+
command: `export ${envKey}=${envPath} && npx nx run ${projectJson.name}:serve`,
|
|
10
|
+
options: { cwd: process.cwd() },
|
|
11
|
+
cache: true,
|
|
12
|
+
dependsOn: [`^${buildTargetName}`],
|
|
13
|
+
inputs: [
|
|
14
|
+
...('production' in namedInputs
|
|
15
|
+
? ['production', '^production']
|
|
16
|
+
: ['default', '^default']),
|
|
17
|
+
{
|
|
18
|
+
externalDependencies: [],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
outputs: [],
|
|
22
|
+
metadata: {
|
|
23
|
+
technologies: ['NodeJS, Nx'],
|
|
24
|
+
description: `Invokes Nx serve with config-specified environment`,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=add-serve-target.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-serve-target.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-serve-target.function.ts"],"names":[],"mappings":";;AAGA,wCAuBC;AAvBD,SAAgB,cAAc,CAAC,WAAmB,EAAE,MAA8B,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IAClK,MAAM,eAAe,GAAG,OAAO,CAAC;IAChC,MAAM,UAAU,GAAG,cAAc,WAAW,EAAE,CAAC;IAC/C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACnC,OAAO,CAAC,UAAU,CAAC,GAAG;QACpB,OAAO,EAAE,UAAU,MAAM,IAAI,OAAO,kBAAkB,WAAW,CAAC,IAAI,QAAQ;QAC9E,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE;QAC/B,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,CAAC,IAAI,eAAe,EAAE,CAAC;QAClC,MAAM,EAAE;YACN,GAAG,CAAC,YAAY,IAAI,WAAW;gBAC7B,CAAC,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC;gBAC/B,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YAC5B;gBACE,oBAAoB,EAAE,EAAE;aACzB;SACF;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE;YACR,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,WAAW,EAAE,oDAAoD;SAClE;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addServeTargets = addServeTargets;
|
|
4
|
+
const add_serve_target_function_1 = require("./add-serve-target.function");
|
|
5
|
+
function addServeTargets(onixConfig, targets, projectJson, namedInputs) {
|
|
6
|
+
Object.entries(onixConfig.environments || {}).forEach(([environment, config]) => {
|
|
7
|
+
(0, add_serve_target_function_1.addServeTarget)(environment, config, targets, projectJson, namedInputs);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=add-serve-targets.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-serve-targets.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-serve-targets.function.ts"],"names":[],"mappings":";;AAIA,0CAIC;AAND,2EAA6D;AAE7D,SAAgB,eAAe,CAAC,UAAuB,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IACvI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE;QAC9E,IAAA,0CAAc,EAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CreateNodesContext } from "@nx/devkit";
|
|
2
|
+
import { TOnixPluginOptions } from "../types/onix-plugin-options.type";
|
|
3
|
+
import { TOnixTargets } from "../types/onix-targets.type";
|
|
4
|
+
export declare function buildOnixTargets(configFilePath: string, projectRoot: string, options: TOnixPluginOptions, context: CreateNodesContext): Promise<TOnixTargets>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildOnixTargets = buildOnixTargets;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const add_serve_targets_function_1 = require("./add-serve-targets.function");
|
|
10
|
+
const add_docker_targets_function_1 = require("./add-docker-targets.function");
|
|
11
|
+
const add_db_targets_function_1 = require("./add-db-targets.function");
|
|
12
|
+
const add_gen_target_function_1 = require("./add-gen-target.function");
|
|
13
|
+
function buildOnixTargets(configFilePath, projectRoot, options, context) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const absoluteConfigFilePath = (0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath);
|
|
16
|
+
const projectJsonPath = (0, path_1.join)(context.workspaceRoot, projectRoot, 'project.json');
|
|
17
|
+
const projectJson = (0, devkit_1.parseJson)((0, fs_1.readFileSync)(projectJsonPath, 'utf-8'));
|
|
18
|
+
const targets = {};
|
|
19
|
+
devkit_1.logger.warn(absoluteConfigFilePath);
|
|
20
|
+
const onixConfig = require(absoluteConfigFilePath);
|
|
21
|
+
devkit_1.logger.warn(onixConfig);
|
|
22
|
+
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
23
|
+
(0, add_serve_targets_function_1.addServeTargets)(onixConfig, targets, projectJson, namedInputs);
|
|
24
|
+
(0, add_docker_targets_function_1.addDockerTargets)(onixConfig, targets, projectJson, namedInputs);
|
|
25
|
+
(0, add_db_targets_function_1.addDbTargets)(onixConfig, targets, projectJson, namedInputs);
|
|
26
|
+
(0, add_gen_target_function_1.addGenTarget)(onixConfig, targets, projectJson, namedInputs);
|
|
27
|
+
const metadata = {};
|
|
28
|
+
return { targets, metadata };
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=build-onix-targets.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-onix-targets.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/build-onix-targets.function.ts"],"names":[],"mappings":";;AAYA,4CA+BC;;AA3CD,uCAA2G;AAG3G,2BAAkC;AAElC,4EAAuE;AACvE,+BAA4B;AAC5B,6EAA+D;AAC/D,+EAAiE;AACjE,uEAAyD;AACzD,uEAAyD;AAEzD,SAAsB,gBAAgB,CAClC,cAAsB,EACtB,WAAmB,EACnB,OAA2B,EAC3B,OAA2B;;QAE3B,MAAM,sBAAsB,GAAG,IAAA,0BAAiB,EAC5C,OAAO,CAAC,aAAa,EACrB,cAAc,CACjB,CAAC;QAEF,MAAM,eAAe,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,aAAa,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QACjF,MAAM,WAAW,GAAG,IAAA,kBAAS,EAAC,IAAA,iBAAY,EAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;QAEtE,MAAM,OAAO,GAAwC,EAAE,CAAC;QAExD,eAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAEpC,MAAM,UAAU,GAAgB,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAEhE,eAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAExB,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAEzD,IAAA,4CAAe,EAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAC/D,IAAA,8CAAgB,EAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAChE,IAAA,sCAAY,EAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAC5D,IAAA,sCAAY,EAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAE5D,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACjC,CAAC;CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=create-nodes-internal.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-nodes-internal.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/create-nodes-internal.function.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = normalizeOptions;
|
|
4
|
+
function normalizeOptions(options) {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
|
+
options !== null && options !== void 0 ? options : (options = {});
|
|
7
|
+
(_a = options.buildTargetName) !== null && _a !== void 0 ? _a : (options.buildTargetName = 'build');
|
|
8
|
+
(_b = options.serveTargetName) !== null && _b !== void 0 ? _b : (options.serveTargetName = 'serve');
|
|
9
|
+
(_c = options.previewTargetName) !== null && _c !== void 0 ? _c : (options.previewTargetName = 'preview');
|
|
10
|
+
(_d = options.testTargetName) !== null && _d !== void 0 ? _d : (options.testTargetName = 'test');
|
|
11
|
+
(_e = options.serveStaticTargetName) !== null && _e !== void 0 ? _e : (options.serveStaticTargetName = 'serve-static');
|
|
12
|
+
(_f = options.typecheckTargetName) !== null && _f !== void 0 ? _f : (options.typecheckTargetName = 'typecheck');
|
|
13
|
+
return options;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=normalize-options.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/normalize-options.function.ts"],"names":[],"mappings":";;AAEA,4CASC;AATD,SAAgB,gBAAgB,CAAC,OAA2B;;IACxD,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAAE,EAAC;IACf,MAAA,OAAO,CAAC,eAAe,oCAAvB,OAAO,CAAC,eAAe,GAAK,OAAO,EAAC;IACpC,MAAA,OAAO,CAAC,eAAe,oCAAvB,OAAO,CAAC,eAAe,GAAK,OAAO,EAAC;IACpC,MAAA,OAAO,CAAC,iBAAiB,oCAAzB,OAAO,CAAC,iBAAiB,GAAK,SAAS,EAAC;IACxC,MAAA,OAAO,CAAC,cAAc,oCAAtB,OAAO,CAAC,cAAc,GAAK,MAAM,EAAC;IAClC,MAAA,OAAO,CAAC,qBAAqB,oCAA7B,OAAO,CAAC,qBAAqB,GAAK,cAAc,EAAC;IACjD,MAAA,OAAO,CAAC,mBAAmB,oCAA3B,OAAO,CAAC,mBAAmB,GAAK,WAAW,EAAC;IAC5C,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeOutputPath(outputPath: string | undefined, projectRoot: string, workspaceRoot: string, path: string): string | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOutputPath = normalizeOutputPath;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
function normalizeOutputPath(outputPath, projectRoot, workspaceRoot, path) {
|
|
6
|
+
if (!outputPath) {
|
|
7
|
+
if (projectRoot === '.') {
|
|
8
|
+
return `{projectRoot}/${path}`;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return `{workspaceRoot}/${path}/{projectRoot}`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if ((0, path_1.isAbsolute)(outputPath)) {
|
|
16
|
+
return `{workspaceRoot}/${(0, path_1.relative)(workspaceRoot, outputPath)}`;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
if (outputPath.startsWith('..')) {
|
|
20
|
+
return (0, path_1.join)('{workspaceRoot}', (0, path_1.join)(projectRoot, outputPath));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return (0, path_1.join)('{projectRoot}', outputPath);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=normalize-output-path.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-output-path.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/normalize-output-path.function.ts"],"names":[],"mappings":";;AAEA,kDAuBC;AAzBD,+BAAkD;AAElD,SAAgB,mBAAmB,CAC/B,UAA8B,EAC9B,WAAmB,EACnB,aAAqB,EACrB,IAAY;IAEZ,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,IAAI,WAAW,KAAK,GAAG,EAAE,CAAC;YACtB,OAAO,iBAAiB,IAAI,EAAE,CAAC;QACnC,CAAC;aAAM,CAAC;YACJ,OAAO,mBAAmB,IAAI,gBAAgB,CAAC;QACnD,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,IAAI,IAAA,iBAAU,EAAC,UAAU,CAAC,EAAE,CAAC;YACzB,OAAO,mBAAmB,IAAA,eAAQ,EAAC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC;QACpE,CAAC;aAAM,CAAC;YACJ,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9B,OAAO,IAAA,WAAI,EAAC,iBAAiB,EAAE,IAAA,WAAI,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACJ,OAAO,IAAA,WAAI,EAAC,eAAe,EAAE,UAAU,CAAC,CAAC;YAC7C,CAAC;QACL,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readTargetsCache = readTargetsCache;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
function readTargetsCache(cachePath) {
|
|
7
|
+
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=read-targets-cache.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-targets-cache.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/read-targets-cache.function.ts"],"names":[],"mappings":";;AAIA,4CAEC;AAND,uCAA0C;AAC1C,2BAAgC;AAGhC,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,OAAO,IAAA,eAAU,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,qBAAY,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeTargetsToCache = writeTargetsToCache;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function writeTargetsToCache(cachePath, results) {
|
|
6
|
+
(0, devkit_1.writeJsonFile)(cachePath, results || {});
|
|
7
|
+
}
|
|
8
|
+
;
|
|
9
|
+
//# sourceMappingURL=write-targets-to-cache.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-targets-to-cache.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/write-targets-to-cache.function.ts"],"names":[],"mappings":";;AAGA,kDAEC;AALD,uCAA2C;AAG3C,SAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAsC;IACjF,IAAA,sBAAa,EAAC,SAAS,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC;AAAA,CAAC"}
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export { playwrightConfig } from './utils/playwright.config';
|
|
2
2
|
export * from './types/onix-config.type';
|
|
3
3
|
export * from './plugins/plugin';
|
|
4
|
+
export * from './functions/add-docker-target.function';
|
|
5
|
+
export * from './functions/add-docker-targets.function';
|
|
6
|
+
export * from './functions/add-serve-target.function';
|
|
7
|
+
export * from './functions/add-serve-targets.function';
|
|
8
|
+
export * from './functions/build-onix-targets.function';
|
|
9
|
+
export * from './functions/normalize-output-path.function';
|
|
10
|
+
export * from './functions/read-targets-cache.function';
|
|
11
|
+
export * from './functions/write-targets-to-cache.function';
|
package/src/index.js
CHANGED
|
@@ -6,4 +6,12 @@ var playwright_config_1 = require("./utils/playwright.config");
|
|
|
6
6
|
Object.defineProperty(exports, "playwrightConfig", { enumerable: true, get: function () { return playwright_config_1.playwrightConfig; } });
|
|
7
7
|
tslib_1.__exportStar(require("./types/onix-config.type"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./plugins/plugin"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./functions/add-docker-target.function"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./functions/add-docker-targets.function"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./functions/add-serve-target.function"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./functions/add-serve-targets.function"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./functions/build-onix-targets.function"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./functions/normalize-output-path.function"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./functions/read-targets-cache.function"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./functions/write-targets-to-cache.function"), exports);
|
|
9
17
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../onix/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAA6D;AAApD,qHAAA,gBAAgB,OAAA;AAEzB,mEAAyC;AAEzC,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../onix/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAA6D;AAApD,qHAAA,gBAAgB,OAAA;AAEzB,mEAAyC;AAEzC,2DAAiC;AAEjC,iFAAuD;AACvD,kFAAwD;AACxD,gFAAsD;AACtD,iFAAuD;AACvD,kFAAwD;AACxD,qFAA2D;AAC3D,kFAAwD;AACxD,sFAA4D"}
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { CreateDependencies, CreateNodes, CreateNodesV2 } from '@nx/devkit';
|
|
2
|
-
|
|
3
|
-
buildTargetName?: string;
|
|
4
|
-
testTargetName?: string;
|
|
5
|
-
serveTargetName?: string;
|
|
6
|
-
previewTargetName?: string;
|
|
7
|
-
serveStaticTargetName?: string;
|
|
8
|
-
typecheckTargetName?: string;
|
|
9
|
-
};
|
|
2
|
+
import { TOnixPluginOptions } from '../types/onix-plugin-options.type';
|
|
10
3
|
export declare const createDependencies: CreateDependencies;
|
|
11
4
|
export declare const createNodesV2: CreateNodesV2<TOnixPluginOptions>;
|
|
12
5
|
export declare const createNodes: CreateNodes<TOnixPluginOptions>;
|
package/src/plugins/plugin.js
CHANGED
|
@@ -4,44 +4,35 @@ exports.createNodes = exports.createNodesV2 = exports.createDependencies = void
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
8
7
|
const fs_1 = require("fs");
|
|
9
8
|
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
10
9
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
11
10
|
const js_1 = require("@nx/js");
|
|
12
11
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
const createDependencies = () => {
|
|
21
|
-
return [];
|
|
22
|
-
};
|
|
12
|
+
const read_targets_cache_function_1 = require("../functions/read-targets-cache.function");
|
|
13
|
+
const write_targets_to_cache_function_1 = require("../functions/write-targets-to-cache.function");
|
|
14
|
+
const normalize_options_function_1 = require("../functions/normalize-options.function");
|
|
15
|
+
const onix_config_glob_constant_1 = require("../constants/onix-config-glob.constant");
|
|
16
|
+
const build_onix_targets_function_1 = require("../functions/build-onix-targets.function");
|
|
17
|
+
const createDependencies = () => [];
|
|
23
18
|
exports.createDependencies = createDependencies;
|
|
24
|
-
const onixConfigGlob = '**/onix.config.{js,ts,mjs,mts,cjs,cts}';
|
|
25
19
|
exports.createNodesV2 = [
|
|
26
|
-
onixConfigGlob,
|
|
20
|
+
onix_config_glob_constant_1.onixConfigGlob,
|
|
27
21
|
(configFilePaths_1, ...args_1) => tslib_1.__awaiter(void 0, [configFilePaths_1, ...args_1], void 0, function* (configFilePaths, options = {}, context) {
|
|
28
22
|
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
29
23
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `vite-${optionsHash}.hash`);
|
|
30
|
-
const targetsCache = readTargetsCache(cachePath);
|
|
24
|
+
const targetsCache = (0, read_targets_cache_function_1.readTargetsCache)(cachePath);
|
|
31
25
|
try {
|
|
32
26
|
return yield (0, devkit_1.createNodesFromFiles)((configFile, options = {}, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, options, context);
|
|
33
27
|
}
|
|
34
28
|
finally {
|
|
35
|
-
writeTargetsToCache(cachePath, targetsCache);
|
|
29
|
+
(0, write_targets_to_cache_function_1.writeTargetsToCache)(cachePath, targetsCache);
|
|
36
30
|
}
|
|
37
31
|
}),
|
|
38
32
|
];
|
|
39
33
|
exports.createNodes = [
|
|
40
|
-
onixConfigGlob,
|
|
41
|
-
(configFilePath, options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
|
43
|
-
return createNodesInternal(configFilePath, options = {}, context, {});
|
|
44
|
-
}),
|
|
34
|
+
onix_config_glob_constant_1.onixConfigGlob,
|
|
35
|
+
(configFilePath, options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return createNodesInternal(configFilePath, options = {}, context, {}); })
|
|
45
36
|
];
|
|
46
37
|
function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
47
38
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -52,9 +43,9 @@ function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
|
52
43
|
!siblingFiles.includes('project.json')) {
|
|
53
44
|
return {};
|
|
54
45
|
}
|
|
55
|
-
const normalizedOptions = normalizeOptions(options);
|
|
46
|
+
const normalizedOptions = (0, normalize_options_function_1.normalizeOptions)(options);
|
|
56
47
|
const hash = (yield (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, normalizedOptions, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))])) + configFilePath;
|
|
57
|
-
const onixTargets = yield buildOnixTargets(configFilePath, projectRoot, normalizedOptions, context);
|
|
48
|
+
const onixTargets = yield (0, build_onix_targets_function_1.buildOnixTargets)(configFilePath, projectRoot, normalizedOptions, context);
|
|
58
49
|
(_a = targetsCache[hash]) !== null && _a !== void 0 ? _a : (targetsCache[hash] = onixTargets);
|
|
59
50
|
const { targets, metadata } = targetsCache[hash];
|
|
60
51
|
const project = {
|
|
@@ -69,106 +60,4 @@ function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
|
69
60
|
};
|
|
70
61
|
});
|
|
71
62
|
}
|
|
72
|
-
function buildOnixTargets(configFilePath, projectRoot, options, context) {
|
|
73
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const absoluteConfigFilePath = (0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath);
|
|
75
|
-
const projectJsonPath = (0, path_1.join)(context.workspaceRoot, projectRoot, 'project.json');
|
|
76
|
-
const projectJson = (0, devkit_1.parseJson)((0, fs_1.readFileSync)(projectJsonPath, 'utf-8'));
|
|
77
|
-
const targets = {};
|
|
78
|
-
devkit_1.logger.warn(absoluteConfigFilePath);
|
|
79
|
-
const onixConfig = require(absoluteConfigFilePath);
|
|
80
|
-
devkit_1.logger.warn(onixConfig);
|
|
81
|
-
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
82
|
-
addLocalServeTargets(onixConfig, targets, projectJson, namedInputs);
|
|
83
|
-
addDockerTargets(onixConfig, targets, projectJson, namedInputs);
|
|
84
|
-
const metadata = {};
|
|
85
|
-
return { targets, metadata };
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function addLocalServeTargets(onixConfig, targets, projectJson, namedInputs) {
|
|
89
|
-
Object.entries(onixConfig.environments || {}).forEach(([environment, config]) => {
|
|
90
|
-
addLocalServeTarget(environment, config, targets, projectJson, namedInputs);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function addDockerTargets(onixConfig, targets, projectJson, namedInputs) {
|
|
94
|
-
Object.entries(onixConfig.environments || {}).forEach(([environment, config]) => {
|
|
95
|
-
addDockerTarget(environment, config, targets, projectJson, namedInputs);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function addLocalServeTarget(environment, config, targets, projectJson, namedInputs) {
|
|
99
|
-
const buildTargetName = `build`;
|
|
100
|
-
const targetName = `onix-serve-${environment}`;
|
|
101
|
-
const { envPath, envKey } = config;
|
|
102
|
-
targets[targetName] = {
|
|
103
|
-
command: `export ${envKey}=${envPath} && npx nx run ${projectJson.name}:serve`,
|
|
104
|
-
options: { cwd: process.cwd() },
|
|
105
|
-
cache: true,
|
|
106
|
-
dependsOn: [`^${buildTargetName}`],
|
|
107
|
-
inputs: [
|
|
108
|
-
...('production' in namedInputs
|
|
109
|
-
? ['production', '^production']
|
|
110
|
-
: ['default', '^default']),
|
|
111
|
-
{
|
|
112
|
-
externalDependencies: [],
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
outputs: [],
|
|
116
|
-
metadata: {
|
|
117
|
-
technologies: ['NodeJS, Nx'],
|
|
118
|
-
description: `Invokes Nx serve with config-specified environment`,
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function addDockerTarget(environment, config, targets, projectJson, namedInputs) {
|
|
123
|
-
const targetName = `onix-serve-docker-${environment}`;
|
|
124
|
-
const { envPath, envKey, ecr, port } = config;
|
|
125
|
-
const localPort = (Number(port) + 2000);
|
|
126
|
-
if (ecr) {
|
|
127
|
-
targets[targetName] = {
|
|
128
|
-
command: `open http://localhost:${localPort} & docker run -p ${localPort}:${port} --env="PORT=${port}" --env-file "${envPath}" "${ecr}"`,
|
|
129
|
-
options: { cwd: process.cwd() },
|
|
130
|
-
cache: true,
|
|
131
|
-
inputs: [],
|
|
132
|
-
outputs: [],
|
|
133
|
-
metadata: {
|
|
134
|
-
technologies: ['Docker'],
|
|
135
|
-
description: `Runs the docker image locally`,
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function normalizeOutputPath(outputPath, projectRoot, workspaceRoot, path) {
|
|
141
|
-
if (!outputPath) {
|
|
142
|
-
if (projectRoot === '.') {
|
|
143
|
-
return `{projectRoot}/${path}`;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
return `{workspaceRoot}/${path}/{projectRoot}`;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
if ((0, path_1.isAbsolute)(outputPath)) {
|
|
151
|
-
return `{workspaceRoot}/${(0, path_1.relative)(workspaceRoot, outputPath)}`;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
if (outputPath.startsWith('..')) {
|
|
155
|
-
return (0, path_1.join)('{workspaceRoot}', (0, path_1.join)(projectRoot, outputPath));
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
return (0, path_1.join)('{projectRoot}', outputPath);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function normalizeOptions(options) {
|
|
164
|
-
var _a, _b, _c, _d, _e, _f;
|
|
165
|
-
options !== null && options !== void 0 ? options : (options = {});
|
|
166
|
-
(_a = options.buildTargetName) !== null && _a !== void 0 ? _a : (options.buildTargetName = 'build');
|
|
167
|
-
(_b = options.serveTargetName) !== null && _b !== void 0 ? _b : (options.serveTargetName = 'serve');
|
|
168
|
-
(_c = options.previewTargetName) !== null && _c !== void 0 ? _c : (options.previewTargetName = 'preview');
|
|
169
|
-
(_d = options.testTargetName) !== null && _d !== void 0 ? _d : (options.testTargetName = 'test');
|
|
170
|
-
(_e = options.serveStaticTargetName) !== null && _e !== void 0 ? _e : (options.serveStaticTargetName = 'serve-static');
|
|
171
|
-
(_f = options.typecheckTargetName) !== null && _f !== void 0 ? _f : (options.typecheckTargetName = 'typecheck');
|
|
172
|
-
return options;
|
|
173
|
-
}
|
|
174
63
|
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../onix/src/plugins/plugin.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../onix/src/plugins/plugin.ts"],"names":[],"mappings":";;;;AAAA,uCACoB;AACpB,+BAAqC;AACrC,2BAAiC;AACjC,0GAAmG;AACnG,kEAAsE;AACtE,+BAAyC;AACzC,2DAAuD;AAEvD,0FAA4E;AAC5E,kGAAmF;AAEnF,wFAA2E;AAC3E,sFAAwE;AACxE,0FAA4E;AAErE,MAAM,kBAAkB,GAAuB,GAAG,EAAE,CAAC,EAAE,CAAC;AAAlD,QAAA,kBAAkB,sBAAgC;AAElD,QAAA,aAAa,GAAsC;IAC9D,0CAAc;IACd,+BAA+C,EAAE,8EAA1C,eAAe,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO;QAC3C,MAAM,WAAW,GAAG,IAAA,wBAAU,EAAC,OAAO,CAAC,CAAC;QACxC,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,wCAAsB,EAAE,QAAQ,WAAW,OAAO,CAAC,CAAC;QAC3E,MAAM,YAAY,GAAG,IAAA,8CAAgB,EAAC,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC;YACH,OAAO,MAAM,IAAA,6BAAoB,EAC/B,CAAC,UAAU,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,CACpC,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EACjE,eAAe,EACf,OAAO,EACP,OAAO,CACR,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,IAAA,qDAAmB,EAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,CAAA;CACF,CAAC;AAEW,QAAA,WAAW,GAAoC;IAC1D,0CAAc;IACd,CAAO,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,0DAAC,OAAA,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAA,GAAA;CAC3G,CAAC;AAEF,SAAe,mBAAmB,CAChC,cAAsB,EACtB,OAA2B,EAC3B,OAA2B,EAC3B,YAA0C;;;QAE1C,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,YAAY,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;QAC3E,IACE,CAAC,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC;YACtC,CAAC,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,EACtC,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,iBAAiB,GAAG,IAAA,6CAAgB,EAAC,OAAO,CAAC,CAAC;QAEpD,MAAM,IAAI,GACR,CAAC,MAAM,IAAA,6DAA2B,EAChC,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,CAAC,IAAA,oBAAe,EAAC,IAAA,6BAAoB,EAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAC/D,CAAC,GAAG,cAAc,CAAC;QAEtB,MAAM,WAAW,GAAG,MAAM,IAAA,8CAAgB,EACxC,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,OAAO,CACR,CAAC;QAEF,MAAA,YAAY,CAAC,IAAI,qCAAjB,YAAY,CAAC,IAAI,IAAM,WAAW,EAAC;QAEnC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,OAAO,GAAyB;YACpC,IAAI,EAAE,WAAW;YACjB,OAAO;YACP,QAAQ;SACT,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE;gBACR,CAAC,WAAW,CAAC,EAAE,OAAO;aACvB;SACF,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
export type TOnixEnvironmentConfig = {
|
|
2
|
+
ecr: string;
|
|
3
|
+
envKey: string;
|
|
4
|
+
envPath: string;
|
|
5
|
+
port?: string;
|
|
6
|
+
prefix: string;
|
|
7
|
+
profile: string;
|
|
8
|
+
ormConfigPath?: string;
|
|
9
|
+
};
|
|
1
10
|
export type TOnixConfig = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"ecr": string;
|
|
5
|
-
"envKey": string;
|
|
6
|
-
"envPath": string;
|
|
7
|
-
"port": string;
|
|
8
|
-
"prefix": string;
|
|
9
|
-
"profile": string;
|
|
10
|
-
}>;
|
|
11
|
+
moniker: string;
|
|
12
|
+
environments: Record<string, TOnixEnvironmentConfig>;
|
|
11
13
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onix-plugin-options.type.js","sourceRoot":"","sources":["../../../../onix/src/types/onix-plugin-options.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onix-targets.type.js","sourceRoot":"","sources":["../../../../onix/src/types/onix-targets.type.ts"],"names":[],"mappings":""}
|