@payfit/nx-core 4.9.1-ephemeral.5 → 4.9.1-ephemeral.7

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.
Files changed (58) hide show
  1. package/dist/README.md +19 -0
  2. package/dist/package.json +23 -0
  3. package/dist/src/executors/publisher/docker.d.ts +5 -0
  4. package/dist/src/executors/publisher/docker.js +18 -0
  5. package/dist/src/executors/publisher/docker.js.map +1 -0
  6. package/dist/src/executors/publisher/executor.d.ts +4 -0
  7. package/dist/src/executors/publisher/executor.js +21 -0
  8. package/dist/src/executors/publisher/executor.js.map +1 -0
  9. package/dist/src/executors/publisher/helm.d.ts +7 -0
  10. package/dist/src/executors/publisher/helm.js +37 -0
  11. package/dist/src/executors/publisher/helm.js.map +1 -0
  12. package/dist/src/index.d.ts +4 -0
  13. package/dist/src/index.js +50 -0
  14. package/dist/src/index.js.map +1 -0
  15. package/dist/src/scripts/version-action.d.ts +25 -0
  16. package/dist/src/scripts/version-action.js +56 -0
  17. package/dist/src/scripts/version-action.js.map +1 -0
  18. package/dist/src/utils/aws-auth.d.ts +39 -0
  19. package/dist/src/utils/aws-auth.js +76 -0
  20. package/dist/src/utils/aws-auth.js.map +1 -0
  21. package/dist/src/utils/docker.d.ts +19 -0
  22. package/{src/utils/docker.ts → dist/src/utils/docker.js} +14 -20
  23. package/dist/src/utils/docker.js.map +1 -0
  24. package/dist/src/utils/exec.d.ts +7 -0
  25. package/dist/src/utils/exec.js +21 -0
  26. package/dist/src/utils/exec.js.map +1 -0
  27. package/dist/src/utils/get-version.d.ts +6 -0
  28. package/dist/src/utils/get-version.js +11 -0
  29. package/dist/src/utils/get-version.js.map +1 -0
  30. package/dist/src/utils/github.d.ts +4 -0
  31. package/dist/src/utils/github.js +14 -0
  32. package/dist/src/utils/github.js.map +1 -0
  33. package/dist/src/utils/helm.d.ts +48 -0
  34. package/dist/src/utils/helm.js +83 -0
  35. package/dist/src/utils/helm.js.map +1 -0
  36. package/dist/src/utils/import-esm.d.ts +2 -0
  37. package/dist/src/utils/import-esm.js +8 -0
  38. package/dist/src/utils/import-esm.js.map +1 -0
  39. package/dist/src/utils/tsh.d.ts +10 -0
  40. package/dist/src/utils/tsh.js +99 -0
  41. package/dist/src/utils/tsh.js.map +1 -0
  42. package/package.json +3 -5
  43. package/src/executors/publisher/docker.ts +0 -34
  44. package/src/executors/publisher/executor.ts +0 -30
  45. package/src/executors/publisher/helm.ts +0 -55
  46. package/src/index.ts +0 -77
  47. package/src/scripts/version-action.ts +0 -89
  48. package/src/utils/aws-auth.ts +0 -100
  49. package/src/utils/exec.spec.ts +0 -16
  50. package/src/utils/exec.ts +0 -31
  51. package/src/utils/get-version.ts +0 -11
  52. package/src/utils/github.ts +0 -14
  53. package/src/utils/helm.ts +0 -125
  54. package/src/utils/import-esm.ts +0 -10
  55. package/src/utils/tsh.ts +0 -127
  56. /package/{executors.json → dist/executors.json} +0 -0
  57. /package/{src → dist/src}/executors/publisher/schema.d.ts +0 -0
  58. /package/{src → dist/src}/executors/publisher/schema.json +0 -0
