@pwrdrvr/microapps-publish 0.3.5-alpha.2 → 0.3.5-alpha.3
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/dist/commands/nextjs-version-restore.d.ts.map +1 -1
- package/dist/commands/nextjs-version-restore.js +2 -1
- package/dist/commands/nextjs-version-restore.js.map +1 -1
- package/dist/commands/nextjs-version.d.ts.map +1 -1
- package/dist/commands/nextjs-version.js +2 -1
- package/dist/commands/nextjs-version.js.map +1 -1
- package/dist/commands/publish-static.js +2 -2
- package/dist/commands/publish-static.js.map +1 -1
- package/dist/commands/publish.d.ts +3 -0
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +82 -22
- package/dist/commands/publish.js.map +1 -1
- package/dist/config/Application.d.ts +0 -8
- package/dist/config/Application.d.ts.map +1 -1
- package/dist/config/Application.js +3 -32
- package/dist/config/Application.js.map +1 -1
- package/dist/lib/DeployClient.d.ts +39 -1
- package/dist/lib/DeployClient.d.ts.map +1 -1
- package/dist/lib/DeployClient.js +87 -4
- package/dist/lib/DeployClient.js.map +1 -1
- package/dist/lib/Versions.d.ts +1 -13
- package/dist/lib/Versions.d.ts.map +1 -1
- package/dist/lib/Versions.js +1 -10
- package/dist/lib/Versions.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/nextjs-version-restore.ts +2 -1
- package/src/commands/nextjs-version.ts +2 -1
- package/src/commands/publish-static.ts +1 -1
- package/src/commands/publish.ts +85 -22
- package/src/commands-deprecated/{nextjs-docker-auto.ts → nextjs-docker-auto.skip} +2 -7
- package/src/config/Application.ts +3 -35
- package/src/lib/DeployClient.ts +130 -5
- package/src/lib/Versions.ts +1 -17
- package/dist/commands-deprecated/nextjs-docker-auto.d.ts +0 -44
- package/dist/commands-deprecated/nextjs-docker-auto.d.ts.map +0 -1
- package/dist/commands-deprecated/nextjs-docker-auto.js +0 -505
- package/dist/commands-deprecated/nextjs-docker-auto.js.map +0 -1
package/dist/lib/DeployClient.js
CHANGED
|
@@ -95,6 +95,49 @@ class DeployClient {
|
|
|
95
95
|
throw new Error(`Lambda call to DeployVersionPreflight failed: ${JSON.stringify(response)}`);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Create or update Lambda alias for specified Lambda version
|
|
100
|
+
* @param config
|
|
101
|
+
* @param output
|
|
102
|
+
* @returns
|
|
103
|
+
*/
|
|
104
|
+
static async LambdaAlias(opts) {
|
|
105
|
+
const { appName, deployerLambdaName, lambdaVersionArn, overwrite, output, semVer } = opts;
|
|
106
|
+
const request = {
|
|
107
|
+
type: 'lambdaAlias',
|
|
108
|
+
appName,
|
|
109
|
+
semVer,
|
|
110
|
+
lambdaARN: lambdaVersionArn,
|
|
111
|
+
overwrite,
|
|
112
|
+
};
|
|
113
|
+
output(`Creating alias for version ARN: ${lambdaVersionArn}`);
|
|
114
|
+
const response = await this._client.send(new lambda.InvokeCommand({
|
|
115
|
+
FunctionName: deployerLambdaName,
|
|
116
|
+
Payload: Buffer.from(JSON.stringify(request)),
|
|
117
|
+
}));
|
|
118
|
+
if (response.$metadata.httpStatusCode === 200 && response.Payload !== undefined) {
|
|
119
|
+
const dResponse = JSON.parse(Buffer.from(response.Payload).toString('utf-8'));
|
|
120
|
+
if (dResponse.statusCode > 299) {
|
|
121
|
+
output(`LambdaAlias failed: ${JSON.stringify(dResponse)}`);
|
|
122
|
+
throw new Error('LambdaAlias failed');
|
|
123
|
+
}
|
|
124
|
+
else if (!dResponse.functionUrl) {
|
|
125
|
+
output(`LambdaAlias failed to return functionUrl: ${JSON.stringify(dResponse)}`);
|
|
126
|
+
throw new Error('LambdaAlias failed to return functionUrl');
|
|
127
|
+
}
|
|
128
|
+
else if (dResponse.statusCode === 201) {
|
|
129
|
+
output(`Alias created: ${dResponse.lambdaAliasARN}`);
|
|
130
|
+
return { response: dResponse };
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
output(`Alias ${dResponse.actionTaken}: ${dResponse.lambdaAliasARN}`);
|
|
134
|
+
return { response: dResponse };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw new Error(`Lambda call to LambdaAlias failed: ${JSON.stringify(response)}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
98
141
|
/**
|
|
99
142
|
* Copy S3 static assets from staging to live bucket.
|
|
100
143
|
* Create API Gateway Integration for app (if needed).
|
|
@@ -104,14 +147,15 @@ class DeployClient {
|
|
|
104
147
|
* @param task
|
|
105
148
|
*/
|
|
106
149
|
static async DeployVersion(opts) {
|
|
107
|
-
const { appName, semVer, defaultFile, lambdaAliasArn, deployerLambdaName, appType, startupType = 'iframe', overwrite, output, } = opts;
|
|
150
|
+
const { appName, semVer, defaultFile, lambdaAliasArn, deployerLambdaName, appType, startupType = 'iframe', url, overwrite, output, } = opts;
|
|
108
151
|
const request = {
|
|
109
152
|
type: 'deployVersion',
|
|
110
153
|
appType,
|
|
111
154
|
startupType,
|
|
112
|
-
appName
|
|
113
|
-
semVer
|
|
155
|
+
appName,
|
|
156
|
+
semVer,
|
|
114
157
|
defaultFile: defaultFile,
|
|
158
|
+
url,
|
|
115
159
|
overwrite,
|
|
116
160
|
...(['lambda', 'lambda-url'].includes(appType) ? { lambdaARN: lambdaAliasArn } : {}),
|
|
117
161
|
};
|
|
@@ -126,13 +170,52 @@ class DeployClient {
|
|
|
126
170
|
}
|
|
127
171
|
else {
|
|
128
172
|
output(`Deploy failed with: ${dResponse.statusCode}`);
|
|
129
|
-
throw new Error(`Lambda call to
|
|
173
|
+
throw new Error(`Lambda call to DeployVersion failed with: ${dResponse.statusCode}`);
|
|
130
174
|
}
|
|
131
175
|
}
|
|
132
176
|
else {
|
|
133
177
|
throw new Error(`Lambda call to DeployVersion failed: ${JSON.stringify(response)}`);
|
|
134
178
|
}
|
|
135
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Copy S3 static assets from staging to live bucket.
|
|
182
|
+
* Create DB records.
|
|
183
|
+
* Proxied to parent account if needed.
|
|
184
|
+
*
|
|
185
|
+
* @param config
|
|
186
|
+
* @param task
|
|
187
|
+
*/
|
|
188
|
+
static async DeployVersionLite(opts) {
|
|
189
|
+
const { appName, semVer, defaultFile, lambdaAliasArn, deployerLambdaName, appType, startupType = 'iframe', url, overwrite, output, } = opts;
|
|
190
|
+
const request = {
|
|
191
|
+
type: 'deployVersionLite',
|
|
192
|
+
appType,
|
|
193
|
+
startupType,
|
|
194
|
+
appName,
|
|
195
|
+
semVer,
|
|
196
|
+
defaultFile: defaultFile,
|
|
197
|
+
url,
|
|
198
|
+
overwrite,
|
|
199
|
+
...(['lambda', 'lambda-url'].includes(appType) ? { lambdaARN: lambdaAliasArn } : {}),
|
|
200
|
+
};
|
|
201
|
+
const response = await this._client.send(new lambda.InvokeCommand({
|
|
202
|
+
FunctionName: deployerLambdaName,
|
|
203
|
+
Payload: Buffer.from(JSON.stringify(request)),
|
|
204
|
+
}));
|
|
205
|
+
if (response.$metadata.httpStatusCode === 200 && response.Payload !== undefined) {
|
|
206
|
+
const dResponse = JSON.parse(Buffer.from(response.Payload).toString('utf-8'));
|
|
207
|
+
if (dResponse.statusCode === 201) {
|
|
208
|
+
output(`Deploy succeeded: ${appName}/${semVer}`);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
output(`Deploy failed with: ${dResponse.statusCode}`);
|
|
212
|
+
throw new Error(`Lambda call to DeployVersionLite failed with: ${dResponse.statusCode}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
throw new Error(`Lambda call to DeployVersionLite failed: ${JSON.stringify(response)}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
136
219
|
}
|
|
137
220
|
exports.default = DeployClient;
|
|
138
221
|
DeployClient._client = new lambda.LambdaClient({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployClient.js","sourceRoot":"","sources":["../../src/lib/DeployClient.ts"],"names":[],"mappings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5
|
-
version: string;
|
|
6
|
-
alias?: string;
|
|
7
|
-
}
|
|
1
|
+
import { IVersions } from '@pwrdrvr/microapps-deployer-lib';
|
|
8
2
|
/**
|
|
9
3
|
* Represents a File To Modify
|
|
10
4
|
*/
|
|
@@ -12,12 +6,6 @@ export interface IFileToModify {
|
|
|
12
6
|
path: string;
|
|
13
7
|
versions: IVersions;
|
|
14
8
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Setup version and alias strings
|
|
17
|
-
* @param version
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
export declare function createVersions(version: string): IVersions;
|
|
21
9
|
/**
|
|
22
10
|
* Write new versions into specified config file
|
|
23
11
|
* @param path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Versions.d.ts","sourceRoot":"","sources":["../../src/lib/Versions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Versions.d.ts","sourceRoot":"","sources":["../../src/lib/Versions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAOD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,SAAS,EAC3B,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,OAAO,CAAC,CAoClB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhF"}
|
package/dist/lib/Versions.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.restoreFiles = exports.writeNewVersions =
|
|
3
|
+
exports.restoreFiles = exports.writeNewVersions = void 0;
|
|
4
4
|
const fs_extra_1 = require("fs-extra");
|
|
5
5
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
|
6
6
|
function escapeRegExp(value) {
|
|
7
7
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Setup version and alias strings
|
|
11
|
-
* @param version
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
function createVersions(version) {
|
|
15
|
-
return { version, alias: `v${version.replace(/\./g, '_')}` };
|
|
16
|
-
}
|
|
17
|
-
exports.createVersions = createVersions;
|
|
18
9
|
/**
|
|
19
10
|
* Write new versions into specified config file
|
|
20
11
|
* @param path
|
package/dist/lib/Versions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Versions.js","sourceRoot":"","sources":["../../src/lib/Versions.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;
|
|
1
|
+
{"version":3,"file":"Versions.js","sourceRoot":"","sources":["../../src/lib/Versions.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAW1C,6FAA6F;AAC7F,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC,oCAAoC;AAC3F,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,gBAAgB,CACpC,IAAY,EACZ,gBAA2B,EAC3B,UAAmB;IAEnB,MAAM,KAAK,GAAG,MAAM,mBAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QACjB,OAAO,KAAK,CAAC;KACd;IAED,4BAA4B;IAC5B,MAAM,mBAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAI,WAAW,CAAC,CAAC;IAE5C,8DAA8D;IAC9D,IAAI,QAAQ,GAAG,MAAM,mBAAE,CAAC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;gBAEnC,8BAA8B;gBAC9B,MAAM,mBAAE,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;aACrE;SACF;QAAC,WAAM;YACN,+DAA+D;SAChE;KACF;AACH,CAAC;AAhBD,oCAgBC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Command, flags as flagsParser } from '@oclif/command';
|
|
3
3
|
import { Listr } from 'listr2';
|
|
4
|
-
import { createVersions, IVersions
|
|
4
|
+
import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib';
|
|
5
|
+
import { restoreFiles } from '../lib/Versions';
|
|
5
6
|
|
|
6
7
|
export class NextJSVersionRestoreCommand extends Command {
|
|
7
8
|
static description = 'Restore next.config.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Command, flags as flagsParser } from '@oclif/command';
|
|
3
3
|
import { Listr } from 'listr2';
|
|
4
|
+
import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib';
|
|
4
5
|
import { Config } from '../config/Config';
|
|
5
|
-
import {
|
|
6
|
+
import { restoreFiles, writeNewVersions } from '../lib/Versions';
|
|
6
7
|
|
|
7
8
|
export class NextJSVersionCommand extends Command {
|
|
8
9
|
static description = 'Apply version to next.config.js overtop of 0.0.0 placeholder';
|
|
@@ -5,13 +5,13 @@ import { Command, flags as flagsParser } from '@oclif/command';
|
|
|
5
5
|
import * as path from 'path';
|
|
6
6
|
import { pathExists, createReadStream } from 'fs-extra';
|
|
7
7
|
import { Listr, ListrTask } from 'listr2';
|
|
8
|
+
import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib';
|
|
8
9
|
import { Config } from '../config/Config';
|
|
9
10
|
import DeployClient, { IDeployVersionPreflightResult } from '../lib/DeployClient';
|
|
10
11
|
import S3Uploader from '../lib/S3Uploader';
|
|
11
12
|
import S3TransferUtility from '../lib/S3TransferUtility';
|
|
12
13
|
import { Upload } from '@aws-sdk/lib-storage';
|
|
13
14
|
import { contentType } from 'mime-types';
|
|
14
|
-
import { createVersions, IVersions } from '../lib/Versions';
|
|
15
15
|
|
|
16
16
|
interface IContext {
|
|
17
17
|
preflightResult: IDeployVersionPreflightResult;
|
package/src/commands/publish.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Command, flags as flagsParser } from '@oclif/command';
|
|
|
7
7
|
import * as path from 'path';
|
|
8
8
|
import { pathExists, createReadStream } from 'fs-extra';
|
|
9
9
|
import { Listr, ListrTask } from 'listr2';
|
|
10
|
+
import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib';
|
|
10
11
|
import { Config, IConfig } from '../config/Config';
|
|
11
12
|
import DeployClient, { IDeployVersionPreflightResult } from '../lib/DeployClient';
|
|
12
13
|
import S3Uploader from '../lib/S3Uploader';
|
|
@@ -15,13 +16,14 @@ import { Upload } from '@aws-sdk/lib-storage';
|
|
|
15
16
|
import { contentType } from 'mime-types';
|
|
16
17
|
import { TaskWrapper } from 'listr2/dist/lib/task-wrapper';
|
|
17
18
|
import { DefaultRenderer } from 'listr2/dist/renderer/default.renderer';
|
|
18
|
-
import { createVersions, IVersions } from '../lib/Versions';
|
|
19
19
|
const asyncSetTimeout = util.promisify(setTimeout);
|
|
20
20
|
|
|
21
21
|
const lambdaClient = new lambda.LambdaClient({
|
|
22
22
|
maxAttempts: 8,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
type DeployVersionArgs = Parameters<typeof DeployClient.DeployVersionLite>[0];
|
|
26
|
+
|
|
25
27
|
interface IContext {
|
|
26
28
|
preflightResult: IDeployVersionPreflightResult;
|
|
27
29
|
files: string[];
|
|
@@ -35,6 +37,11 @@ interface IContext {
|
|
|
35
37
|
* The ARN of the Lambda alias to use for the deploy
|
|
36
38
|
*/
|
|
37
39
|
lambdaAliasArn: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Lambda Function URL returned by `LambdaAlias` for lambda-url type
|
|
43
|
+
*/
|
|
44
|
+
lambdaUrl: string;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
export class PublishCommand extends Command {
|
|
@@ -81,7 +88,7 @@ export class PublishCommand extends Command {
|
|
|
81
88
|
char: 'a',
|
|
82
89
|
multiple: false,
|
|
83
90
|
required: false,
|
|
84
|
-
description: 'MicroApps app name',
|
|
91
|
+
description: 'MicroApps app name (this becomes the path the app is rooted at)',
|
|
85
92
|
}),
|
|
86
93
|
staticAssetsPath: flagsParser.string({
|
|
87
94
|
char: 's',
|
|
@@ -120,10 +127,16 @@ export class PublishCommand extends Command {
|
|
|
120
127
|
char: 't',
|
|
121
128
|
multiple: false,
|
|
122
129
|
required: false,
|
|
123
|
-
options: ['apigwy', 'lambda-url'],
|
|
124
|
-
default: '
|
|
130
|
+
options: ['apigwy', 'lambda-url', 'url', 'static'],
|
|
131
|
+
default: 'lambda-url',
|
|
125
132
|
description: 'Type of the application and how its requests are routed',
|
|
126
133
|
}),
|
|
134
|
+
url: flagsParser.string({
|
|
135
|
+
char: 'u',
|
|
136
|
+
multiple: false,
|
|
137
|
+
required: false,
|
|
138
|
+
description: 'URL for `url` type applications',
|
|
139
|
+
}),
|
|
127
140
|
};
|
|
128
141
|
|
|
129
142
|
private VersionAndAlias: IVersions;
|
|
@@ -181,7 +194,7 @@ export class PublishCommand extends Command {
|
|
|
181
194
|
const tasks = new Listr<IContext>(
|
|
182
195
|
[
|
|
183
196
|
{
|
|
184
|
-
|
|
197
|
+
enabled: () => !!config.app.staticAssetsPath,
|
|
185
198
|
title: 'Confirm Static Assets Folder Exists',
|
|
186
199
|
task: async (ctx, task) => {
|
|
187
200
|
const origTitle = task.title;
|
|
@@ -196,8 +209,7 @@ export class PublishCommand extends Command {
|
|
|
196
209
|
},
|
|
197
210
|
},
|
|
198
211
|
{
|
|
199
|
-
|
|
200
|
-
title: 'Get S3 Temp Credentials',
|
|
212
|
+
title: 'Preflight Request / Get S3 Temp Credentials',
|
|
201
213
|
task: async (ctx, task) => {
|
|
202
214
|
const origTitle = task.title;
|
|
203
215
|
task.title = RUNNING + origTitle;
|
|
@@ -223,10 +235,11 @@ export class PublishCommand extends Command {
|
|
|
223
235
|
},
|
|
224
236
|
},
|
|
225
237
|
{
|
|
226
|
-
|
|
238
|
+
enabled: () => !!appLambdaName,
|
|
239
|
+
title: 'Check if Lambda ARN has Alias or Version',
|
|
227
240
|
task: (ctx, task) => {
|
|
228
241
|
if (appLambdaName.match(/:/g)?.length === 7) {
|
|
229
|
-
if (/^[0-9]
|
|
242
|
+
if (/^[0-9]+$/.test(appLambdaName.substring(appLambdaName.lastIndexOf(':') + 1))) {
|
|
230
243
|
ctx.configLambdaArnType = 'version';
|
|
231
244
|
task.output = `Lambda ARN has Version: ${config.app.lambdaName}`;
|
|
232
245
|
} else {
|
|
@@ -240,10 +253,48 @@ export class PublishCommand extends Command {
|
|
|
240
253
|
}
|
|
241
254
|
},
|
|
242
255
|
},
|
|
256
|
+
// {
|
|
257
|
+
// enabled: (ctx) =>
|
|
258
|
+
// ctx.configLambdaArnType === 'function' &&
|
|
259
|
+
// ctx.preflightResult.response.capabilities?.['createAlias'] === 'true',
|
|
260
|
+
// title: 'Reject Remove Version Creation if Lambda ARN is Function',
|
|
261
|
+
// task: (ctx, task) => {
|
|
262
|
+
// this.error(
|
|
263
|
+
// `Lambda ARN is a Function, cannot create a version remotely, pass a Lambda ARN with a version: ${config.app.lambdaName}`,
|
|
264
|
+
// );
|
|
265
|
+
// },
|
|
266
|
+
// },
|
|
243
267
|
{
|
|
244
268
|
enabled: (ctx) =>
|
|
245
|
-
|
|
246
|
-
|
|
269
|
+
['version', 'function'].includes(ctx.configLambdaArnType) &&
|
|
270
|
+
// If the deployer service can create aliases, let it
|
|
271
|
+
ctx.preflightResult.response.capabilities?.createAlias === 'true',
|
|
272
|
+
title: 'Remotely Create Lambda Alias and, optionally, Version',
|
|
273
|
+
task: async (ctx, task) => {
|
|
274
|
+
const origTitle = task.title;
|
|
275
|
+
task.title = RUNNING + origTitle;
|
|
276
|
+
|
|
277
|
+
task.output = `Create or update alias ${config.app.name}/${semVer}`;
|
|
278
|
+
const { response } = await DeployClient.LambdaAlias({
|
|
279
|
+
appName: config.app.name,
|
|
280
|
+
semVer: config.app.semVer,
|
|
281
|
+
deployerLambdaName: config.deployer.lambdaName,
|
|
282
|
+
lambdaVersionArn: config.app.lambdaName,
|
|
283
|
+
overwrite,
|
|
284
|
+
output: (message: string) => (task.output = message),
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
ctx.lambdaAliasArn = response.lambdaAliasARN;
|
|
288
|
+
ctx.lambdaUrl = response.functionUrl;
|
|
289
|
+
task.title = origTitle;
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
enabled: (ctx) =>
|
|
294
|
+
['function', 'version'].includes(ctx.configLambdaArnType) &&
|
|
295
|
+
// If the deployer service can create aliases, let it
|
|
296
|
+
ctx.preflightResult.response.capabilities?.['createAlias'] !== 'true',
|
|
297
|
+
title: 'Locally Create Lambda Alias and, optionally, Version',
|
|
247
298
|
task: async (ctx, task) => {
|
|
248
299
|
// Allow overwriting a non-overwritable app if the prior
|
|
249
300
|
// publish was not completely successful - in that case
|
|
@@ -265,7 +316,7 @@ export class PublishCommand extends Command {
|
|
|
265
316
|
},
|
|
266
317
|
},
|
|
267
318
|
{
|
|
268
|
-
|
|
319
|
+
enabled: () => !!config.app.staticAssetsPath,
|
|
269
320
|
title: 'Copy Static Files to Local Upload Dir',
|
|
270
321
|
task: async (ctx, task) => {
|
|
271
322
|
const origTitle = task.title;
|
|
@@ -278,7 +329,7 @@ export class PublishCommand extends Command {
|
|
|
278
329
|
},
|
|
279
330
|
},
|
|
280
331
|
{
|
|
281
|
-
|
|
332
|
+
enabled: () => !!config.app.staticAssetsPath,
|
|
282
333
|
title: 'Enumerate Files to Upload to S3',
|
|
283
334
|
task: async (ctx, task) => {
|
|
284
335
|
const origTitle = task.title;
|
|
@@ -290,7 +341,7 @@ export class PublishCommand extends Command {
|
|
|
290
341
|
},
|
|
291
342
|
},
|
|
292
343
|
{
|
|
293
|
-
|
|
344
|
+
enabled: () => !!config.app.staticAssetsPath,
|
|
294
345
|
title: 'Upload Static Files to S3',
|
|
295
346
|
task: (ctx, task) => {
|
|
296
347
|
const origTitle = task.title;
|
|
@@ -376,25 +427,35 @@ export class PublishCommand extends Command {
|
|
|
376
427
|
const origTitle = task.title;
|
|
377
428
|
task.title = RUNNING + origTitle;
|
|
378
429
|
|
|
379
|
-
const appType =
|
|
430
|
+
const appType: 'lambda' | 'lambda-url' | 'static' | 'url' =
|
|
380
431
|
parsedFlags.type === 'apigwy'
|
|
381
432
|
? 'lambda'
|
|
382
|
-
: parsedFlags.type
|
|
383
|
-
? 'lambda-url'
|
|
384
|
-
: 'url';
|
|
433
|
+
: (parsedFlags.type as 'lambda-url' | 'static' | 'url');
|
|
385
434
|
|
|
386
|
-
|
|
387
|
-
await DeployClient.DeployVersion({
|
|
435
|
+
const request: DeployVersionArgs = {
|
|
388
436
|
appName: config.app.name,
|
|
389
437
|
semVer: config.app.semVer,
|
|
390
438
|
deployerLambdaName: config.deployer.lambdaName,
|
|
391
439
|
lambdaAliasArn: ctx.lambdaAliasArn,
|
|
392
440
|
defaultFile: config.app.defaultFile,
|
|
393
441
|
appType,
|
|
394
|
-
|
|
442
|
+
url: ctx.lambdaUrl ?? parsedFlags.url,
|
|
443
|
+
...(['lambda', 'lambda-url', 'static'].includes(appType)
|
|
444
|
+
? { startupType: parsedFlags['startup-type'] as 'iframe' | 'direct' }
|
|
445
|
+
: { startupType: 'direct' }),
|
|
395
446
|
overwrite,
|
|
396
447
|
output: (message: string) => (task.output = message),
|
|
397
|
-
}
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
// Use DeployVersionLite if createAlias is supported
|
|
451
|
+
if (ctx.preflightResult.response.capabilities?.['createAlias'] === 'true') {
|
|
452
|
+
task.output = 'Using DeployVersionLite';
|
|
453
|
+
await DeployClient.DeployVersionLite(request);
|
|
454
|
+
} else {
|
|
455
|
+
// Use legacy DeployVersion if createAlias is not supported
|
|
456
|
+
task.output = 'Using DeployVersion';
|
|
457
|
+
await DeployClient.DeployVersion(request);
|
|
458
|
+
}
|
|
398
459
|
|
|
399
460
|
task.title = origTitle;
|
|
400
461
|
},
|
|
@@ -416,8 +477,10 @@ export class PublishCommand extends Command {
|
|
|
416
477
|
|
|
417
478
|
/**
|
|
418
479
|
* Publish an app version to Lambda
|
|
480
|
+
*
|
|
419
481
|
* @param config
|
|
420
482
|
* @param versions
|
|
483
|
+
* @deprecated 2023-01-16 - The deployer svc now creates the alias and, optionally, the version
|
|
421
484
|
*/
|
|
422
485
|
private async deployToLambda(opts: {
|
|
423
486
|
config: IConfig;
|
|
@@ -13,16 +13,11 @@ import DeployClient, { IDeployVersionPreflightResult } from '../lib/DeployClient
|
|
|
13
13
|
import S3Uploader from '../lib/S3Uploader';
|
|
14
14
|
import S3TransferUtility from '../lib/S3TransferUtility';
|
|
15
15
|
import { Upload } from '@aws-sdk/lib-storage';
|
|
16
|
+
import { createVersions, IVersions } from '@pwrdrvr/microapps-deployer-lib';
|
|
16
17
|
import { contentType } from 'mime-types';
|
|
17
18
|
import { TaskWrapper } from 'listr2/dist/lib/task-wrapper';
|
|
18
19
|
import { DefaultRenderer } from 'listr2/dist/renderer/default.renderer';
|
|
19
|
-
import {
|
|
20
|
-
createVersions,
|
|
21
|
-
IFileToModify,
|
|
22
|
-
IVersions,
|
|
23
|
-
restoreFiles,
|
|
24
|
-
writeNewVersions,
|
|
25
|
-
} from '../lib/Versions';
|
|
20
|
+
import { IFileToModify, restoreFiles, writeNewVersions } from '../lib/Versions';
|
|
26
21
|
const asyncSetTimeout = util.promisify(setTimeout);
|
|
27
22
|
const asyncExec = util.promisify(exec);
|
|
28
23
|
|
|
@@ -11,12 +11,8 @@ export interface IApplicationConfig {
|
|
|
11
11
|
defaultFile: string;
|
|
12
12
|
staticAssetsPath: string;
|
|
13
13
|
lambdaName: string;
|
|
14
|
-
lambdaARN: string;
|
|
15
14
|
awsAccountID: string;
|
|
16
15
|
awsRegion: string;
|
|
17
|
-
serverlessNextRouterPath: string;
|
|
18
|
-
ecrHost: string;
|
|
19
|
-
ecrRepoName: string;
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
@convict.Config({
|
|
@@ -45,7 +41,7 @@ export class ApplicationConfig implements IApplicationConfig {
|
|
|
45
41
|
}
|
|
46
42
|
@convict.Property({
|
|
47
43
|
doc: 'Name of microapps app',
|
|
48
|
-
default: '
|
|
44
|
+
default: '',
|
|
49
45
|
env: 'APP_NAME',
|
|
50
46
|
})
|
|
51
47
|
public set name(value: string) {
|
|
@@ -69,7 +65,7 @@ export class ApplicationConfig implements IApplicationConfig {
|
|
|
69
65
|
private _staticAssetsPath: string;
|
|
70
66
|
@convict.Property({
|
|
71
67
|
doc: 'Local path to static assets path to upload to S3',
|
|
72
|
-
default: '
|
|
68
|
+
default: '',
|
|
73
69
|
env: 'APP_STATIC_ASSETS_PATH',
|
|
74
70
|
})
|
|
75
71
|
public set staticAssetsPath(value: string) {
|
|
@@ -81,17 +77,10 @@ export class ApplicationConfig implements IApplicationConfig {
|
|
|
81
77
|
|
|
82
78
|
@convict.Property({
|
|
83
79
|
doc: 'Name of the lambda to deploy to (not full ARN)',
|
|
84
|
-
default: '
|
|
80
|
+
default: '',
|
|
85
81
|
env: 'APP_LAMBDA_NAME',
|
|
86
82
|
})
|
|
87
83
|
public lambdaName: string;
|
|
88
|
-
public get lambdaARN(): string {
|
|
89
|
-
return this.lambdaName.includes(':')
|
|
90
|
-
? this.lambdaName
|
|
91
|
-
: `arn:aws:lambda:${this.awsRegion}:${this.awsAccountID}:function:${
|
|
92
|
-
this.lambdaName
|
|
93
|
-
}:v${this.semVer.replace(/\./g, '_')}`;
|
|
94
|
-
}
|
|
95
84
|
|
|
96
85
|
@convict.Property({
|
|
97
86
|
doc: 'AWS Account ID to deploy to',
|
|
@@ -106,25 +95,4 @@ export class ApplicationConfig implements IApplicationConfig {
|
|
|
106
95
|
env: 'AWS_REGION',
|
|
107
96
|
})
|
|
108
97
|
public awsRegion: string;
|
|
109
|
-
|
|
110
|
-
@convict.Property({
|
|
111
|
-
doc: 'Path to the serverless-nextjs-router index.js file',
|
|
112
|
-
default: './node_modules/@pwrdrvr/serverless-nextjs-router/lib/index.js',
|
|
113
|
-
env: 'SERVERLESS_NEXTJS_ROUTER_INDEX_JS',
|
|
114
|
-
})
|
|
115
|
-
public serverlessNextRouterPath: string;
|
|
116
|
-
|
|
117
|
-
@convict.Property({
|
|
118
|
-
doc: 'ECR Host for app',
|
|
119
|
-
default: '',
|
|
120
|
-
env: 'APP_ECR_HOST',
|
|
121
|
-
})
|
|
122
|
-
public ecrHost: string;
|
|
123
|
-
|
|
124
|
-
@convict.Property({
|
|
125
|
-
doc: 'ECR Repo Name for app',
|
|
126
|
-
default: '',
|
|
127
|
-
env: 'APP_ECR_REPO_NAME',
|
|
128
|
-
})
|
|
129
|
-
public ecrRepoName: string;
|
|
130
98
|
}
|