From aac060b0274d88a70abf48d92081bbe6cff368c0 Mon Sep 17 00:00:00 2001 From: Harold Date: Sun, 22 Jan 2023 16:50:08 -0500 Subject: [PATCH] Do not import code from unpublished deployer-lib --- packages/microapps-deployer-lib/src/index.ts | 1 - .../src/controllers/AppController.spec.ts | 2 +- .../src/controllers/AppController.ts | 2 +- .../controllers/version/DeleteVersion.spec.ts | 5 ++++- .../src/controllers/version/DeleteVersion.ts | 2 +- .../controllers/version/DeployVersion.spec.ts | 5 ++++- .../version/DeployVersionLite.spec.ts | 5 ++++- .../controllers/version/DeployVersionLite.ts | 2 +- .../version/DeployVersionPreflight.spec.ts | 2 +- .../version/DeployVersionPreflight.ts | 2 +- .../controllers/version/LambdaAlias.spec.ts | 2 +- .../src/controllers/version/LambdaAlias.ts | 5 ++--- packages/microapps-deployer/src/index.spec.ts | 2 +- packages/microapps-deployer/src/index.ts | 2 +- .../src/lib/GetAppNameOrRootTrailingSlash.ts | 2 +- .../src/lib/GetBucketPrefix.ts | 2 +- .../src/lib/Versions.ts} | 0 .../nextjs-docker-auto.skip | 2 +- .../src/commands/nextjs-version-restore.ts | 3 +-- .../src/commands/nextjs-version.ts | 3 +-- .../src/commands/publish-static.ts | 2 +- .../microapps-publish/src/commands/publish.ts | 2 +- .../microapps-publish/src/lib/DeployClient.ts | 2 +- .../src/lib/S3TransferUtility.ts | 2 +- .../microapps-publish/src/lib/S3Uploader.ts | 2 +- packages/microapps-publish/src/lib/Versions.ts | 18 +++++++++++++++++- 26 files changed, 50 insertions(+), 29 deletions(-) rename packages/{microapps-deployer-lib/src/versions.ts => microapps-deployer/src/lib/Versions.ts} (100%) diff --git a/packages/microapps-deployer-lib/src/index.ts b/packages/microapps-deployer-lib/src/index.ts index a4bb6079..e4f23971 100644 --- a/packages/microapps-deployer-lib/src/index.ts +++ b/packages/microapps-deployer-lib/src/index.ts @@ -1,2 +1 @@ export * from './messages'; -export * from './versions'; diff --git a/packages/microapps-deployer/src/controllers/AppController.spec.ts b/packages/microapps-deployer/src/controllers/AppController.spec.ts index e4e14287..19ea8502 100644 --- a/packages/microapps-deployer/src/controllers/AppController.spec.ts +++ b/packages/microapps-deployer/src/controllers/AppController.spec.ts @@ -2,7 +2,7 @@ import 'jest-dynalite/withDb'; import { DBManager, Application } from '@pwrdrvr/microapps-datalib'; import type * as lambda from 'aws-lambda'; import * as dynamodb from '@aws-sdk/client-dynamodb'; -import { ICreateApplicationRequest } from '@pwrdrvr/microapps-deployer-lib'; +import type { ICreateApplicationRequest } from '@pwrdrvr/microapps-deployer-lib'; import { handler, overrideDBManager } from '../index'; let dynamoClient: dynamodb.DynamoDBClient; diff --git a/packages/microapps-deployer/src/controllers/AppController.ts b/packages/microapps-deployer/src/controllers/AppController.ts index 1a88e9e6..24e00b97 100644 --- a/packages/microapps-deployer/src/controllers/AppController.ts +++ b/packages/microapps-deployer/src/controllers/AppController.ts @@ -1,5 +1,5 @@ import { Application, DBManager } from '@pwrdrvr/microapps-datalib'; -import { ICreateApplicationRequest, IDeployerResponse } from '@pwrdrvr/microapps-deployer-lib'; +import type { ICreateApplicationRequest, IDeployerResponse } from '@pwrdrvr/microapps-deployer-lib'; function isNil(arg: string | undefined | null) { if (arg === undefined || arg === null || arg === '') return true; diff --git a/packages/microapps-deployer/src/controllers/version/DeleteVersion.spec.ts b/packages/microapps-deployer/src/controllers/version/DeleteVersion.spec.ts index 5888ab9c..a9b6cb9d 100644 --- a/packages/microapps-deployer/src/controllers/version/DeleteVersion.spec.ts +++ b/packages/microapps-deployer/src/controllers/version/DeleteVersion.spec.ts @@ -36,7 +36,10 @@ import * as dynamodb from '@aws-sdk/client-dynamodb'; import * as lambda from '@aws-sdk/client-lambda'; import * as s3 from '@aws-sdk/client-s3'; -import { ICreateApplicationRequest, IDeleteVersionRequest } from '@pwrdrvr/microapps-deployer-lib'; +import type { + ICreateApplicationRequest, + IDeleteVersionRequest, +} from '@pwrdrvr/microapps-deployer-lib'; import { DBManager, Version } from '@pwrdrvr/microapps-datalib'; import type * as lambdaTypes from 'aws-lambda'; import { mockClient, AwsClientStub } from 'aws-sdk-client-mock'; diff --git a/packages/microapps-deployer/src/controllers/version/DeleteVersion.ts b/packages/microapps-deployer/src/controllers/version/DeleteVersion.ts index 29bdfbdd..97f60fe7 100644 --- a/packages/microapps-deployer/src/controllers/version/DeleteVersion.ts +++ b/packages/microapps-deployer/src/controllers/version/DeleteVersion.ts @@ -3,7 +3,7 @@ import * as lambda from '@aws-sdk/client-lambda'; import * as s3 from '@aws-sdk/client-s3'; import { DBManager, Version } from '@pwrdrvr/microapps-datalib'; import { IConfig } from '../../config/Config'; -import { IDeleteVersionRequest, IDeployerResponse } from '@pwrdrvr/microapps-deployer-lib'; +import type { IDeleteVersionRequest, IDeployerResponse } from '@pwrdrvr/microapps-deployer-lib'; import Log from '../../lib/Log'; import { ExtractARNandAlias } from '../../lib/ExtractLambdaArn'; import { GetBucketPrefix } from '../../lib/GetBucketPrefix'; diff --git a/packages/microapps-deployer/src/controllers/version/DeployVersion.spec.ts b/packages/microapps-deployer/src/controllers/version/DeployVersion.spec.ts index 03459877..dbe8fb59 100644 --- a/packages/microapps-deployer/src/controllers/version/DeployVersion.spec.ts +++ b/packages/microapps-deployer/src/controllers/version/DeployVersion.spec.ts @@ -36,7 +36,10 @@ import * as dynamodb from '@aws-sdk/client-dynamodb'; import * as lambda from '@aws-sdk/client-lambda'; import * as s3 from '@aws-sdk/client-s3'; -import { ICreateApplicationRequest, IDeployVersionRequest } from '@pwrdrvr/microapps-deployer-lib'; +import type { + ICreateApplicationRequest, + IDeployVersionRequest, +} from '@pwrdrvr/microapps-deployer-lib'; import { DBManager, Version } from '@pwrdrvr/microapps-datalib'; import type * as lambdaTypes from 'aws-lambda'; import { mockClient, AwsClientStub } from 'aws-sdk-client-mock'; diff --git a/packages/microapps-deployer/src/controllers/version/DeployVersionLite.spec.ts b/packages/microapps-deployer/src/controllers/version/DeployVersionLite.spec.ts index 6323eb3c..2ee4dc93 100644 --- a/packages/microapps-deployer/src/controllers/version/DeployVersionLite.spec.ts +++ b/packages/microapps-deployer/src/controllers/version/DeployVersionLite.spec.ts @@ -36,7 +36,10 @@ import * as dynamodb from '@aws-sdk/client-dynamodb'; import * as lambda from '@aws-sdk/client-lambda'; import * as s3 from '@aws-sdk/client-s3'; -import { ICreateApplicationRequest, IDeployVersionRequest } from '@pwrdrvr/microapps-deployer-lib'; +import type { + ICreateApplicationRequest, + IDeployVersionRequest, +} from '@pwrdrvr/microapps-deployer-lib'; import { DBManager, Version } from '@pwrdrvr/microapps-datalib'; import type * as lambdaTypes from 'aws-lambda'; import { mockClient, AwsClientStub } from 'aws-sdk-client-mock'; diff --git a/packages/microapps-deployer/src/controllers/version/DeployVersionLite.ts b/packages/microapps-deployer/src/controllers/version/DeployVersionLite.ts index 6d2b23f6..c1a0181d 100644 --- a/packages/microapps-deployer/src/controllers/version/DeployVersionLite.ts +++ b/packages/microapps-deployer/src/controllers/version/DeployVersionLite.ts @@ -1,6 +1,6 @@ import { DBManager, Rules, Version } from '@pwrdrvr/microapps-datalib'; import { IConfig } from '../../config/Config'; -import { IDeployVersionRequest, IDeployerResponse } from '@pwrdrvr/microapps-deployer-lib'; +import type { IDeployVersionRequest, IDeployerResponse } from '@pwrdrvr/microapps-deployer-lib'; import Log from '../../lib/Log'; import { GetBucketPrefix } from '../../lib/GetBucketPrefix'; import { CopyToProdBucket } from '../../lib/S3'; diff --git a/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.spec.ts b/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.spec.ts index ffb7073a..26043d96 100644 --- a/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.spec.ts +++ b/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.spec.ts @@ -37,7 +37,7 @@ import * as lambda from '@aws-sdk/client-lambda'; import * as s3 from '@aws-sdk/client-s3'; import * as sts from '@aws-sdk/client-sts'; -import { +import type { IDeployVersionPreflightRequest, ICreateApplicationRequest, } from '@pwrdrvr/microapps-deployer-lib'; diff --git a/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.ts b/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.ts index 299c8f69..3a700422 100644 --- a/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.ts +++ b/packages/microapps-deployer/src/controllers/version/DeployVersionPreflight.ts @@ -1,7 +1,7 @@ import * as sts from '@aws-sdk/client-sts'; import { DBManager, Version } from '@pwrdrvr/microapps-datalib'; import { IConfig } from '../../config/Config'; -import { +import type { IDeployVersionPreflightRequest, IDeployVersionPreflightResponse, } from '@pwrdrvr/microapps-deployer-lib'; diff --git a/packages/microapps-deployer/src/controllers/version/LambdaAlias.spec.ts b/packages/microapps-deployer/src/controllers/version/LambdaAlias.spec.ts index e7e161fb..8f7fec48 100644 --- a/packages/microapps-deployer/src/controllers/version/LambdaAlias.spec.ts +++ b/packages/microapps-deployer/src/controllers/version/LambdaAlias.spec.ts @@ -37,7 +37,7 @@ import * as lambda from '@aws-sdk/client-lambda'; import * as s3 from '@aws-sdk/client-s3'; import * as sts from '@aws-sdk/client-sts'; -import { +import type { ICreateApplicationRequest, ILambdaAliasRequest, ILambdaAliasResponse, diff --git a/packages/microapps-deployer/src/controllers/version/LambdaAlias.ts b/packages/microapps-deployer/src/controllers/version/LambdaAlias.ts index cd964d23..4a4e6965 100644 --- a/packages/microapps-deployer/src/controllers/version/LambdaAlias.ts +++ b/packages/microapps-deployer/src/controllers/version/LambdaAlias.ts @@ -1,14 +1,13 @@ import * as lambda from '@aws-sdk/client-lambda'; import { IConfig } from '../../config/Config'; -import { - createVersions, +import type { IDeployerResponse, ILambdaAliasRequest, ILambdaAliasResponse, - IVersions, } from '@pwrdrvr/microapps-deployer-lib'; import { promisify } from 'util'; import Log from '../../lib/Log'; +import { createVersions, IVersions } from '../../lib/Versions'; import { ExtractARNandAlias } from '../../lib/ExtractLambdaArn'; const sleep = promisify(setTimeout); diff --git a/packages/microapps-deployer/src/index.spec.ts b/packages/microapps-deployer/src/index.spec.ts index 2e9a554b..dd614e5f 100644 --- a/packages/microapps-deployer/src/index.spec.ts +++ b/packages/microapps-deployer/src/index.spec.ts @@ -30,7 +30,7 @@ Object.defineProperty(Config, 'instance', { import * as dynamodb from '@aws-sdk/client-dynamodb'; import { handler, overrideDBManager } from './index'; import { Application, DBManager } from '@pwrdrvr/microapps-datalib'; -import { ICreateApplicationRequest } from '@pwrdrvr/microapps-deployer-lib'; +import type { ICreateApplicationRequest } from '@pwrdrvr/microapps-deployer-lib'; let dynamoClient: dynamodb.DynamoDBClient; let dbManager: DBManager; diff --git a/packages/microapps-deployer/src/index.ts b/packages/microapps-deployer/src/index.ts index 31cc11a5..70e7a29d 100644 --- a/packages/microapps-deployer/src/index.ts +++ b/packages/microapps-deployer/src/index.ts @@ -1,7 +1,7 @@ import 'source-map-support/register'; // Used by ts-convict import 'reflect-metadata'; -import { +import type { IRequestBase, IDeployVersionPreflightRequest, ICreateApplicationRequest, diff --git a/packages/microapps-deployer/src/lib/GetAppNameOrRootTrailingSlash.ts b/packages/microapps-deployer/src/lib/GetAppNameOrRootTrailingSlash.ts index 9eaedf8a..1db5da3d 100644 --- a/packages/microapps-deployer/src/lib/GetAppNameOrRootTrailingSlash.ts +++ b/packages/microapps-deployer/src/lib/GetAppNameOrRootTrailingSlash.ts @@ -1,4 +1,4 @@ -import { IDeployVersionRequestBase } from '@pwrdrvr/microapps-deployer-lib'; +import type { IDeployVersionRequestBase } from '@pwrdrvr/microapps-deployer-lib'; export function GetAppNameOrRootTrailingSlash( request: Pick, diff --git a/packages/microapps-deployer/src/lib/GetBucketPrefix.ts b/packages/microapps-deployer/src/lib/GetBucketPrefix.ts index e83cef49..556f9060 100644 --- a/packages/microapps-deployer/src/lib/GetBucketPrefix.ts +++ b/packages/microapps-deployer/src/lib/GetBucketPrefix.ts @@ -1,5 +1,5 @@ import { IConfig } from '../config/Config'; -import { IDeployVersionRequestBase } from '@pwrdrvr/microapps-deployer-lib'; +import type { IDeployVersionRequestBase } from '@pwrdrvr/microapps-deployer-lib'; import { GetAppNameOrRootTrailingSlash } from './GetAppNameOrRootTrailingSlash'; /** diff --git a/packages/microapps-deployer-lib/src/versions.ts b/packages/microapps-deployer/src/lib/Versions.ts similarity index 100% rename from packages/microapps-deployer-lib/src/versions.ts rename to packages/microapps-deployer/src/lib/Versions.ts diff --git a/packages/microapps-publish/src/commands-deprecated/nextjs-docker-auto.skip b/packages/microapps-publish/src/commands-deprecated/nextjs-docker-auto.skip index 554da81b..0c12e861 100755 --- a/packages/microapps-publish/src/commands-deprecated/nextjs-docker-auto.skip +++ b/packages/microapps-publish/src/commands-deprecated/nextjs-docker-auto.skip @@ -13,7 +13,7 @@ import DeployClient, { IDeployVersionPreflightResult } from '../lib/DeployClient import S3Uploader from '../lib/S3Uploader'; import S3TransferUtility from '../lib/S3TransferUtility'; import { Upload } from '@aws-sdk/lib-storage'; -import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib'; +import { createVersions, IVersions } from '../lib/Versions'; import { contentType } from 'mime-types'; import { TaskWrapper } from 'listr2/dist/lib/task-wrapper'; import { DefaultRenderer } from 'listr2/dist/renderer/default.renderer'; diff --git a/packages/microapps-publish/src/commands/nextjs-version-restore.ts b/packages/microapps-publish/src/commands/nextjs-version-restore.ts index b23dde28..7f56c4a5 100644 --- a/packages/microapps-publish/src/commands/nextjs-version-restore.ts +++ b/packages/microapps-publish/src/commands/nextjs-version-restore.ts @@ -1,8 +1,7 @@ import 'reflect-metadata'; import { Command, flags as flagsParser } from '@oclif/command'; import { Listr } from 'listr2'; -import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib'; -import { restoreFiles } from '../lib/Versions'; +import { createVersions, IVersions, restoreFiles } from '../lib/Versions'; export class NextJSVersionRestoreCommand extends Command { static description = 'Restore next.config.js'; diff --git a/packages/microapps-publish/src/commands/nextjs-version.ts b/packages/microapps-publish/src/commands/nextjs-version.ts index cc2b08c1..b1ad74e4 100644 --- a/packages/microapps-publish/src/commands/nextjs-version.ts +++ b/packages/microapps-publish/src/commands/nextjs-version.ts @@ -1,9 +1,8 @@ import 'reflect-metadata'; import { Command, flags as flagsParser } from '@oclif/command'; import { Listr } from 'listr2'; -import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib'; +import { createVersions, IVersions, restoreFiles, writeNewVersions } from '../lib/Versions'; import { Config } from '../config/Config'; -import { restoreFiles, writeNewVersions } from '../lib/Versions'; export class NextJSVersionCommand extends Command { static description = 'Apply version to next.config.js overtop of 0.0.0 placeholder'; diff --git a/packages/microapps-publish/src/commands/publish-static.ts b/packages/microapps-publish/src/commands/publish-static.ts index becdc75f..b6d5dd37 100644 --- a/packages/microapps-publish/src/commands/publish-static.ts +++ b/packages/microapps-publish/src/commands/publish-static.ts @@ -5,7 +5,7 @@ import { Command, flags as flagsParser } from '@oclif/command'; import * as path from 'path'; import { pathExists, createReadStream } from 'fs-extra'; import { Listr, ListrTask } from 'listr2'; -import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib'; +import { createVersions, IVersions } from '../lib/Versions'; import { Config } from '../config/Config'; import DeployClient, { IDeployVersionPreflightResult } from '../lib/DeployClient'; import S3Uploader from '../lib/S3Uploader'; diff --git a/packages/microapps-publish/src/commands/publish.ts b/packages/microapps-publish/src/commands/publish.ts index 946954e6..3f226e3b 100644 --- a/packages/microapps-publish/src/commands/publish.ts +++ b/packages/microapps-publish/src/commands/publish.ts @@ -7,7 +7,7 @@ import { Command, flags as flagsParser } from '@oclif/command'; import * as path from 'path'; import { pathExists, createReadStream } from 'fs-extra'; import { Listr, ListrTask } from 'listr2'; -import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib'; +import { createVersions, IVersions } from '../lib/Versions'; import { Config, IConfig } from '../config/Config'; import DeployClient, { IDeployVersionPreflightResult } from '../lib/DeployClient'; import S3Uploader from '../lib/S3Uploader'; diff --git a/packages/microapps-publish/src/lib/DeployClient.ts b/packages/microapps-publish/src/lib/DeployClient.ts index db5c9a21..c7ab5a75 100644 --- a/packages/microapps-publish/src/lib/DeployClient.ts +++ b/packages/microapps-publish/src/lib/DeployClient.ts @@ -1,5 +1,5 @@ import * as lambda from '@aws-sdk/client-lambda'; -import { +import type { ICreateApplicationRequest, IDeployerResponse, IDeployVersionPreflightRequest, diff --git a/packages/microapps-publish/src/lib/S3TransferUtility.ts b/packages/microapps-publish/src/lib/S3TransferUtility.ts index a3afd88d..efda9296 100644 --- a/packages/microapps-publish/src/lib/S3TransferUtility.ts +++ b/packages/microapps-publish/src/lib/S3TransferUtility.ts @@ -6,7 +6,7 @@ import { promises as fs, createReadStream } from 'fs'; import * as path from 'path'; import * as s3 from '@aws-sdk/client-s3'; import { Upload } from '@aws-sdk/lib-storage'; -import { IDeployVersionPreflightResponse } from '@pwrdrvr/microapps-deployer-lib'; +import type { IDeployVersionPreflightResponse } from '@pwrdrvr/microapps-deployer-lib'; import { contentType } from 'mime-types'; import pMap from 'p-map'; diff --git a/packages/microapps-publish/src/lib/S3Uploader.ts b/packages/microapps-publish/src/lib/S3Uploader.ts index 448e64b4..409c6559 100644 --- a/packages/microapps-publish/src/lib/S3Uploader.ts +++ b/packages/microapps-publish/src/lib/S3Uploader.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { IDeployVersionPreflightResponse } from '@pwrdrvr/microapps-deployer-lib'; +import type { IDeployVersionPreflightResponse } from '@pwrdrvr/microapps-deployer-lib'; import * as fs from 'fs-extra'; import { IConfig } from '../config/Config'; import S3TransferUtility from './S3TransferUtility'; diff --git a/packages/microapps-publish/src/lib/Versions.ts b/packages/microapps-publish/src/lib/Versions.ts index cede446f..503519bc 100644 --- a/packages/microapps-publish/src/lib/Versions.ts +++ b/packages/microapps-publish/src/lib/Versions.ts @@ -1,5 +1,4 @@ import { promises as fs } from 'fs-extra'; -import { IVersions } from '@pwrdrvr/microapps-deployer-lib'; /** * Represents a File To Modify @@ -83,3 +82,20 @@ export async function restoreFiles(filesToModify: IFileToModify[]): Promise { + return { version, alias: `v${version.replace(/\./g, '_')}` }; +}