package/dist/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # nx-core package
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Usage
6
+
7
+ Install the package as dev dependency of your project:
8
+
9
+ ```shell
10
+ yarn add -D @payfit/nx-core
11
+ ```
12
+
13
+ ## Building
14
+
15
+ Run `nx build nx-core` to build the library.
16
+
17
+ ## Running unit tests
18
+
19
+ Run `nx test nx-core` to execute the unit tests via [Vitest](https://vitest.dev/).
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@payfit/nx-core",
3
+ "version": "0.0.0-use.local",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@nx/devkit": "21.0.1",
9
+ "get-port": "^7.1.0",
10
+ "ky": "^1.8.1",
11
+ "nx": "21.0.1",
12
+ "semver": "7.7.1",
13
+ "tinyexec": "0.3.2",
14
+ "tslib": "^2.8.1",
15
+ "yaml": "^2.7.0",
16
+ "zod": "^3.24.3"
17
+ },
18
+ "executors": "./executors.json",
19
+ "files": [
20
+ "dist",
21
+ "!**/*.tsbuildinfo"
22
+ ]
23
+ }
@@ -0,0 +1,5 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { PublisherExecutorOptions } from './schema';
3
+ export declare function publishDocker(options: PublisherExecutorOptions, context: ExecutorContext, version: string): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -0,0 +1,18 @@
1
+ import * as fs from 'node:fs';
2
+ import { join } from 'path';
3
+ import { checkAwsAuth, loginToEcr, pushImageToEcr } from '../../utils/aws-auth';
4
+ import { buildDockerImage } from '../../utils/docker';
5
+ export async function publishDocker(options, context, version) {
6
+ await checkAwsAuth();
7
+ await loginToEcr();
8
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
9
+ const projectDockerfile = join(projectRoot, 'Dockerfile');
10
+ if (!fs.existsSync(projectDockerfile)) {
11
+ throw new Error('Dockerfile not found in project root');
12
+ }
13
+ console.log('Building docker image with version ' + version);
14
+ await buildDockerImage(options.ecrRegistry, projectDockerfile, version);
15
+ console.log(`Publishing docker image to ${options.ecrRegistry} with version ${version}`);
16
+ return await pushImageToEcr(options.ecrRegistry, version);
17
+ }
18
+ //# sourceMappingURL=docker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../../src/executors/publisher/docker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAI3B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAiC,EACjC,OAAwB,EACxB,OAAe;IAIf,MAAM,YAAY,EAAE,CAAA;IACpB,MAAM,UAAU,EAAE,CAAA;IAElB,MAAM,WAAW,GACf,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAA;IACnE,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;IAEzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,qCAAqC,GAAG,OAAO,CAAC,CAAA;IAC5D,MAAM,gBAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAA;IAEvE,OAAO,CAAC,GAAG,CACT,8BAA8B,OAAO,CAAC,WAAW,iBAAiB,OAAO,EAAE,CAC5E,CAAA;IACD,OAAO,MAAM,cAAc,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AAC3D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { PublisherExecutorOptions, PublisherExecutorSchema } from './schema';
3
+ declare const runExecutor: (options: PublisherExecutorOptions, context: ExecutorContext) => Promise<PublisherExecutorSchema>;
4
+ export default runExecutor;
@@ -0,0 +1,21 @@
1
+ import { getVersion } from '../../utils/get-version';
2
+ import { publishDocker } from './docker';
3
+ import { publishHelm } from './helm';
4
+ const runExecutor = async (options, context) => {
5
+ try {
6
+ const version = getVersion(context.projectName);
7
+ await publishDocker(options, context, version);
8
+ await publishHelm(options, context, version);
9
+ }
10
+ catch (error) {
11
+ console.error(error);
12
+ return {
13
+ success: false,
14
+ };
15
+ }
16
+ return {
17
+ success: true,
18
+ };
19
+ };
20
+ export default runExecutor;
21
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/executors/publisher/executor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAGpC,MAAM,WAAW,GAGuB,KAAK,EAC3C,OAAiC,EACjC,OAAwB,EACxB,EAAE;IACF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAC/C,MAAM,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QAC9C,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAA;IACH,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { PublisherExecutorOptions } from './schema';
3
+ export declare function publishHelm(options: PublisherExecutorOptions, context: ExecutorContext, version: string): Promise<{
4
+ success: boolean;
5
+ stdout: any;
6
+ stderr: any;
7
+ }>;
@@ -0,0 +1,37 @@
1
+ import { __addDisposableResource, __disposeResources } from "tslib";
2
+ import * as fs from 'node:fs';
3
+ import { checkAwsAuth } from '../../utils/aws-auth';
4
+ import { getSanitizedCurrentGitBranch } from '../../utils/github';
5
+ import { installHelmRepo, packageHelm, pushPackagedHelm, resetTeleportProxyHelmChartFile, setupTeleportProxyHelmChartFile, } from '../../utils/helm';
6
+ import { getLocalPortForChartMuseum } from '../../utils/tsh';
7
+ export async function publishHelm(options, context, version) {
8
+ const env_1 = { stack: [], error: void 0, hasError: false };
9
+ try {
10
+ const projectHelmFolder = `apps/${context.projectName}/.deploy`;
11
+ const destinationHelmFolder = `dist/apps/${context.projectName}/chart/`;
12
+ const gitBranchName = await getSanitizedCurrentGitBranch();
13
+ if (!gitBranchName)
14
+ throw new Error('Unable to get current Git branch');
15
+ await checkAwsAuth();
16
+ if (!fs.existsSync(projectHelmFolder)) {
17
+ throw new Error(`.deploy folder not found for project ${context.projectName}`);
18
+ }
19
+ console.log(`Publishing Helm chart to ${options.chartRegistry}/${gitBranchName} with version ${version}`);
20
+ // connect to the chartmuseum through teleport
21
+ const proxyData = __addDisposableResource(env_1, await getLocalPortForChartMuseum(), false);
22
+ await proxyData.isReady();
23
+ await setupTeleportProxyHelmChartFile(projectHelmFolder, proxyData.port);
24
+ await installHelmRepo(projectHelmFolder);
25
+ await packageHelm(projectHelmFolder, version, destinationHelmFolder);
26
+ await resetTeleportProxyHelmChartFile(projectHelmFolder, proxyData.port);
27
+ return pushPackagedHelm(`${destinationHelmFolder}${context.projectName}-${version}.tgz`, options.chartRegistry, gitBranchName);
28
+ }
29
+ catch (e_1) {
30
+ env_1.error = e_1;
31
+ env_1.hasError = true;
32
+ }
33
+ finally {
34
+ __disposeResources(env_1);
35
+ }
36
+ }
37
+ //# sourceMappingURL=helm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helm.js","sourceRoot":"","sources":["../../../../src/executors/publisher/helm.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAI7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EACL,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAG5D,MAAM,CAAC,KAAK,UAAU,W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 -0,0 +1,50 @@
1
+ import { existsSync } from 'fs';
2
+ import { dirname, join } from 'path';
3
+ import { createNodesFromFiles, readJsonFile, } from '@nx/devkit';
4
+ export const createNodesV2 = [
5
+ '**/project.json',
6
+ async (configFiles, options, context) => {
7
+ return await createNodesFromFiles((configFile, options, context) => createNodesInternal(configFile, options, context), configFiles, options, context);
8
+ },
9
+ ];
10
+ async function createNodesInternal(configFilePath, options, context) {
11
+ const projectConfiguration = readJsonFile(configFilePath);
12
+ const projectRoot = dirname(configFilePath);
13
+ const isDockerProject = existsSync(join(projectRoot, 'Dockerfile'));
14
+ const isHelmProject = existsSync(join(projectRoot, '.deploy/Chart.yaml'));
15
+ const targets = {};
16
+ const ecrRegistry = isDockerProject
17
+ ? projectConfiguration.metadata &&
18
+ projectConfiguration.metadata['ecrRepository']
19
+ : undefined;
20
+ const chartRegistry = isHelmProject
21
+ ? projectConfiguration.metadata &&
22
+ projectConfiguration.metadata['chartRegistry']
23
+ : undefined;
24
+ if (isHelmProject || isDockerProject) {
25
+ const publisherConfig = readJsonFile(join(__dirname, '/executors/publisher/schema.json'));
26
+ targets['nx-release-publish'] = {
27
+ executor: '@payfit/nx-core:publisher',
28
+ options: {
29
+ ecrRegistry,
30
+ chartRegistry,
31
+ },
32
+ cache: true,
33
+ inputs: ['production', '^production'],
34
+ outputs: [`{workspaceRoot}/dist/apps/${projectConfiguration.name}/chart`],
35
+ metadata: {
36
+ technologies: ['helm', 'docker'],
37
+ description: publisherConfig.description,
38
+ },
39
+ };
40
+ }
41
+ return {
42
+ projects: {
43
+ [projectRoot]: {
44
+ ...projectConfiguration,
45
+ targets,
46
+ },
47
+ },
48
+ };
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE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oB,CAAC,GAAG;YAC9B,QAAQ,EAAE,2BAA2B;YACrC,OAAO,EAAE;gBACP,WAAW;gBACX,aAAa;aACd;YACD,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;YACrC,OAAO,EAAE,CAAC,6BAA6B,oBAAoB,CAAC,IAAI,QAAQ,CAAC;YACzE,QAAQ,EAAE;gBACR,YAAY,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;gBAChC,WAAW,EAAE,eAAe,CAAC,WAAW;aACzC;SACF,CAAA;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE;YACR,CAAC,WAAW,CAAC,EAAE;gBACb,GAAG,oBAAoB;gBACvB,OAAO;aACR;SACF;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { ProjectGraph, Tree } from '@nx/devkit';
2
+ import { VersionActions } from 'nx/release';
3
+ import { NxReleaseVersionConfiguration } from 'nx/src/config/nx-json';
4
+ export default class customVersionAction extends VersionActions {
5
+ validManifestFilenames: string[];
6
+ readCurrentVersionFromSourceManifest(tree: Tree): Promise<{
7
+ currentVersion: string;
8
+ manifestPath: string;
9
+ } | null>;
10
+ readCurrentVersionFromRegistry(tree: Tree, currentVersionResolverMetadata: NxReleaseVersionConfiguration['currentVersionResolverMetadata']): Promise<{
11
+ currentVersion: string | null;
12
+ logText: string;
13
+ } | null>;
14
+ readCurrentVersionOfDependency(tree: Tree, projectGraph: ProjectGraph, dependencyProjectName: string): Promise<{
15
+ currentVersion: string | null;
16
+ dependencyCollection: string | null;
17
+ }>;
18
+ isLocalDependencyProtocol(versionSpecifier: string): Promise<boolean>;
19
+ updateProjectVersion(tree: Tree, newVersion: string): Promise<string[]>;
20
+ updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>): Promise<string[]>;
21
+ calculateNewVersion(currentVersion: string | null, newVersionInput: string, newVersionInputReason: string, newVersionInputReasonData: Record<string, unknown>, preid: string): Promise<{
22
+ newVersion: string;
23
+ logText: string;
24
+ }>;
25
+ }
@@ -0,0 +1,56 @@
1
+ import { VersionActions } from 'nx/release';
2
+ import { inc } from 'semver';
3
+ export default class customVersionAction extends VersionActions {
4
+ validManifestFilenames;
5
+ async readCurrentVersionFromSourceManifest(tree) {
6
+ return {
7
+ currentVersion: '0.0.0',
8
+ manifestPath: 'apps/my-nest-app/project.json',
9
+ };
10
+ }
11
+ async readCurrentVersionFromRegistry(tree, currentVersionResolverMetadata) {
12
+ return {
13
+ currentVersion: '0.0.0',
14
+ logText: 'Current version from registry',
15
+ };
16
+ }
17
+ async readCurrentVersionOfDependency(tree, projectGraph, dependencyProjectName) {
18
+ return {
19
+ currentVersion: '0.0.0',
20
+ dependencyCollection: '0.0.0',
21
+ };
22
+ }
23
+ async isLocalDependencyProtocol(versionSpecifier) {
24
+ return false;
25
+ }
26
+ async updateProjectVersion(tree, newVersion) {
27
+ // Update the version in the VERSION file
28
+ const currentProject = this.projectGraphNode.name;
29
+ const versionFilePath = `dist/apps/${currentProject}/VERSION`;
30
+ tree.write(versionFilePath, newVersion);
31
+ return [];
32
+ }
33
+ async updateProjectDependencies(tree, projectGraph, dependenciesToUpdate) {
34
+ return [];
35
+ }
36
+ async calculateNewVersion(currentVersion, newVersionInput, newVersionInputReason, newVersionInputReasonData, preid) {
37
+ function formatDate() {
38
+ const date = new Date();
39
+ const year = date.getFullYear();
40
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // getMonth() returns 0-11
41
+ const day = date.getDate();
42
+ return `${year}${month}.${day}.`;
43
+ }
44
+ function getNewVersionFromCurrentVersion(currentVersion) {
45
+ const expectedPattern = formatDate();
46
+ return !currentVersion.startsWith(expectedPattern)
47
+ ? `${expectedPattern}0`
48
+ : inc(currentVersion, 'patch');
49
+ }
50
+ return {
51
+ newVersion: getNewVersionFromCurrentVersion(currentVersion),
52
+ logText: `New version: ${getNewVersionFromCurrentVersion(currentVersion)}`,
53
+ };
54
+ }
55
+ }
56
+ //# sourceMappingURL=version-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-action.js","sourceRoot":"","sources":["../../../src/scripts/version-action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,cAAc;IAC7D,sBAAsB,CAAU;IAChC,KAAK,CAAC,oCAAoC,CACxC,IAAU;QAEV,OAAO;YACL,cAAc,EAAE,OAAO;YACvB,YAAY,EAAE,+BAA+B;SAC9C,CAAA;IACH,CAAC;IACD,KAAK,CAAC,8BAA8B,CAClC,IAAU,EACV,8BAA+F;QAE/F,OAAO;YACL,cAAc,EAAE,OAAO;YACvB,OAAO,EAAE,+BAA+B;SACzC,CAAA;IACH,CAAC;IACD,KAAK,CAAC,8BAA8B,CAClC,IAAU,EACV,YAA0B,EAC1B,qBAA6B;QAK7B,OAAO;YACL,cAAc,EAAE,OAAO;YACvB,oBAAoB,EAAE,OAAO;SAC9B,CAAA;IACH,CAAC;IACD,KAAK,CAAC,yBAAyB,CAAC,gBAAwB;QACtD,OAAO,KAAK,CAAA;IACd,CAAC;IACD,KAAK,CAAC,oBAAoB,CACxB,IAAU,EACV,UAAkB;QAElB,yCAAyC;QACzC,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAA;QACjD,MAAM,eAAe,GAAG,aAAa,cAAc,UAAU,CAAA;QAC7D,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;QACvC,OAAO,EAAE,CAAA;IACX,CAAC;IACD,KAAK,CAAC,yBAAyB,CAC7B,IAAU,EACV,YAA0B,EAC1B,oBAA4C;QAE5C,OAAO,EAAE,CAAA;IACX,CAAC;IACD,KAAK,CAAC,mBAAmB,CACvB,cAA6B,EAC7B,eAAuB,EACvB,qBAA6B,EAC7B,yBAAkD,EAClD,KAAa;QAKb,SAAS,UAAU;YACjB,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;YACvB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;YAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,CAAC,0BAA0B;YACrF,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;YAE1B,OAAO,GAAG,IAAI,GAAG,KAAK,IAAI,GAAG,GAAG,CAAA;QAClC,CAAC;QAED,SAAS,+BAA+B,CAAC,cAAsB;YAC7D,MAAM,eAAe,GAAG,UAAU,EAAE,CAAA;YACpC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,eAAe,CAAC;gBAChD,CAAC,CAAC,GAAG,eAAe,GAAG;gBACvB,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;QAClC,CAAC;QAED,OAAO;YACL,UAAU,EAAE,+BAA+B,CAAC,cAAc,CAAC;YAC3D,OAAO,EAAE,gBAAgB,+BAA+B,CAAC,cAAc,CAAC,EAAE;SAC3E,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Return the AWS profile name to use in AWS cli commands
3
+ */
4
+ export declare function getProfileName(): string;
5
+ /**
6
+ * Retrieves the AWS credentials from environment variables.
7
+ * Ensures that `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_DEFAULT_REGION` are properly set.
8
+ * Throws an error if credentials or region are missing.
9
+ *
10
+ * @return {Object} An object containing AWS credentials.
11
+ * @return {string} return.accessKeyId The AWS Access Key ID.
12
+ * @return {string} return.secretAccessKey The AWS Secret Access Key.
13
+ * @return {string} return.region The AWS Region.
14
+ */
15
+ export declare function getAwsCredentialsSet(): {
16
+ accessKeyId: string;
17
+ secretAccessKey: string;
18
+ region: string;
19
+ };
20
+ /**
21
+ * Retrieves the authentication information for a given OIDC profile.
22
+ * If the specified profile exists, it fetches the configuration; otherwise, it returns false.
23
+ *
24
+ * @return {Promise<string | boolean>} The authentication details if the profile exists, or false if the profile does not exist.
25
+ */
26
+ export declare function getAuthWithOidcProfile(): Promise<string | boolean>;
27
+ export declare function loginToEcr(): Promise<{
28
+ success: boolean;
29
+ stdout: string;
30
+ stderr: string;
31
+ }>;
32
+ /**
33
+ * Check AWS CLI with the OIDC profile otherwise use the default credentials
34
+ * @returns {string} the profile's name
35
+ */
36
+ export declare function checkAwsAuth(): Promise<string>;
37
+ export declare function pushImageToEcr(repositoryName: string, version: string): Promise<{
38
+ success: boolean;
39
+ }>;
@@ -0,0 +1,76 @@
1
+ import { getDockerOrPodman } from './docker';
2
+ import { exec_command } from './exec';
3
+ let profileName = 'OIDC-PROFILE';
4
+ /**
5
+ * Return the AWS profile name to use in AWS cli commands
6
+ */
7
+ export function getProfileName() {
8
+ return profileName;
9
+ }
10
+ /**
11
+ * Retrieves the AWS credentials from environment variables.
12
+ * Ensures that `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_DEFAULT_REGION` are properly set.
13
+ * Throws an error if credentials or region are missing.
14
+ *
15
+ * @return {Object} An object containing AWS credentials.
16
+ * @return {string} return.accessKeyId The AWS Access Key ID.
17
+ * @return {string} return.secretAccessKey The AWS Secret Access Key.
18
+ * @return {string} return.region The AWS Region.
19
+ */
20
+ export function getAwsCredentialsSet() {
21
+ const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
22
+ const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
23
+ const region = process.env.AWS_DEFAULT_REGION;
24
+ if (!accessKeyId || !secretAccessKey) {
25
+ throw new Error('AWS credentials not found, please set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables (or attach GLOBAL_ORG context if you are using CircleCI)');
26
+ }
27
+ if (!region) {
28
+ throw new Error('AWS region not found, please set AWS_DEFAULT_REGION environment variable (or attach GLOBAL_ORG context if you are using CircleCI)');
29
+ }
30
+ return { accessKeyId, secretAccessKey, region };
31
+ }
32
+ /**
33
+ * Retrieves the authentication information for a given OIDC profile.
34
+ * If the specified profile exists, it fetches the configuration; otherwise, it returns false.
35
+ *
36
+ * @return {Promise<string | boolean>} The authentication details if the profile exists, or false if the profile does not exist.
37
+ */
38
+ export async function getAuthWithOidcProfile() {
39
+ try {
40
+ const profileExist = await exec_command(`aws configure list-profiles | grep ${profileName}`);
41
+ if (profileExist.success) {
42
+ return profileExist.stdout;
43
+ }
44
+ return false;
45
+ }
46
+ catch (e) {
47
+ console.error(e);
48
+ return false;
49
+ }
50
+ }
51
+ export async function loginToEcr() {
52
+ return exec_command(`aws ecr get-login-password --profile ${profileName} --region eu-west-3 | ${await getDockerOrPodman()} login --username AWS --password-stdin ${process.env.AWS_ECR_REGISTRY}`);
53
+ }
54
+ /**
55
+ * Check AWS CLI with the OIDC profile otherwise use the default credentials
56
+ * @returns {string} the profile's name
57
+ */
58
+ export async function checkAwsAuth() {
59
+ const profileExist = await getAuthWithOidcProfile();
60
+ if (profileExist) {
61
+ console.log('OIDC profile found, using it');
62
+ profileName = 'OIDC-PROFILE';
63
+ }
64
+ else if (getAwsCredentialsSet()) {
65
+ console.log('OIDC profile not found, using AWS_KEY_ID and AWS_SECRET_ACCESS_KEY');
66
+ profileName = 'default';
67
+ }
68
+ else {
69
+ throw new Error('AWS credentials not found, please attach CORE-PLATFORM_SHARED_ENV context if you are using CircleCI or export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables');
70
+ }
71
+ return profileName;
72
+ }
73
+ export function pushImageToEcr(repositoryName, version) {
74
+ return exec_command(`docker push ${process.env.AWS_ECR_REGISTRY}/${repositoryName}:${version}`);
75
+ }
76
+ //# sourceMappingURL=aws-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-auth.js","sourceRoot":"","sources":["../../../src/ut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AM,iBAAiB,EAAE,0CAA0C,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAC9K,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,YAAY,GAAG,MAAM,sBAAsB,EAAE,CAAA;IACnD,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC3C,WAAW,GAAG,cAAc,CAAA;IAC9B,CAAC;SAAM,IAAI,oBAAoB,EAAE,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CACT,oEAAoE,CACrE,CAAA;QACD,WAAW,GAAG,SAAS,CAAA;IACzB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CACb,iLAAiL,CAClL,CAAA;IACH,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,cAAsB,EACtB,OAAe;IAEf,OAAO,YAAY,CACjB,eAAe,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,cAAc,IAAI,OAAO,EAAE,CAC3E,CAAA;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Determines the available container management tool by checking for Docker and fallback to Podman if Docker is unavailable.
3
+ *
4
+ * @return {Promise<string>} A promise that resolves to the string 'docker' if Docker is available, or 'podman' if Podman is used as a fallback.
5
+ */
6
+ export declare function getDockerOrPodman(): Promise<string>;
7
+ /**
8
+ * Builds a Docker image using the provided Dockerfile.
9
+ *
10
+ * @param imageName The name of the image to build.
11
+ * @param dockerfilePath The path to the Dockerfile.
12
+ * @param version The version of the image to build.
13
+ * @return {Promise<{success: boolean, stdout: string, stderr: string}>} A promise that resolves to an object containing the success status, stdout, and stderr of the command.
14
+ */
15
+ export declare function buildDockerImage(imageName: string, dockerfilePath: string, version: string): Promise<{
16
+ success: boolean;
17
+ stdout: string;
18
+ stderr: string;
19
+ }>;
@@ -1,20 +1,19 @@
1
- import { exec_command } from './exec'
2
-
1
+ import { exec_command } from './exec';
3
2
  /**
4
3
  * Determines the available container management tool by checking for Docker and fallback to Podman if Docker is unavailable.
5
4
  *
6
5
  * @return {Promise<string>} A promise that resolves to the string 'docker' if Docker is available, or 'podman' if Podman is used as a fallback.
7
6
  */
