adding in the s3 package, finishing up the CLI
This commit is contained in:
parent
efb5cafbdf
commit
f40a365991
121 changed files with 8172 additions and 221 deletions
28
.d.ts
vendored
28
.d.ts
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
declare module '@serverless/core' {
|
declare module '@serverless/core' {
|
||||||
|
import { Credentials } from 'aws-sdk';
|
||||||
export class Component {
|
export class Component {
|
||||||
load(modulePath: string, moduleName?: string): any;
|
load(modulePath: string, moduleName?: string): any;
|
||||||
save(): void;
|
save(): void;
|
||||||
|
|
@ -21,13 +22,30 @@ declare module '@serverless/core' {
|
||||||
|
|
||||||
type Utils = {
|
type Utils = {
|
||||||
dirExists(path: string): boolean;
|
dirExists(path: string): boolean;
|
||||||
|
fileExists(path: string): boolean;
|
||||||
hashFile(path: string): string;
|
hashFile(path: string): string;
|
||||||
isArchivePath(path: string): boolean;
|
isArchivePath(path: string): boolean;
|
||||||
sleep(time: number): void;
|
sleep(time: number): void;
|
||||||
};
|
readFileIfExists(path: string): Promise<any>;
|
||||||
type Credentials = {
|
randomId(): string;
|
||||||
accessKeyId: string;
|
readFile(path: string): Promise<any>;
|
||||||
secretAccessKey: string;
|
writeFile(contextStatePath: string, state: Record<string, unknown>): Promise<any>;
|
||||||
sessionToken?: string;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module 's3-stream-upload' {
|
||||||
|
import { S3 } from 'aws-sdk';
|
||||||
|
|
||||||
|
export default function (s3: S3, options: UploadStreamOptions): NodeJS.WritableStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'prettyoutput' {
|
||||||
|
export default function (data: any, options?: any, indent?: number): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type UploadStreamOptions = {
|
||||||
|
Bucket?: string;
|
||||||
|
Key?: string;
|
||||||
|
ContentType?: string;
|
||||||
|
CacheControl?: string;
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import fs from 'fs-extra';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
import AwsComponent from '@next-deploy/aws-component';
|
|
||||||
|
|
||||||
const SUPPORTED_ENGINES = [
|
|
||||||
{
|
|
||||||
type: 'aws',
|
|
||||||
component: '@next-deploy/aws-component',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const DEFAULT_ENGINE = 'aws';
|
|
||||||
const DEPLOY_CONFIG_NAME = 'deploy.config.js';
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const deployConfigPath = path.join(process.cwd(), DEPLOY_CONFIG_NAME);
|
|
||||||
const configPathExists = fs.existsSync(deployConfigPath);
|
|
||||||
|
|
||||||
if (!configPathExists) {
|
|
||||||
fs.writeFileSync(deployConfigPath, getDefaultConfigData());
|
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
|
||||||
debug = false,
|
|
||||||
engine = DEFAULT_ENGINE,
|
|
||||||
...componentOptions
|
|
||||||
}: BaseDeploymentOptions = await import(deployConfigPath);
|
|
||||||
const engineIndex = SUPPORTED_ENGINES.findIndex(({ type }) => type === engine);
|
|
||||||
|
|
||||||
if (engineIndex === -1) {
|
|
||||||
throw new Error(
|
|
||||||
`Engine ${engine} is unsupported. Pick one of: ${SUPPORTED_ENGINES.map(
|
|
||||||
({ type }) => type
|
|
||||||
).join(',')}.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const EngineComponent = await import(SUPPORTED_ENGINES[engineIndex].component);
|
|
||||||
const engineComponent = new EngineComponent.default();
|
|
||||||
|
|
||||||
if (engine === 'aws') {
|
|
||||||
await (engineComponent as AwsComponent).default(componentOptions);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
function getDefaultConfigData(): string {
|
|
||||||
return `// for configurable options visit: https://github.com/nidratech/next-deploy#options
|
|
||||||
module.exports = {
|
|
||||||
// prints helpful output during deployment
|
|
||||||
debug: false,
|
|
||||||
};
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
type BaseDeploymentOptions = {
|
|
||||||
engine?: 'aws';
|
|
||||||
debug?: boolean;
|
|
||||||
};
|
|
||||||
14
package.json
14
package.json
|
|
@ -20,12 +20,10 @@
|
||||||
"publish": "lerna publish --conventional-commits",
|
"publish": "lerna publish --conventional-commits",
|
||||||
"prepublishOnly": "yarn test",
|
"prepublishOnly": "yarn test",
|
||||||
"prerelease": "lerna publish --conventional-commits --conventional-prerelease",
|
"prerelease": "lerna publish --conventional-commits --conventional-prerelease",
|
||||||
"graduate": "lerna publish --conventional-commits --conventional-graduate",
|
"graduate": "lerna publish --conventional-commits --conventional-graduate"
|
||||||
"prepare": "yarn build-self",
|
|
||||||
"build-self": "tsc -p tsconfig.build.json"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"next-deploy": "./dist/deploy.js"
|
"next-deploy": "./packages/cli/dist/index.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
@ -49,15 +47,17 @@
|
||||||
"@types/fs-extra": "^9.0.1",
|
"@types/fs-extra": "^9.0.1",
|
||||||
"@types/jest": "^26.0.4",
|
"@types/jest": "^26.0.4",
|
||||||
"@types/klaw": "^3.0.1",
|
"@types/klaw": "^3.0.1",
|
||||||
|
"@types/klaw-sync": "^6.0.0",
|
||||||
"@types/mime-types": "^2.1.0",
|
"@types/mime-types": "^2.1.0",
|
||||||
"@types/node": "^14.0.18",
|
"@types/node": "^14.0.20",
|
||||||
"@types/path-to-regexp": "^1.7.0",
|
"@types/path-to-regexp": "^1.7.0",
|
||||||
"@types/ramda": "^0.27.7",
|
"@types/ramda": "^0.27.10",
|
||||||
"@types/react": "^16.9.41",
|
"@types/react": "^16.9.41",
|
||||||
"@types/react-dom": "^16.9.8",
|
"@types/react-dom": "^16.9.8",
|
||||||
"@types/webpack": "^4.41.20",
|
"@types/webpack": "^4.41.21",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.6.0",
|
"@typescript-eslint/eslint-plugin": "^3.6.0",
|
||||||
"@typescript-eslint/parser": "^3.6.0",
|
"@typescript-eslint/parser": "^3.6.0",
|
||||||
|
"aws-sdk": "^2.712.0",
|
||||||
"eslint": "^7.4.0",
|
"eslint": "^7.4.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { createComponent } from './test-utils';
|
||||||
import { mockCreateDistribution, mockCreateDistributionPromise } from 'aws-sdk';
|
import { mockCreateDistribution, mockCreateDistributionPromise } from 'aws-sdk';
|
||||||
import CloudFrontComponent from '../serverless';
|
import CloudFrontComponent from '../serverless';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
describe('Input origin as a custom url', () => {
|
describe('Input origin as a custom url', () => {
|
||||||
let component: CloudFrontComponent;
|
let component: CloudFrontComponent;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { CloudFront, mockCreateInvalidation } from 'aws-sdk';
|
import { CloudFront, mockCreateInvalidation } from 'aws-sdk';
|
||||||
import createInvalidation, { ALL_FILES_PATH } from '../src/lib/createInvalidation';
|
import createInvalidation, { ALL_FILES_PATH } from '../src/lib/createInvalidation';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
const invalidate = (options = {}): Promise<CloudFront.CreateInvalidationResult> => {
|
const invalidate = (options = {}): Promise<CloudFront.CreateInvalidationResult> => {
|
||||||
return createInvalidation({
|
return createInvalidation({
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
} from 'aws-sdk';
|
} from 'aws-sdk';
|
||||||
import CloudFrontComponent from '../serverless';
|
import CloudFrontComponent from '../serverless';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
describe('Input origin as a custom url', () => {
|
describe('Input origin as a custom url', () => {
|
||||||
let component: CloudFrontComponent;
|
let component: CloudFrontComponent;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
} from 'aws-sdk';
|
} from 'aws-sdk';
|
||||||
import CloudFrontComponent from '../serverless';
|
import CloudFrontComponent from '../serverless';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
describe('General options propagation', () => {
|
describe('General options propagation', () => {
|
||||||
let component: CloudFrontComponent;
|
let component: CloudFrontComponent;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { createComponent, assertHasCacheBehavior } from './test-utils';
|
||||||
import { mockCreateDistribution, mockCreateDistributionPromise } from 'aws-sdk';
|
import { mockCreateDistribution, mockCreateDistributionPromise } from 'aws-sdk';
|
||||||
import CloudFrontComponent from '../serverless';
|
import CloudFrontComponent from '../serverless';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
describe('Input origin as a custom url', () => {
|
describe('Input origin as a custom url', () => {
|
||||||
let component: CloudFrontComponent;
|
let component: CloudFrontComponent;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
} from 'aws-sdk';
|
} from 'aws-sdk';
|
||||||
import CloudFrontComponent from '../serverless';
|
import CloudFrontComponent from '../serverless';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
describe('Input origin with path pattern', () => {
|
describe('Input origin with path pattern', () => {
|
||||||
let component: CloudFrontComponent;
|
let component: CloudFrontComponent;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import CloudFrontComponent from '../serverless';
|
||||||
|
|
||||||
import { createComponent, assertHasOrigin } from './test-utils';
|
import { createComponent, assertHasOrigin } from './test-utils';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
describe('S3 origins', () => {
|
describe('S3 origins', () => {
|
||||||
let component: CloudFrontComponent;
|
let component: CloudFrontComponent;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@serverless/core": "^1.1.2",
|
"@serverless/core": "^1.1.2",
|
||||||
"aws-sdk": "^2.709.0",
|
"aws-sdk": "^2.712.0",
|
||||||
"ramda": "^0.27.0"
|
"ramda": "^0.27.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { CloudFront, S3 } from 'aws-sdk';
|
import { CloudFront, S3, Credentials } from 'aws-sdk';
|
||||||
import { equals } from 'ramda';
|
import { equals } from 'ramda';
|
||||||
import { Component } from '@serverless/core';
|
import { Component } from '@serverless/core';
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {
|
||||||
updateCloudFrontDistribution,
|
updateCloudFrontDistribution,
|
||||||
deleteCloudFrontDistribution,
|
deleteCloudFrontDistribution,
|
||||||
} from './lib';
|
} from './lib';
|
||||||
import { Credentials, CloudFrontInputs } from '../types';
|
import { CloudFrontInputs } from '../types';
|
||||||
|
|
||||||
class CloudFrontComponent extends Component {
|
class CloudFrontComponent extends Component {
|
||||||
static createInvalidation({
|
static createInvalidation({
|
||||||
|
|
@ -23,7 +23,7 @@ class CloudFrontComponent extends Component {
|
||||||
return createInvalidation({ credentials, distributionId, paths });
|
return createInvalidation({ credentials, distributionId, paths });
|
||||||
}
|
}
|
||||||
|
|
||||||
async default(inputs: CloudFrontInputs): Promise<any> {
|
async default(inputs: CloudFrontInputs): Promise<Record<string, any>> {
|
||||||
this.context.status('Deploying');
|
this.context.status('Deploying');
|
||||||
|
|
||||||
inputs.region = inputs.region || 'us-east-1';
|
inputs.region = inputs.region || 'us-east-1';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import { CloudFront } from 'aws-sdk';
|
import { CloudFront, Credentials } from 'aws-sdk';
|
||||||
|
|
||||||
import { Credentials } from '../../types';
|
|
||||||
|
|
||||||
export const ALL_FILES_PATH = '/*';
|
export const ALL_FILES_PATH = '/*';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,11 @@ export const createCloudFrontDistribution = async (
|
||||||
cf: CloudFront,
|
cf: CloudFront,
|
||||||
s3: S3,
|
s3: S3,
|
||||||
inputs: CloudFrontInputs
|
inputs: CloudFrontInputs
|
||||||
) => {
|
): Promise<{
|
||||||
|
id?: string;
|
||||||
|
arn?: string;
|
||||||
|
url?: string;
|
||||||
|
}> => {
|
||||||
let originAccessIdentityId;
|
let originAccessIdentityId;
|
||||||
let s3CanonicalUserId;
|
let s3CanonicalUserId;
|
||||||
|
|
||||||
|
|
@ -82,7 +86,11 @@ export const updateCloudFrontDistribution = async (
|
||||||
s3: S3,
|
s3: S3,
|
||||||
distributionId: string,
|
distributionId: string,
|
||||||
inputs: CloudFrontInputs
|
inputs: CloudFrontInputs
|
||||||
) => {
|
): Promise<{
|
||||||
|
id?: string;
|
||||||
|
arn?: string;
|
||||||
|
url?: string;
|
||||||
|
}> => {
|
||||||
const distributionConfigResponse = await cf
|
const distributionConfigResponse = await cf
|
||||||
.getDistributionConfig({ Id: distributionId })
|
.getDistributionConfig({ Id: distributionId })
|
||||||
.promise();
|
.promise();
|
||||||
|
|
@ -113,7 +121,7 @@ export const updateCloudFrontDistribution = async (
|
||||||
Id: distributionId,
|
Id: distributionId,
|
||||||
IfMatch: distributionConfigResponse.ETag,
|
IfMatch: distributionConfigResponse.ETag,
|
||||||
DistributionConfig: {
|
DistributionConfig: {
|
||||||
CallerReference: distributionConfigResponse.DistributionConfig.CallerReference,
|
...distributionConfigResponse.DistributionConfig,
|
||||||
Enabled: inputs.enabled as boolean,
|
Enabled: inputs.enabled as boolean,
|
||||||
Comment: inputs.comment as string,
|
Comment: inputs.comment as string,
|
||||||
DefaultCacheBehavior: getDefaultCacheBehavior(Origins.Items[0].Id, inputs.defaults),
|
DefaultCacheBehavior: getDefaultCacheBehavior(Origins.Items[0].Id, inputs.defaults),
|
||||||
|
|
@ -147,11 +155,8 @@ const disableCloudFrontDistribution = async (cf: CloudFront, distributionId: str
|
||||||
Id: distributionId,
|
Id: distributionId,
|
||||||
IfMatch: distributionConfigResponse.ETag,
|
IfMatch: distributionConfigResponse.ETag,
|
||||||
DistributionConfig: {
|
DistributionConfig: {
|
||||||
CallerReference: distributionConfigResponse.DistributionConfig.CallerReference,
|
...distributionConfigResponse.DistributionConfig,
|
||||||
Enabled: false,
|
Enabled: false,
|
||||||
Comment: distributionConfigResponse.DistributionConfig.Comment,
|
|
||||||
DefaultCacheBehavior: distributionConfigResponse.DistributionConfig.DefaultCacheBehavior,
|
|
||||||
Origins: distributionConfigResponse.DistributionConfig.Origins,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -164,7 +169,10 @@ const disableCloudFrontDistribution = async (cf: CloudFront, distributionId: str
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteCloudFrontDistribution = async (cf: CloudFront, distributionId: string) => {
|
export const deleteCloudFrontDistribution = async (
|
||||||
|
cf: CloudFront,
|
||||||
|
distributionId: string
|
||||||
|
): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const res = await cf.getDistributionConfig({ Id: distributionId }).promise();
|
const res = await cf.getDistributionConfig({ Id: distributionId }).promise();
|
||||||
|
|
||||||
|
|
|
||||||
6
packages/aws-cloudfront/types.d.ts
vendored
6
packages/aws-cloudfront/types.d.ts
vendored
|
|
@ -23,12 +23,6 @@ type Origin = {
|
||||||
pathPatterns?: Record<string, PathPatternConfig>;
|
pathPatterns?: Record<string, PathPatternConfig>;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Credentials = {
|
|
||||||
accessKeyId: string;
|
|
||||||
secretAccessKey: string;
|
|
||||||
sessionToken?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Forward = {
|
type Forward = {
|
||||||
cookies?: string[];
|
cookies?: string[];
|
||||||
queryString?: string;
|
queryString?: string;
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ at-least-node@^1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
|
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
|
||||||
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
|
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
|
||||||
|
|
||||||
aws-sdk@^2.709.0:
|
aws-sdk@^2.712.0:
|
||||||
version "2.709.0"
|
version "2.712.0"
|
||||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.709.0.tgz#33b0c0fe8b9420c65610545394be047ac2d93c8f"
|
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.712.0.tgz#828d6ef7556f4b5098c880469ff72195a83f9d66"
|
||||||
integrity sha512-F3sKXsCiutj9RglVXdqb/XJ3Ko3G+pX081Nf1YjVJpLydwE2v16FGxrLqE5pqyWMDeUf5nZHnBoMuOYD8ip+Kw==
|
integrity sha512-C3SLWanFydoWJwtKNi73BG9uB6UzrUuECaAiplOEVBltO/R4sBsHWhwTBuxS02eTNdRrgulu19bJ5RWt+OuXiA==
|
||||||
dependencies:
|
dependencies:
|
||||||
buffer "4.9.2"
|
buffer "4.9.2"
|
||||||
events "1.1.1"
|
events "1.1.1"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import fse from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { mockDomain } from '@next-deploy/aws-domain';
|
import { mockDomain } from '@next-deploy/aws-domain';
|
||||||
import { mockS3 } from '@serverless/aws-s3';
|
import { mockS3 } from '@next-deploy/aws-s3';
|
||||||
import { mockUpload } from 'aws-sdk';
|
import { mockUpload } from 'aws-sdk';
|
||||||
import { mockLambda, mockLambdaPublish } from '@next-deploy/aws-lambda';
|
import { mockLambda, mockLambdaPublish } from '@next-deploy/aws-lambda';
|
||||||
import { mockCloudFront } from '@next-deploy/aws-cloudfront';
|
import { mockCloudFront } from '@next-deploy/aws-cloudfront';
|
||||||
|
|
@ -464,7 +464,7 @@ describe('Custom inputs', () => {
|
||||||
[undefined, {}],
|
[undefined, {}],
|
||||||
// empty input
|
// empty input
|
||||||
[{}, {}],
|
[{}, {}],
|
||||||
// ignores origin-request and origin-response triggers as they're reserved by serverless-next.js
|
// ignores origin-request and origin-response triggers as they're reserved by us
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
defaults: {
|
defaults: {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import fse from 'fs-extra';
|
import fse from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
const BUILD_DIR = '.serverless_nextjs';
|
import { BUILD_DIR } from '../src/component';
|
||||||
|
|
||||||
export const cleanupFixtureDirectory = (fixtureDir: string) => (): Promise<void> => {
|
export const cleanupFixtureDirectory = (fixtureDir: string) => (): Promise<void> => {
|
||||||
return fse.remove(path.join(fixtureDir, BUILD_DIR));
|
return fse.remove(path.join(fixtureDir, BUILD_DIR));
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,12 @@
|
||||||
"build": "tsc -p tsconfig.build.json"
|
"build": "tsc -p tsconfig.build.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@serverless/aws-s3": "^4.2.0",
|
|
||||||
"@serverless/core": "^1.1.2",
|
"@serverless/core": "^1.1.2",
|
||||||
"@next-deploy/aws-cloudfront": "link:../aws-cloudfront",
|
"@next-deploy/aws-cloudfront": "link:../aws-cloudfront",
|
||||||
"@next-deploy/aws-domain": "link:../aws-domain",
|
"@next-deploy/aws-domain": "link:../aws-domain",
|
||||||
"@next-deploy/aws-lambda": "link:../aws-lambda",
|
"@next-deploy/aws-lambda": "link:../aws-lambda",
|
||||||
"@next-deploy/aws-lambda-builder": "link:../aws-lambda-builder",
|
"@next-deploy/aws-lambda-builder": "link:../aws-lambda-builder",
|
||||||
"@next-deploy/aws-s3-utils": "link:../aws-s3-utils",
|
"@next-deploy/aws-s3": "link:../aws-s3",
|
||||||
"fs-extra": "^9.0.1"
|
"fs-extra": "^9.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { exists, readJSON } from 'fs-extra';
|
||||||
import { resolve, join } from 'path';
|
import { resolve, join } from 'path';
|
||||||
|
|
||||||
import Builder from '@next-deploy/aws-lambda-builder';
|
import Builder from '@next-deploy/aws-lambda-builder';
|
||||||
import { uploadStaticAssets } from '@next-deploy/aws-s3-utils';
|
import { uploadStaticAssets } from '@next-deploy/aws-s3';
|
||||||
import AwsCloudFront from '@next-deploy/aws-cloudfront';
|
import AwsCloudFront from '@next-deploy/aws-cloudfront';
|
||||||
import { getDomains } from './utils';
|
import { getDomains } from './utils';
|
||||||
import {
|
import {
|
||||||
|
|
@ -14,8 +14,9 @@ import { PathPatternConfig } from '@next-deploy/aws-cloudfront/types';
|
||||||
import { Origin } from '@next-deploy/aws-cloudfront/types';
|
import { Origin } from '@next-deploy/aws-cloudfront/types';
|
||||||
import { BuildOptions, AwsComponentInputs, LambdaType, LambdaInput } from '../types';
|
import { BuildOptions, AwsComponentInputs, LambdaType, LambdaInput } from '../types';
|
||||||
|
|
||||||
export const DEFAULT_LAMBDA_CODE_DIR = '.serverless_nextjs/default-lambda';
|
export const BUILD_DIR = '.next-deploy-tmp';
|
||||||
export const API_LAMBDA_CODE_DIR = '.serverless_nextjs/api-lambda';
|
export const DEFAULT_LAMBDA_CODE_DIR = '.next-deploy-tmp/default-lambda';
|
||||||
|
export const API_LAMBDA_CODE_DIR = '.next-deploy-tmp/api-lambda';
|
||||||
|
|
||||||
class AwsComponent extends Component {
|
class AwsComponent extends Component {
|
||||||
async default(
|
async default(
|
||||||
|
|
@ -33,7 +34,7 @@ class AwsComponent extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
readDefaultBuildManifest(nextConfigPath: string): Promise<BuildManifest> {
|
readDefaultBuildManifest(nextConfigPath: string): Promise<BuildManifest> {
|
||||||
return readJSON(join(nextConfigPath, '.serverless_nextjs/default-lambda/manifest.json'));
|
return readJSON(join(nextConfigPath, `${DEFAULT_LAMBDA_CODE_DIR}/manifest.json`));
|
||||||
}
|
}
|
||||||
|
|
||||||
validatePathPatterns(pathPatterns: string[], buildManifest: BuildManifest): void {
|
validatePathPatterns(pathPatterns: string[], buildManifest: BuildManifest): void {
|
||||||
|
|
@ -117,7 +118,7 @@ class AwsComponent extends Component {
|
||||||
async readApiBuildManifest(
|
async readApiBuildManifest(
|
||||||
nextConfigPath: string
|
nextConfigPath: string
|
||||||
): Promise<undefined | OriginRequestApiHandlerManifest> {
|
): Promise<undefined | OriginRequestApiHandlerManifest> {
|
||||||
const path = join(nextConfigPath, '.serverless_nextjs/api-lambda/manifest.json');
|
const path = join(nextConfigPath, `${API_LAMBDA_CODE_DIR}/manifest.json`);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return (await exists(path)) ? readJSON(path) : Promise.resolve(undefined);
|
return (await exists(path)) ? readJSON(path) : Promise.resolve(undefined);
|
||||||
|
|
@ -138,7 +139,7 @@ class AwsComponent extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (buildConfig.enabled) {
|
if (buildConfig.enabled) {
|
||||||
const builder = new Builder(nextConfigPath, join(nextConfigPath, '.serverless_nextjs'), {
|
const builder = new Builder(nextConfigPath, join(nextConfigPath, BUILD_DIR), {
|
||||||
cmd: buildConfig.cmd,
|
cmd: buildConfig.cmd,
|
||||||
cwd: buildConfig.cwd,
|
cwd: buildConfig.cwd,
|
||||||
args: buildConfig.args,
|
args: buildConfig.args,
|
||||||
|
|
@ -166,7 +167,7 @@ class AwsComponent extends Component {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const [bucket, cloudFront, defaultEdgeLambda, apiEdgeLambda] = await Promise.all([
|
const [bucket, cloudFront, defaultEdgeLambda, apiEdgeLambda] = await Promise.all([
|
||||||
this.load('@serverless/aws-s3'),
|
this.load('@next-deploy/aws-s3'),
|
||||||
this.load('@next-deploy/aws-cloudfront'),
|
this.load('@next-deploy/aws-cloudfront'),
|
||||||
this.load('@next-deploy/aws-lambda', 'defaultEdgeLambda'),
|
this.load('@next-deploy/aws-lambda', 'defaultEdgeLambda'),
|
||||||
this.load('@next-deploy/aws-lambda', 'apiEdgeLambda'),
|
this.load('@next-deploy/aws-lambda', 'apiEdgeLambda'),
|
||||||
|
|
@ -370,7 +371,7 @@ class AwsComponent extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
// make sure that origin-response is not set.
|
// make sure that origin-response is not set.
|
||||||
// this is reserved for serverless-next.js usage
|
// this is reserved for our usage
|
||||||
const defaultLambdaAtEdgeConfig = {
|
const defaultLambdaAtEdgeConfig = {
|
||||||
...(defaultCloudfrontInputs['lambda@edge'] || {}),
|
...(defaultCloudfrontInputs['lambda@edge'] || {}),
|
||||||
};
|
};
|
||||||
|
|
@ -427,7 +428,7 @@ class AwsComponent extends Component {
|
||||||
|
|
||||||
async remove(): Promise<void> {
|
async remove(): Promise<void> {
|
||||||
const [bucket, cloudfront, domain] = await Promise.all([
|
const [bucket, cloudfront, domain] = await Promise.all([
|
||||||
this.load('@serverless/aws-s3'),
|
this.load('@next-deploy/aws-s3'),
|
||||||
this.load('@next-deploy/aws-cloudfront'),
|
this.load('@next-deploy/aws-cloudfront'),
|
||||||
this.load('@next-deploy/aws-domain'),
|
this.load('@next-deploy/aws-domain'),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
2
packages/aws-component/types.d.ts
vendored
2
packages/aws-component/types.d.ts
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
import { PublicDirectoryCache } from '@next-deploy/aws-s3-utils/types';
|
import { PublicDirectoryCache } from '@next-deploy/aws-s3/types';
|
||||||
import { CloudFrontInputs } from '@next-deploy/aws-cloudfront/types';
|
import { CloudFrontInputs } from '@next-deploy/aws-cloudfront/types';
|
||||||
|
|
||||||
type AwsComponentInputs = {
|
type AwsComponentInputs = {
|
||||||
|
|
|
||||||
|
|
@ -1024,7 +1024,7 @@
|
||||||
version "0.0.0"
|
version "0.0.0"
|
||||||
uid ""
|
uid ""
|
||||||
|
|
||||||
"@next-deploy/aws-s3-utils@link:../aws-s3-utils":
|
"@next-deploy/aws-s3@link:../aws-s3":
|
||||||
version "0.0.0"
|
version "0.0.0"
|
||||||
uid ""
|
uid ""
|
||||||
|
|
||||||
|
|
@ -1670,7 +1670,7 @@ atob@^2.1.2:
|
||||||
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
|
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
|
||||||
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
|
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
|
||||||
|
|
||||||
aws-sdk@^2.387.0, aws-sdk@^2.488.0, aws-sdk@^2.709.0:
|
aws-sdk@^2.387.0, aws-sdk@^2.488.0:
|
||||||
version "2.709.0"
|
version "2.709.0"
|
||||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.709.0.tgz#33b0c0fe8b9420c65610545394be047ac2d93c8f"
|
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.709.0.tgz#33b0c0fe8b9420c65610545394be047ac2d93c8f"
|
||||||
integrity sha512-F3sKXsCiutj9RglVXdqb/XJ3Ko3G+pX081Nf1YjVJpLydwE2v16FGxrLqE5pqyWMDeUf5nZHnBoMuOYD8ip+Kw==
|
integrity sha512-F3sKXsCiutj9RglVXdqb/XJ3Ko3G+pX081Nf1YjVJpLydwE2v16FGxrLqE5pqyWMDeUf5nZHnBoMuOYD8ip+Kw==
|
||||||
|
|
@ -1685,6 +1685,21 @@ aws-sdk@^2.387.0, aws-sdk@^2.488.0, aws-sdk@^2.709.0:
|
||||||
uuid "3.3.2"
|
uuid "3.3.2"
|
||||||
xml2js "0.4.19"
|
xml2js "0.4.19"
|
||||||
|
|
||||||
|
aws-sdk@^2.712.0:
|
||||||
|
version "2.712.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.712.0.tgz#828d6ef7556f4b5098c880469ff72195a83f9d66"
|
||||||
|
integrity sha512-C3SLWanFydoWJwtKNi73BG9uB6UzrUuECaAiplOEVBltO/R4sBsHWhwTBuxS02eTNdRrgulu19bJ5RWt+OuXiA==
|
||||||
|
dependencies:
|
||||||
|
buffer "4.9.2"
|
||||||
|
events "1.1.1"
|
||||||
|
ieee754 "1.1.13"
|
||||||
|
jmespath "0.15.0"
|
||||||
|
querystring "0.2.0"
|
||||||
|
sax "1.2.1"
|
||||||
|
url "0.10.3"
|
||||||
|
uuid "3.3.2"
|
||||||
|
xml2js "0.4.19"
|
||||||
|
|
||||||
babel-code-frame@^6.22.0:
|
babel-code-frame@^6.22.0:
|
||||||
version "6.26.0"
|
version "6.26.0"
|
||||||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@serverless/core": "^1.1.2",
|
"@serverless/core": "^1.1.2",
|
||||||
"aws-sdk": "^2.709.0"
|
"aws-sdk": "^2.712.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^3.9.6"
|
"typescript": "^3.9.6"
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
import { AwsDomainInputs } from '../types';
|
import { AwsDomainInputs } from '../types';
|
||||||
|
|
||||||
class DomainComponent extends Component {
|
class DomainComponent extends Component {
|
||||||
async default(inputs: AwsDomainInputs) {
|
async default(inputs: AwsDomainInputs): Promise<{ domains: string[] }> {
|
||||||
this.context.status('Deploying');
|
this.context.status('Deploying');
|
||||||
|
|
||||||
this.context.debug(`Starting Domain component deployment.`);
|
this.context.debug(`Starting Domain component deployment.`);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { Route53, ACM, CloudFront } from 'aws-sdk';
|
import { Route53, ACM, CloudFront, Credentials } from 'aws-sdk';
|
||||||
import { utils } from '@serverless/core';
|
import { utils } from '@serverless/core';
|
||||||
|
|
||||||
import { PathPatternConfig } from '@next-deploy/aws-cloudfront/types';
|
import { PathPatternConfig } from '@next-deploy/aws-cloudfront/types';
|
||||||
import { DomainType } from '@next-deploy/aws-component/types';
|
import { DomainType } from '@next-deploy/aws-component/types';
|
||||||
import { AwsDomainInputs, Credentials, SubDomain } from '../types';
|
import { AwsDomainInputs, SubDomain } from '../types';
|
||||||
|
|
||||||
const DEFAULT_MINIMUM_PROTOCOL_VERSION = 'TLSv1.2_2018';
|
const DEFAULT_MINIMUM_PROTOCOL_VERSION = 'TLSv1.2_2018';
|
||||||
const HOSTED_ZONE_ID = 'Z2FDTNDATAQYW2'; // this is a constant that you can get from here https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html
|
const HOSTED_ZONE_ID = 'Z2FDTNDATAQYW2'; // this is a constant that you can get from here https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html
|
||||||
|
|
@ -12,7 +12,10 @@ const HOSTED_ZONE_ID = 'Z2FDTNDATAQYW2'; // this is a constant that you can get
|
||||||
* Get Clients
|
* Get Clients
|
||||||
* - Gets AWS SDK clients to use within this Component
|
* - Gets AWS SDK clients to use within this Component
|
||||||
*/
|
*/
|
||||||
export const getClients = (credentials: Credentials, region = 'us-east-1') => {
|
export const getClients = (
|
||||||
|
credentials: Credentials,
|
||||||
|
region = 'us-east-1'
|
||||||
|
): { route53: Route53; acm: ACM; cf: CloudFront } => {
|
||||||
const route53 = new Route53({
|
const route53 = new Route53({
|
||||||
credentials,
|
credentials,
|
||||||
region,
|
region,
|
||||||
|
|
@ -143,7 +146,7 @@ export const getCertificateArnByDomain = async (
|
||||||
* Create Certificate
|
* Create Certificate
|
||||||
* - Creates an AWS ACM Certificate for the specified domain
|
* - Creates an AWS ACM Certificate for the specified domain
|
||||||
*/
|
*/
|
||||||
export const createCertificate = async (acm: ACM, domain: string) => {
|
export const createCertificate = async (acm: ACM, domain: string): Promise<string | undefined> => {
|
||||||
const wildcardSubDomain = `*.${domain}`;
|
const wildcardSubDomain = `*.${domain}`;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
|
@ -381,11 +384,7 @@ export const addDomainToCloudfrontDistribution = async (
|
||||||
IfMatch: distributionConfigResponse.ETag,
|
IfMatch: distributionConfigResponse.ETag,
|
||||||
Id: subdomain.distributionId,
|
Id: subdomain.distributionId,
|
||||||
DistributionConfig: {
|
DistributionConfig: {
|
||||||
CallerReference: distributionConfigResponse.DistributionConfig.CallerReference,
|
...distributionConfigResponse.DistributionConfig,
|
||||||
Comment: distributionConfigResponse.DistributionConfig.Comment,
|
|
||||||
DefaultCacheBehavior: distributionConfigResponse.DistributionConfig.DefaultCacheBehavior,
|
|
||||||
Enabled: distributionConfigResponse.DistributionConfig.Enabled,
|
|
||||||
Origins: distributionConfigResponse.DistributionConfig.Origins,
|
|
||||||
Aliases: {
|
Aliases: {
|
||||||
Quantity: 1,
|
Quantity: 1,
|
||||||
Items: [subdomain.domain],
|
Items: [subdomain.domain],
|
||||||
|
|
@ -443,11 +442,7 @@ export const removeDomainFromCloudFrontDistribution = async (
|
||||||
Id: subdomain.distributionId,
|
Id: subdomain.distributionId,
|
||||||
IfMatch: distributionConfigResponse.ETag,
|
IfMatch: distributionConfigResponse.ETag,
|
||||||
DistributionConfig: {
|
DistributionConfig: {
|
||||||
CallerReference: distributionConfigResponse.DistributionConfig.CallerReference,
|
...distributionConfigResponse.DistributionConfig,
|
||||||
Comment: distributionConfigResponse.DistributionConfig.Comment,
|
|
||||||
DefaultCacheBehavior: distributionConfigResponse.DistributionConfig.DefaultCacheBehavior,
|
|
||||||
Enabled: distributionConfigResponse.DistributionConfig.Enabled,
|
|
||||||
Origins: distributionConfigResponse.DistributionConfig.Origins,
|
|
||||||
Aliases: {
|
Aliases: {
|
||||||
Quantity: 0,
|
Quantity: 0,
|
||||||
Items: [],
|
Items: [],
|
||||||
|
|
|
||||||
6
packages/aws-domain/types.d.ts
vendored
6
packages/aws-domain/types.d.ts
vendored
|
|
@ -18,10 +18,4 @@ type SubDomain = {
|
||||||
type: SubDomainType;
|
type: SubDomainType;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Credentials = {
|
|
||||||
accessKeyId: string;
|
|
||||||
secretAccessKey: string;
|
|
||||||
sessionToken?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
type SubDomainType = 'awsCloudFront' | 'awsS3Website' | 'awsApiGateway' | 'awsAppSync';
|
type SubDomainType = 'awsCloudFront' | 'awsS3Website' | 'awsApiGateway' | 'awsAppSync';
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@ argparse@^1.0.7:
|
||||||
dependencies:
|
dependencies:
|
||||||
sprintf-js "~1.0.2"
|
sprintf-js "~1.0.2"
|
||||||
|
|
||||||
aws-sdk@^2.709.0:
|
aws-sdk@^2.712.0:
|
||||||
version "2.709.0"
|
version "2.712.0"
|
||||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.709.0.tgz#33b0c0fe8b9420c65610545394be047ac2d93c8f"
|
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.712.0.tgz#828d6ef7556f4b5098c880469ff72195a83f9d66"
|
||||||
integrity sha512-F3sKXsCiutj9RglVXdqb/XJ3Ko3G+pX081Nf1YjVJpLydwE2v16FGxrLqE5pqyWMDeUf5nZHnBoMuOYD8ip+Kw==
|
integrity sha512-C3SLWanFydoWJwtKNi73BG9uB6UzrUuECaAiplOEVBltO/R4sBsHWhwTBuxS02eTNdRrgulu19bJ5RWt+OuXiA==
|
||||||
dependencies:
|
dependencies:
|
||||||
buffer "4.9.2"
|
buffer "4.9.2"
|
||||||
events "1.1.1"
|
events "1.1.1"
|
||||||
|
|
|
||||||
|
|
@ -141,11 +141,11 @@ class Builder {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
...copyTraces,
|
...copyTraces,
|
||||||
fse.copy(
|
fse.copy(
|
||||||
require.resolve('aws-lambda-builder/dist/default-handler.js'),
|
require.resolve('@next-deploy/aws-lambda-builder/dist/default-handler.js'),
|
||||||
join(this.outputDir, DEFAULT_LAMBDA_CODE_DIR, 'index.js')
|
join(this.outputDir, DEFAULT_LAMBDA_CODE_DIR, 'index.js')
|
||||||
),
|
),
|
||||||
fse.copy(
|
fse.copy(
|
||||||
require.resolve('aws-lambda-builder/dist/compat.js'),
|
require.resolve('@next-deploy/aws-lambda-builder/dist/compat.js'),
|
||||||
join(this.outputDir, DEFAULT_LAMBDA_CODE_DIR, 'compat.js')
|
join(this.outputDir, DEFAULT_LAMBDA_CODE_DIR, 'compat.js')
|
||||||
),
|
),
|
||||||
fse.writeJson(join(this.outputDir, DEFAULT_LAMBDA_CODE_DIR, 'manifest.json'), buildManifest),
|
fse.writeJson(join(this.outputDir, DEFAULT_LAMBDA_CODE_DIR, 'manifest.json'), buildManifest),
|
||||||
|
|
@ -188,11 +188,11 @@ class Builder {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
...copyTraces,
|
...copyTraces,
|
||||||
fse.copy(
|
fse.copy(
|
||||||
require.resolve('aws-lambda-builder/dist/api-handler.js'),
|
require.resolve('@next-deploy/aws-lambda-builder/dist/api-handler.js'),
|
||||||
join(this.outputDir, API_LAMBDA_CODE_DIR, 'index.js')
|
join(this.outputDir, API_LAMBDA_CODE_DIR, 'index.js')
|
||||||
),
|
),
|
||||||
fse.copy(
|
fse.copy(
|
||||||
require.resolve('aws-lambda-builder/dist/compat.js'),
|
require.resolve('@next-deploy/aws-lambda-builder/dist/compat.js'),
|
||||||
join(this.outputDir, API_LAMBDA_CODE_DIR, 'compat.js')
|
join(this.outputDir, API_LAMBDA_CODE_DIR, 'compat.js')
|
||||||
),
|
),
|
||||||
fse.copy(
|
fse.copy(
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
|
|
||||||
import { createComponent, createTmpDir } from './test-utils';
|
import { createComponent, createTmpDir } from './test-utils';
|
||||||
|
|
||||||
jest.mock('aws-sdk', () => require('../__mocks__/aws-sdk.mock'));
|
jest.mock('aws-sdk', () => require('./aws-sdk.mock'));
|
||||||
|
|
||||||
const mockIamRole = jest.fn();
|
const mockIamRole = jest.fn();
|
||||||
jest.mock('@serverless/aws-iam-role', () =>
|
jest.mock('@serverless/aws-iam-role', () =>
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ export const updateLambdaCode = async ({
|
||||||
lambda: Lambda;
|
lambda: Lambda;
|
||||||
name: string;
|
name: string;
|
||||||
zipPath: string;
|
zipPath: string;
|
||||||
bucket: any;
|
bucket: string;
|
||||||
}): Promise<string | undefined> => {
|
}): Promise<string | undefined> => {
|
||||||
const functionCodeParams: Lambda.Types.UpdateFunctionCodeRequest = {
|
const functionCodeParams: Lambda.Types.UpdateFunctionCodeRequest = {
|
||||||
FunctionName: name,
|
FunctionName: name,
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 88 B After Width: | Height: | Size: 88 B |
|
Before Width: | Height: | Size: 88 B After Width: | Height: | Size: 88 B |
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue