@onivoro/onix 3.3.16 → 20.0.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/executors.json +39 -4
- package/package.json +9 -5
- package/src/executors/build-cli/schema.d.ts +1 -1
- package/src/executors/deploy/executor.js +8 -2
- package/src/executors/deploy/executor.js.map +1 -1
- package/src/executors/deploy/schema.d.ts +5 -6
- package/src/executors/docker/schema.d.ts +1 -1
- package/src/executors/gen/schema.d.ts +1 -1
- package/src/executors/lee/executor.js +27 -0
- package/src/executors/lee/executor.js.map +1 -0
- package/src/executors/lee/schema.d.ts +1 -0
- package/src/executors/lee/schema.json +9 -0
- package/src/executors/local/schema.d.ts +1 -1
- package/src/executors/playwright/schema.d.ts +1 -1
- package/src/executors/typeorm/executor.d.ts +4 -0
- package/src/executors/typeorm/executor.js +26 -0
- package/src/executors/typeorm/executor.js.map +1 -0
- package/src/executors/{db → typeorm}/schema.d.ts +2 -3
- package/src/executors/{db → typeorm}/schema.json +2 -6
- package/src/executors/vscode/schema.d.ts +1 -1
- package/src/functions/add-docker-deploy-target.function.d.ts +3 -0
- package/src/functions/add-docker-deploy-target.function.js +22 -0
- package/src/functions/add-docker-deploy-target.function.js.map +1 -0
- package/src/functions/add-docker-deploy-targets.function.d.ts +3 -0
- package/src/functions/add-docker-deploy-targets.function.js +10 -0
- package/src/functions/add-docker-deploy-targets.function.js.map +1 -0
- package/src/functions/build-onix-targets.function.js +2 -0
- package/src/functions/build-onix-targets.function.js.map +1 -1
- package/src/functions/push-image-to-ecr-wrapped.function.d.ts +4 -0
- package/src/functions/push-image-to-ecr-wrapped.function.js +14 -0
- package/src/functions/push-image-to-ecr-wrapped.function.js.map +1 -0
- package/src/functions/push-image-to-ecr.function.d.ts +8 -0
- package/src/functions/push-image-to-ecr.function.js +44 -0
- package/src/functions/push-image-to-ecr.function.js.map +1 -0
- package/src/types/onix-config.type.d.ts +2 -0
- package/README.md +0 -11
- package/src/executors/db/executor.js +0 -20
- package/src/executors/db/executor.js.map +0 -1
- /package/src/executors/{db → lee}/executor.d.ts +0 -0
package/executors.json
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"executors": {
|
|
3
|
-
"
|
|
4
|
-
"implementation": "./src/executors/executor",
|
|
5
|
-
"schema": "./src/executors/schema.json",
|
|
6
|
-
"description": "
|
|
3
|
+
"build-cli": {
|
|
4
|
+
"implementation": "./src/executors/build-cli/executor",
|
|
5
|
+
"schema": "./src/executors/build-cli/schema.json",
|
|
6
|
+
"description": "build-cli"
|
|
7
|
+
},
|
|
8
|
+
"typeorm": {
|
|
9
|
+
"implementation": "./src/executors/typeorm/executor",
|
|
10
|
+
"schema": "./src/executors/typeorm/schema.json",
|
|
11
|
+
"description": "typeorm"
|
|
12
|
+
},
|
|
13
|
+
"docker-run": {
|
|
14
|
+
"implementation": "./src/executors/docker/executor",
|
|
15
|
+
"schema": "./src/executors/docker/schema.json",
|
|
16
|
+
"description": "docker-run"
|
|
17
|
+
},
|
|
18
|
+
"docker-deploy": {
|
|
19
|
+
"implementation": "./src/executors/deploy/executor",
|
|
20
|
+
"schema": "./src/executors/deploy/schema.json",
|
|
21
|
+
"description": "docker-deploy"
|
|
22
|
+
},
|
|
23
|
+
"gen-axios": {
|
|
24
|
+
"implementation": "./src/executors/gen/executor",
|
|
25
|
+
"schema": "./src/executors/gen/schema.json",
|
|
26
|
+
"description": "gen-axios"
|
|
27
|
+
},
|
|
28
|
+
"serve-locally": {
|
|
29
|
+
"implementation": "./src/executors/local/executor",
|
|
30
|
+
"schema": "./src/executors/local/schema.json",
|
|
31
|
+
"description": "serve-locally"
|
|
32
|
+
},
|
|
33
|
+
"lee": {
|
|
34
|
+
"implementation": "./src/executors/lee/executor",
|
|
35
|
+
"schema": "./src/executors/lee/schema.json",
|
|
36
|
+
"description": "lee"
|
|
37
|
+
},
|
|
38
|
+
"playwright": {
|
|
39
|
+
"implementation": "./src/executors/playwright/executor",
|
|
40
|
+
"schema": "./src/executors/playwright/schema.json",
|
|
41
|
+
"description": "playwright"
|
|
7
42
|
}
|
|
8
43
|
}
|
|
9
44
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onivoro/onix",
|
|
3
|
-
"version": "
|
|
4
|
-
"dependencies": {
|
|
5
|
-
"@nx/devkit": "20.0.6",
|
|
6
|
-
"tslib": "^2.3.0"
|
|
7
|
-
},
|
|
3
|
+
"version": "20.0.1",
|
|
8
4
|
"type": "commonjs",
|
|
9
5
|
"main": "./src/index.js",
|
|
10
6
|
"typings": "./src/index.d.ts",
|
|
11
7
|
"executors": "./executors.json",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@aws-sdk/client-ecr": "^3.734.0",
|
|
10
|
+
"@aws-sdk/credential-providers": "^3.734.0",
|
|
11
|
+
"@nx/devkit": "^20.3.2",
|
|
12
|
+
"@nx/js": "20.3.2",
|
|
13
|
+
"esbuild": "^0.24.2",
|
|
14
|
+
"esbuild-node-externals": "^1.16.0"
|
|
15
|
+
},
|
|
12
16
|
"types": "./src/index.d.ts"
|
|
13
17
|
}
|
|
@@ -4,12 +4,18 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const executor = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
-
const { envPath, ecr, prefix, profile } = options;
|
|
8
|
-
// TODO: THROW IF AWS PROFILE HAS SPECIFIED PROFILE
|
|
7
|
+
const { envPath, ecr, prefix, profile, dockerfilePath } = options;
|
|
9
8
|
try {
|
|
10
9
|
const webProjectName = context.projectName.replace('api', 'web');
|
|
11
10
|
const apiProjectPath = context.projectName.split('-').join('/').replace('app', 'apps').replace('appss', 'apps');
|
|
12
11
|
const webProjectPath = apiProjectPath.replace('api', 'web').replace('app', 'apps').replace('appss', 'apps');
|
|
12
|
+
// build api
|
|
13
|
+
child_process_1.execSync;
|
|
14
|
+
// build ui if there's a ui project in onix.config
|
|
15
|
+
// copy ui dist to api dist/assets if there's ui project in onix.config
|
|
16
|
+
// login to docker
|
|
17
|
+
// push image
|
|
18
|
+
// restart cluster service
|
|
13
19
|
const command = `export OSO_ENV=${envPath} && oso DeployImageAndUi -a ${context.projectName} -t production -p ${profile} -r us-east-2 -e ${ecr} -o ${apiProjectPath} -u ${webProjectName} -d dist/${webProjectPath} -f docker/prod/api/Dockerfile -g asdf && aws ecs update-service --cluster ${prefix}-cluster --service ${prefix}-service --force-new-deployment --profile ${profile} --region us-east-2`;
|
|
14
20
|
devkit_1.logger.info(command);
|
|
15
21
|
(0, child_process_1.execSync)(command, { stdio: 'inherit' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/deploy/executor.ts"],"names":[],"mappings":";;;AAAA,uCAAsE;AAEtE,iDAAyC;AAEzC,MAAM,QAAQ,GAAoC,CAChD,OAAuB,EACvB,OAAwB,EACxB,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/deploy/executor.ts"],"names":[],"mappings":";;;AAAA,uCAAsE;AAEtE,iDAAyC;AAEzC,MAAM,QAAQ,GAAoC,CAChD,OAAuB,EACvB,OAAwB,EACxB,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAElE,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,OAAO,CAAC,WAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAClE,MAAM,cAAc,GAAG,OAAO,CAAC,WAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACjH,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAE5G,YAAY;QACZ,wBAAQ,CAAA;QACR,kDAAkD;QAClD,uEAAuE;QACvE,kBAAkB;QAClB,aAAa;QACb,0BAA0B;QAC1B,MAAM,OAAO,GAAG,kBAAkB,OAAO,+BAA+B,OAAO,CAAC,WAAW,qBAAqB,OAAO,oBAAoB,GAAG,OAAO,cAAc,OAAO,cAAc,YAAY,cAAc,8EAA8E,MAAM,sBAAsB,MAAM,6CAA6C,OAAO,qBAAqB,CAAC;QAE5Y,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAErB,IAAA,wBAAQ,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAExC,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} // eslint-disable-line
|
|
1
|
+
import { TOnixEnvironmentConfig } from "onix/src/types/onix-config.type";
|
|
2
|
+
|
|
3
|
+
export interface ExecutorSchema extends TOnixEnvironmentConfig {
|
|
4
|
+
|
|
5
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 promises_1 = require("fs/promises");
|
|
6
|
+
const executor = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
try {
|
|
8
|
+
const wl = (0, devkit_1.workspaceLayout)();
|
|
9
|
+
const to = (0, devkit_1.readTargetOptions)({ project: context.projectName, target: context.targetName }, context);
|
|
10
|
+
yield (0, promises_1.writeFile)(`lee-${Date.now()}`, JSON.stringify({
|
|
11
|
+
options,
|
|
12
|
+
context,
|
|
13
|
+
workspaceLayout: wl,
|
|
14
|
+
targetOptions: to,
|
|
15
|
+
}, null, 2));
|
|
16
|
+
return {
|
|
17
|
+
success: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
exports.default = executor;
|
|
27
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/lee/executor.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AAEpB,0CAAwC;AAExC,MAAM,QAAQ,GAAoC,CAChD,OAAuB,EACvB,OAAwB,EACxB,EAAE;IACF,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,IAAA,wBAAe,GAAE,CAAC;QAC7B,MAAM,EAAE,GAAG,IAAA,0BAAiB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;QAEpG,MAAM,IAAA,oBAAS,EAAC,OAAO,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC;YAClD,OAAO;YACP,OAAO;YACP,eAAe,EAAE,EAAE;YACnB,aAAa,EAAE,EAAE;SAClB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEb,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export interface ExecutorSchema {}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export interface ExecutorSchema {
|
|
2
|
-
}
|
|
2
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 process_1 = require("process");
|
|
7
|
+
const executor = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const { envPath, ormConfigPath, runOrRevert } = options;
|
|
9
|
+
try {
|
|
10
|
+
if (envPath) {
|
|
11
|
+
devkit_1.logger.info(`using "${envPath}"`);
|
|
12
|
+
(0, process_1.loadEnvFile)(envPath);
|
|
13
|
+
}
|
|
14
|
+
(0, child_process_1.execSync)(`npm run typeorm -- -d ${ormConfigPath} migration:${runOrRevert} -t=false`, { stdio: 'inherit' });
|
|
15
|
+
return {
|
|
16
|
+
success: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
success: false,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
exports.default = executor;
|
|
26
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/typeorm/executor.ts"],"names":[],"mappings":";;;AAAA,uCAAsE;AAEtE,iDAAyC;AACzC,qCAAsC;AAEtC,MAAM,QAAQ,GAAoC,CAChD,OAAuB,EACvB,OAAwB,EACxB,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAGxD,IAAI,CAAC;QACH,IAAG,OAAO,EAAE,CAAC;YACX,eAAM,CAAC,IAAI,CAAC,UAAU,OAAO,GAAG,CAAC,CAAC;YAClC,IAAA,qBAAW,EAAC,OAAO,CAAC,CAAC;QACvB,CAAC;QAED,IAAA,wBAAQ,EAAC,yBAAyB,aAAa,cAAc,WAAW,WAAW,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAE3G,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"version": 2,
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "TypeORM executor",
|
|
5
5
|
"description": "",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
@@ -13,16 +13,12 @@
|
|
|
13
13
|
"type": "string",
|
|
14
14
|
"description": "Path and name of the .env file to load"
|
|
15
15
|
},
|
|
16
|
-
"envKey": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"description": "Name of the environment variable that points to the location of the envFile"
|
|
19
|
-
},
|
|
20
16
|
"ormConfigPath": {
|
|
21
17
|
"type": "string",
|
|
22
18
|
"description": "Path and name of the ormconfig"
|
|
23
19
|
}
|
|
24
20
|
},
|
|
25
21
|
"required": [
|
|
26
|
-
"envPath", "
|
|
22
|
+
"envPath", "ormConfigPath"
|
|
27
23
|
]
|
|
28
24
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export interface ExecutorSchema {
|
|
2
|
-
}
|
|
2
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TargetConfiguration } from "@nx/devkit";
|
|
2
|
+
import { TOnixEnvironmentConfig } from "../types/onix-config.type";
|
|
3
|
+
export declare function addDockerDeployTarget(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.addDockerDeployTarget = addDockerDeployTarget;
|
|
4
|
+
function addDockerDeployTarget(environment, config, targets, projectJson, namedInputs) {
|
|
5
|
+
const targetName = `onix-deploy-docker-${environment}`;
|
|
6
|
+
const { envPath, envKey, ecr, port, dockerfilePath } = config;
|
|
7
|
+
const command = `docker build -t ${ecr} -f ${dockerfilePath} . && docker push ${ecr}`;
|
|
8
|
+
if (ecr && dockerfilePath) {
|
|
9
|
+
targets[targetName] = {
|
|
10
|
+
command: `echo 'noop'`,
|
|
11
|
+
options: { cwd: process.cwd() },
|
|
12
|
+
cache: true,
|
|
13
|
+
inputs: [],
|
|
14
|
+
outputs: [],
|
|
15
|
+
metadata: {
|
|
16
|
+
technologies: ['Docker'],
|
|
17
|
+
description: `Builds the docker image locally and deploys it to the registry`,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=add-docker-deploy-target.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-docker-deploy-target.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-docker-deploy-target.function.ts"],"names":[],"mappings":";;AAGA,sDAmBC;AAnBD,SAAgB,qBAAqB,CAAC,WAAmB,EAAE,MAA8B,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IACvK,MAAM,UAAU,GAAG,sBAAsB,WAAW,EAAE,CAAC;IACvD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAE9D,MAAM,OAAO,GAAG,mBAAmB,GAAG,OAAO,cAAc,qBAAqB,GAAG,EAAE,CAAC;IAEtF,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;QACxB,OAAO,CAAC,UAAU,CAAC,GAAG;YAClB,OAAO,EAAE,aAAa;YACtB,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,gEAAgE;aAChF;SACJ,CAAC;IACN,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TargetConfiguration } from "@nx/devkit";
|
|
2
|
+
import { TOnixConfig } from "../types/onix-config.type";
|
|
3
|
+
export declare function addDockerDeployTargets(onixConfig: TOnixConfig, targets: Record<string, TargetConfiguration<any>>, projectJson: any, namedInputs: any): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDockerDeployTargets = addDockerDeployTargets;
|
|
4
|
+
const add_docker_deploy_target_function_1 = require("./add-docker-deploy-target.function");
|
|
5
|
+
function addDockerDeployTargets(onixConfig, targets, projectJson, namedInputs) {
|
|
6
|
+
Object.entries(onixConfig.environments || {}).forEach(([environment, config]) => {
|
|
7
|
+
(0, add_docker_deploy_target_function_1.addDockerDeployTarget)(environment, config, targets, projectJson, namedInputs);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=add-docker-deploy-targets.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-docker-deploy-targets.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/add-docker-deploy-targets.function.ts"],"names":[],"mappings":";;AAIA,wDAIG;AANH,2FAA4E;AAE5E,SAAgB,sBAAsB,CAAC,UAAuB,EAAE,OAAiD,EAAE,WAAgB,EAAE,WAAW;IAC5I,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE;QAC9E,IAAA,yDAAqB,EAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -10,6 +10,7 @@ const add_serve_targets_function_1 = require("./add-serve-targets.function");
|
|
|
10
10
|
const add_docker_targets_function_1 = require("./add-docker-targets.function");
|
|
11
11
|
const add_db_targets_function_1 = require("./add-db-targets.function");
|
|
12
12
|
const add_gen_target_function_1 = require("./add-gen-target.function");
|
|
13
|
+
const add_docker_deploy_targets_function_1 = require("./add-docker-deploy-targets.function");
|
|
13
14
|
function buildOnixTargets(configFilePath, projectRoot, options, context) {
|
|
14
15
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
const absoluteConfigFilePath = (0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath);
|
|
@@ -22,6 +23,7 @@ function buildOnixTargets(configFilePath, projectRoot, options, context) {
|
|
|
22
23
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
23
24
|
(0, add_serve_targets_function_1.addServeTargets)(onixConfig, targets, projectJson, namedInputs);
|
|
24
25
|
(0, add_docker_targets_function_1.addDockerTargets)(onixConfig, targets, projectJson, namedInputs);
|
|
26
|
+
(0, add_docker_deploy_targets_function_1.addDockerDeployTargets)(onixConfig, targets, projectJson, namedInputs);
|
|
25
27
|
(0, add_db_targets_function_1.addDbTargets)(onixConfig, targets, projectJson, namedInputs);
|
|
26
28
|
(0, add_gen_target_function_1.addGenTarget)(onixConfig, targets, projectJson, namedInputs);
|
|
27
29
|
const metadata = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-onix-targets.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/build-onix-targets.function.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"build-onix-targets.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/build-onix-targets.function.ts"],"names":[],"mappings":";;AAaA,4CAgCC;;AA7CD,uCAA2G;AAG3G,2BAAkC;AAElC,4EAAuE;AACvE,+BAA4B;AAC5B,6EAA+D;AAC/D,+EAAiE;AACjE,uEAAyD;AACzD,uEAAyD;AACzD,6FAA8E;AAE9E,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,2DAAsB,EAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACtE,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pushImageToECRWrapped = pushImageToECRWrapped;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const push_image_to_ecr_function_1 = require("./push-image-to-ecr.function");
|
|
6
|
+
function pushImageToECRWrapped(_) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const { ecr, profile } = _;
|
|
9
|
+
const [registryId, region, repoColonTag] = ecr.replace('amazonaws.com', '').replace('dkr.ecr.', '').replace('/', '').split('.');
|
|
10
|
+
const [repositoryName, imageTag] = repoColonTag.split(':');
|
|
11
|
+
return yield (0, push_image_to_ecr_function_1.pushImageToECR)({ registryId, region, repositoryName, imageTag, profile });
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=push-image-to-ecr-wrapped.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-image-to-ecr-wrapped.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/push-image-to-ecr-wrapped.function.ts"],"names":[],"mappings":";;AAEA,sDAMC;;AARD,6EAA8D;AAE9D,SAAsB,qBAAqB,CAAC,CAAmC;;QAC7E,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAC3B,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChI,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE3D,OAAO,MAAM,IAAA,2CAAc,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface PushImageConfig {
|
|
2
|
+
region: string;
|
|
3
|
+
repositoryName: string;
|
|
4
|
+
imageTag: string;
|
|
5
|
+
registryId: string;
|
|
6
|
+
profile: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function pushImageToECR({ region, repositoryName, imageTag, registryId, profile }: PushImageConfig): Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pushImageToECR = pushImageToECR;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const client_ecr_1 = require("@aws-sdk/client-ecr");
|
|
6
|
+
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
function pushImageToECR(_a) {
|
|
9
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ region, repositoryName, imageTag, registryId, profile }) {
|
|
10
|
+
var _b, _c;
|
|
11
|
+
try {
|
|
12
|
+
const config = { region, credentials: (0, credential_providers_1.fromIni)({ profile }) };
|
|
13
|
+
const ecrClient = new client_ecr_1.ECRClient(config);
|
|
14
|
+
const authCommand = new client_ecr_1.GetAuthorizationTokenCommand({
|
|
15
|
+
registryIds: registryId ? [registryId] : undefined
|
|
16
|
+
});
|
|
17
|
+
const authResponse = yield ecrClient.send(authCommand);
|
|
18
|
+
if (!((_c = (_b = authResponse.authorizationData) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.authorizationToken)) {
|
|
19
|
+
throw new Error('Failed to get authorization token');
|
|
20
|
+
}
|
|
21
|
+
const authToken = Buffer.from(authResponse.authorizationData[0].authorizationToken, 'base64').toString('utf-8');
|
|
22
|
+
const [username, password] = authToken.split(':');
|
|
23
|
+
const registryEndpoint = authResponse.authorizationData[0].proxyEndpoint;
|
|
24
|
+
if (!registryEndpoint) {
|
|
25
|
+
throw new Error('Failed to get registry endpoint');
|
|
26
|
+
}
|
|
27
|
+
(0, child_process_1.execSync)('docker login ' +
|
|
28
|
+
`-u ${username} ` +
|
|
29
|
+
`-p ${password} ` +
|
|
30
|
+
registryEndpoint, { stdio: 'inherit' });
|
|
31
|
+
// Tag image
|
|
32
|
+
const remoteImage = `${registryEndpoint.replace('https://', '')}/${repositoryName}:${imageTag}`;
|
|
33
|
+
(0, child_process_1.execSync)(`docker tag ${repositoryName}:${imageTag} ${remoteImage}`, { stdio: 'inherit' });
|
|
34
|
+
// Push image
|
|
35
|
+
(0, child_process_1.execSync)(`docker push ${remoteImage}`, { stdio: 'inherit' });
|
|
36
|
+
console.log('Successfully pushed image to ECR');
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Error pushing image to ECR:', error);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=push-image-to-ecr.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-image-to-ecr.function.js","sourceRoot":"","sources":["../../../../onix/src/functions/push-image-to-ecr.function.ts"],"names":[],"mappings":";;AAYA,wCAsDC;;AAlED,oDAA+F;AAC/F,wEAAwD;AACxD,iDAAyC;AAUzC,SAAsB,cAAc;iEAAC,EACnC,MAAM,EACN,cAAc,EACd,QAAQ,EACR,UAAU,EACV,OAAO,EACS;;QAChB,IAAI,CAAC;YACH,MAAM,MAAM,GAAoB,EAAE,MAAM,EAAE,WAAW,EAAE,IAAA,8BAAO,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAC9E,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,MAAM,CAAC,CAAC;YAExC,MAAM,WAAW,GAAG,IAAI,yCAA4B,CAAC;gBACnD,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;aACnD,CAAC,CAAC;YACH,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEvD,IAAI,CAAC,CAAA,MAAA,MAAA,YAAY,CAAC,iBAAiB,0CAAG,CAAC,CAAC,0CAAE,kBAAkB,CAAA,EAAE,CAAC;gBAC7D,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACvD,CAAC;YAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAC3B,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,kBAAkB,EACpD,QAAQ,CACT,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACpB,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAElD,MAAM,gBAAgB,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;YACzE,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACrD,CAAC;YAED,IAAA,wBAAQ,EAAC,eAAe;gBACtB,MAAM,QAAQ,GAAG;gBACjB,MAAM,QAAQ,GAAG;gBACjB,gBAAgB,EAChB,EAAE,KAAK,EAAE,SAAS,EAAE,CACrB,CAAC;YAEF,YAAY;YACZ,MAAM,WAAW,GAAG,GAAG,gBAAgB,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,cAAc,IAAI,QAAQ,EAAE,CAAC;YAChG,IAAA,wBAAQ,EAAC,cAAc,cAAc,IAAI,QAAQ,IAAI,WAAW,EAAE,EAChE,EAAE,KAAK,EAAE,SAAS,EAAE,CACrB,CAAC;YAEF,aAAa;YACb,IAAA,wBAAQ,EAAC,eAAe,WAAW,EAAE,EACnC,EAAE,KAAK,EAAE,SAAS,EAAE,CACrB,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YACpD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAAA"}
|
package/README.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const executor = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
6
|
-
const { envKey, envPath, ormConfigPath, runOrRevert } = options;
|
|
7
|
-
try {
|
|
8
|
-
(0, child_process_1.execSync)(`export ${envKey}=${envPath} && npm run typeorm -- -d ${ormConfigPath} migration:${runOrRevert} -t=false`, { stdio: 'inherit' });
|
|
9
|
-
return {
|
|
10
|
-
success: true,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
return {
|
|
15
|
-
success: false,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.default = executor;
|
|
20
|
-
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../onix/src/executors/db/executor.ts"],"names":[],"mappings":";;;AAEA,iDAAyC;AAEzC,MAAM,QAAQ,GAAoC,CAChD,OAAuB,EACvB,OAAwB,EACxB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAGhE,IAAI,CAAC;QACH,IAAA,wBAAQ,EAAC,UAAU,MAAM,IAAI,OAAO,6BAA6B,aAAa,cAAc,WAAW,WAAW,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAE1I,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
File without changes
|