8
- export async function getDockerOrPodman(): Promise<string> {
9
- try {
10
- await exec_command('docker --version')
11
- return 'docker'
12
- } catch (e) {
13
- console.log('docker not found, trying podman')
14
- return 'podman'
15
- }
7
+ export async function getDockerOrPodman() {
8
+ try {
9
+ await exec_command('docker --version');
10
+ return 'docker';
11
+ }
12
+ catch (e) {
13
+ console.log('docker not found, trying podman');
14
+ return 'podman';
15
+ }
16
16
  }
17
-
18
17
  /**
19
18
  * Builds a Docker image using the provided Dockerfile.
20
19
  *
@@ -23,13 +22,8 @@ export async function getDockerOrPodman(): Promise<string> {
23
22
  * @param version The version of the image to build.
24
23
  * @return {Promise<{success: boolean, stdout: string, stderr: string}>} A promise that resolves to an object containing the success status, stdout, and stderr of the command.
25
24
  */
26
- export async function buildDockerImage(
27
- imageName: string,
28
- dockerfilePath: string,
29
- version: string,
30
- ): Promise<{ success: boolean; stdout: string; stderr: string }> {
31
- const dockerOrPodman = await getDockerOrPodman()
32
- return exec_command(
33
- `${dockerOrPodman} buildx build -t ${process.env.AWS_ECR_REGISTRY}/${imageName}:${version} -f ${dockerfilePath} --secret id=NPM_TOKEN .`,
34
- )
25
+ export async function buildDockerImage(imageName, dockerfilePath, version) {
26
+ const dockerOrPodman = await getDockerOrPodman();
27
+ return exec_command(`${dockerOrPodman} buildx build -t ${process.env.AWS_ECR_REGISTRY}/${imageName}:${version} -f ${dockerfilePath} --secret id=NPM_TOKEN .`);
35
28
  }
29
+ //# sourceMappingURL=docker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../src/utils/docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,kBAAkB,CAAC,CAAA;QACtC,OAAO,QAAQ,CAAA;IACjB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;QAC9C,OAAO,QAAQ,CAAA;IACjB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAiB,EACjB,cAAsB,EACtB,OAAe;IAEf,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAA;IAChD,OAAO,YAAY,CACjB,GAAG,cAAc,oBAAoB,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,SAAS,IAAI,OAAO,OAAO,cAAc,2BAA2B,CAC1I,CAAA;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { TinyExec } from 'tinyexec';
2
+ export declare function exec_command(command: string): Promise<{
3
+ success: boolean;
4
+ stdout: string;
5
+ stderr: string;
6
+ }>;
7
+ export declare const execTiny: TinyExec;
@@ -0,0 +1,21 @@
1
+ import { exec } from 'child_process';
2
+ import { promisify } from 'util';
3
+ import { x } from 'tinyexec';
4
+ export async function exec_command(command) {
5
+ const { stdout, stderr } = await promisify(exec)(command);
6
+ console.log(stdout);
7
+ console.error(stderr);
8
+ const success = !stderr;
9
+ return { success, stdout, stderr };
10
+ }
11
+ function createLoggingExecWrapper(execFn) {
12
+ return (command, args = [], options = {}) => {
13
+ console.log(`Running '${command} ${args.join(' ')}'...`);
14
+ return execFn(command, args, {
15
+ throwOnError: true,
16
+ ...options,
17
+ });
18
+ };
19
+ }
20
+ export const execTiny = createLoggingExecWrapper(x);
21
+ //# sourceMappingURL=exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAIhC,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAA;AAE5B,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAe;IAChD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAA;IACzD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAErB,MAAM,OAAO,GAAG,CAAC,MAAM,CAAA;IACvB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACpC,CAAC;AAED,SAAS,wBAAwB,CAAC,MAAgB;IAChD,OAAO,CACL,OAAe,EACf,OAAiB,EAAE,EACnB,UAA4B,EAAE,EAC9B,EAAE;QACF,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACxD,OAAO,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE;YAC3B,YAAY,EAAE,IAAI;YAClB,GAAG,OAAO;SACX,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get the version of a project
3
+ * @param projectName
4
+ * @returns {string}
5
+ */
6
+ export declare function getVersion(projectName: string): string;
@@ -0,0 +1,11 @@
1
+ import * as fs from 'node:fs';
2
+ /**
3
+ * Get the version of a project
4
+ * @param projectName
5
+ * @returns {string}
6
+ */
7
+ export function getVersion(projectName) {
8
+ const versionFilePath = `dist/apps/${projectName}/VERSION`;
9
+ return fs.readFileSync(versionFilePath, 'utf8');
10
+ }
11
+ //# sourceMappingURL=get-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-version.js","sourceRoot":"","sources":["../../../src/utils/get-version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,MAAM,eAAe,GAAG,aAAa,WAAW,UAAU,CAAA;IAC1D,OAAO,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;AACjD,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Get sanitized current git branch name
3
+ */
4
+ export declare function getSanitizedCurrentGitBranch(): Promise<string>;
@@ -0,0 +1,14 @@
1
+ import { exec_command } from './exec';
2
+ /**
3
+ * Get sanitized current git branch name
4
+ */
5
+ export async function getSanitizedCurrentGitBranch() {
6
+ const branchName = await exec_command(`git branch --show-current`);
7
+ return branchName.success
8
+ ? branchName.stdout
9
+ .trim()
10
+ .toLowerCase()
11
+ .replace(/[^a-z0-9]/g, '')
12
+ : '';
13
+ }
14
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/utils/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,2BAA2B,CAAC,CAAA;IAClE,OAAO,UAAU,CAAC,OAAO;QACvB,CAAC,CAAC,UAAU,CAAC,MAAM;aACd,IAAI,EAAE;aACN,WAAW,EAAE;aACb,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;QAC9B,CAAC,CAAC,EAAE,CAAA;AACR,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Read & parse the Helm chart.yaml file
3
+ * @param helmFolderPath
4
+ */
5
+ export declare function getHelmChartFile(helmFolderPath: string): Promise<any>;
6
+ /**
7
+ * Prepare the Chart.yaml config file for the Tsh proxy
8
+ * @param helmFolderPath
9
+ * @param tshPort
10
+ */
11
+ export declare function setupTeleportProxyHelmChartFile(helmFolderPath: string, tshPort: number): Promise<void>;
12
+ /**
13
+ * Revert the Tsh proxy config in the Chart.yaml config file
14
+ * @param helmFolderPath
15
+ * @param tshPort
16
+ */
17
+ export declare function resetTeleportProxyHelmChartFile(helmFolderPath: string, tshPort: number): Promise<void>;
18
+ /**
19
+ * Install all the helm repositories defined in the Chart config
20
+ * @param helmFolderPath
21
+ */
22
+ export declare function installHelmRepo(helmFolderPath: string): Promise<{
23
+ success: boolean;
24
+ stdout: string;
25
+ stderr: string;
26
+ }>;
27
+ /**
28
+ * Package the Helm chart
29
+ * @param helmFolderPath
30
+ * @param version
31
+ * @param destinationPath
32
+ */
33
+ export declare function packageHelm(helmFolderPath: string, version: string, destinationPath: string): Promise<{
34
+ success: boolean;
35
+ stdout: string;
36
+ stderr: string;
37
+ }>;
38
+ /**
39
+ * Push the packaged Helm chart in the chartmuseum
40
+ * @param packagedHelmChartFilePath
41
+ * @param projectName
42
+ * @param branch
43
+ */
44
+ export declare function pushPackagedHelm(packagedHelmChartFilePath: string, projectName: string, branch: string): Promise<{
45
+ success: boolean;
46
+ stdout: string;
47
+ stderr: string;
48
+ }>;