@dotcom-tool-kit/serverless 3.2.9 → 3.3.0
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/.toolkitrc.yml +2 -0
- package/lib/schema.d.ts +39 -0
- package/lib/schema.d.ts.map +1 -0
- package/lib/schema.js +29 -0
- package/lib/tasks/deploy.d.ts +2 -1
- package/lib/tasks/deploy.d.ts.map +1 -1
- package/lib/tasks/deploy.js +1 -0
- package/lib/tasks/provision.d.ts +2 -1
- package/lib/tasks/provision.d.ts.map +1 -1
- package/lib/tasks/provision.js +1 -0
- package/lib/tasks/run.d.ts +13 -2
- package/lib/tasks/run.d.ts.map +1 -1
- package/lib/tasks/run.js +16 -0
- package/lib/tasks/teardown.d.ts +2 -1
- package/lib/tasks/teardown.d.ts.map +1 -1
- package/lib/tasks/teardown.js +1 -0
- package/package.json +6 -7
package/.toolkitrc.yml
CHANGED
package/lib/schema.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
declare const _default: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
3
|
+
awsAccountId: z.ZodString;
|
|
4
|
+
systemCode: z.ZodString;
|
|
5
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
8
|
+
awsAccountId: z.ZodString;
|
|
9
|
+
systemCode: z.ZodString;
|
|
10
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
13
|
+
awsAccountId: z.ZodString;
|
|
14
|
+
systemCode: z.ZodString;
|
|
15
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
18
|
+
awsAccountId: z.ZodString;
|
|
19
|
+
systemCode: z.ZodString;
|
|
20
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
21
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
23
|
+
awsAccountId: z.ZodString;
|
|
24
|
+
systemCode: z.ZodString;
|
|
25
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
26
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
28
|
+
awsAccountId: z.ZodString;
|
|
29
|
+
systemCode: z.ZodString;
|
|
30
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
31
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
33
|
+
awsAccountId: z.ZodString;
|
|
34
|
+
systemCode: z.ZodString;
|
|
35
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
36
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
38
|
+
export default _default;
|
|
39
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBxB,wBAqB0D"}
|
package/lib/schema.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const z = tslib_1.__importStar(require("zod"));
|
|
5
|
+
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
6
|
+
const movedPluginOptions = (option, task, newName = option) => [
|
|
7
|
+
(options) => !(option in options),
|
|
8
|
+
{
|
|
9
|
+
message: `the option ${logger_1.styles.code(option)} has moved to ${logger_1.styles.code(`options.tasks.${logger_1.styles.task(task)}.${newName}`)}`
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
exports.default = z
|
|
13
|
+
.object({
|
|
14
|
+
awsAccountId: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe('the ID of the AWS account you wish to deploy to (account IDs can be found at the [FT login page](https://awslogin.in.ft.com/))'),
|
|
17
|
+
systemCode: z.string().describe('the system code for your app'),
|
|
18
|
+
regions: z
|
|
19
|
+
.array(z.string())
|
|
20
|
+
.default(['eu-west-1'])
|
|
21
|
+
.describe('an array of AWS regions you want to deploy to'),
|
|
22
|
+
configPath: z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('path to your serverless config file. If this is not provided, Serverless defaults to `./serverless.yml` but [other config fomats are accepted](https://www.serverless.com/framework/docs/providers/aws/guide/intro#alternative-configuration-format)')
|
|
26
|
+
})
|
|
27
|
+
.passthrough()
|
|
28
|
+
.refine(...movedPluginOptions('useVault', 'ServerlessRun', 'useDoppler'))
|
|
29
|
+
.refine(...movedPluginOptions('ports', 'ServerlessRun'));
|
package/lib/tasks/deploy.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Task, TaskRunContext } from '@dotcom-tool-kit/base';
|
|
2
|
-
import
|
|
2
|
+
import type ServerlessSchema from '../schema';
|
|
3
3
|
export default class ServerlessDeploy extends Task<{
|
|
4
4
|
plugin: typeof ServerlessSchema;
|
|
5
5
|
}> {
|
|
6
|
+
static description: string;
|
|
6
7
|
run({ cwd }: TaskRunContext): Promise<void>;
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/tasks/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/tasks/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAA;AAE7C,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,IAAI,CAAC;IAAE,MAAM,EAAE,OAAO,gBAAgB,CAAA;CAAE,CAAC;IACrF,MAAM,CAAC,WAAW,SAAiC;IAE7C,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA2BlD"}
|
package/lib/tasks/deploy.js
CHANGED
|
@@ -4,6 +4,7 @@ const logger_1 = require("@dotcom-tool-kit/logger");
|
|
|
4
4
|
const base_1 = require("@dotcom-tool-kit/base");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
class ServerlessDeploy extends base_1.Task {
|
|
7
|
+
static description = 'Deploy a serverless function';
|
|
7
8
|
async run({ cwd }) {
|
|
8
9
|
const { configPath, regions, systemCode } = this.pluginOptions;
|
|
9
10
|
for (const region of regions) {
|
package/lib/tasks/provision.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Task, TaskRunContext } from '@dotcom-tool-kit/base';
|
|
2
|
-
import
|
|
2
|
+
import type ServerlessSchema from '../schema';
|
|
3
3
|
export default class ServerlessProvision extends Task<{
|
|
4
4
|
plugin: typeof ServerlessSchema;
|
|
5
5
|
}> {
|
|
6
|
+
static description: string;
|
|
6
7
|
run({ cwd }: TaskRunContext): Promise<void>;
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=provision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provision.d.ts","sourceRoot":"","sources":["../../src/tasks/provision.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"provision.d.ts","sourceRoot":"","sources":["../../src/tasks/provision.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAA;AAE7C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,IAAI,CAAC;IAAE,MAAM,EAAE,OAAO,gBAAgB,CAAA;CAAE,CAAC;IACxF,MAAM,CAAC,WAAW,SAA2C;IAEvD,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAmDlD"}
|
package/lib/tasks/provision.js
CHANGED
|
@@ -6,6 +6,7 @@ const base_1 = require("@dotcom-tool-kit/base");
|
|
|
6
6
|
const child_process_1 = require("child_process");
|
|
7
7
|
const state_1 = require("@dotcom-tool-kit/state");
|
|
8
8
|
class ServerlessProvision extends base_1.Task {
|
|
9
|
+
static description = 'Provision a review serverless function';
|
|
9
10
|
async run({ cwd }) {
|
|
10
11
|
const { configPath, systemCode, regions } = this.pluginOptions;
|
|
11
12
|
const ciState = (0, state_1.readState)('ci');
|
package/lib/tasks/run.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { Task, TaskRunContext } from '@dotcom-tool-kit/base';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import type ServerlessSchema from '../schema';
|
|
3
|
+
import * as z from 'zod';
|
|
4
|
+
declare const ServerlessRunSchema: z.ZodObject<{
|
|
5
|
+
ports: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
|
|
6
|
+
useDoppler: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
useDoppler: boolean;
|
|
9
|
+
ports: number[];
|
|
10
|
+
}, {
|
|
11
|
+
useDoppler?: boolean | undefined;
|
|
12
|
+
ports?: number[] | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export { ServerlessRunSchema as schema };
|
|
4
15
|
export default class ServerlessRun extends Task<{
|
|
5
16
|
task: typeof ServerlessRunSchema;
|
|
6
17
|
plugin: typeof ServerlessSchema;
|
package/lib/tasks/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/tasks/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/tasks/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAA;AAM7C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,QAAA,MAAM,mBAAmB;;;;;;;;;EAYsB,CAAA;AAC/C,OAAO,EAAE,mBAAmB,IAAI,MAAM,EAAE,CAAA;AAExC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,IAAI,CAAC;IAC9C,IAAI,EAAE,OAAO,mBAAmB,CAAA;IAChC,MAAM,EAAE,OAAO,gBAAgB,CAAA;CAChC,CAAC;IACM,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAiD1D"}
|
package/lib/tasks/run.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const base_1 = require("@dotcom-tool-kit/base");
|
|
5
6
|
const child_process_1 = require("child_process");
|
|
@@ -7,6 +8,21 @@ const doppler_1 = require("@dotcom-tool-kit/doppler");
|
|
|
7
8
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
8
9
|
const get_port_1 = tslib_1.__importDefault(require("get-port"));
|
|
9
10
|
const wait_port_1 = tslib_1.__importDefault(require("wait-port"));
|
|
11
|
+
const z = tslib_1.__importStar(require("zod"));
|
|
12
|
+
const ServerlessRunSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
ports: z
|
|
15
|
+
.number()
|
|
16
|
+
.array()
|
|
17
|
+
.default([3001, 3002, 3003])
|
|
18
|
+
.describe('ports to try to bind to for this application'),
|
|
19
|
+
useDoppler: z
|
|
20
|
+
.boolean()
|
|
21
|
+
.default(true)
|
|
22
|
+
.describe('run the application with environment variables from Doppler')
|
|
23
|
+
})
|
|
24
|
+
.describe('Run serverless functions locally');
|
|
25
|
+
exports.schema = ServerlessRunSchema;
|
|
10
26
|
class ServerlessRun extends base_1.Task {
|
|
11
27
|
async run({ cwd, config }) {
|
|
12
28
|
const { useDoppler, ports } = this.options;
|
package/lib/tasks/teardown.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Task, TaskRunContext } from '@dotcom-tool-kit/base';
|
|
2
|
-
import
|
|
2
|
+
import type ServerlessSchema from '../schema';
|
|
3
3
|
export default class ServerlessTeardown extends Task<{
|
|
4
4
|
plugin: typeof ServerlessSchema;
|
|
5
5
|
}> {
|
|
6
|
+
static description: string;
|
|
6
7
|
run({ cwd }: TaskRunContext): Promise<void>;
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=teardown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teardown.d.ts","sourceRoot":"","sources":["../../src/tasks/teardown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"teardown.d.ts","sourceRoot":"","sources":["../../src/tasks/teardown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAA;AAE7C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,IAAI,CAAC;IAAE,MAAM,EAAE,OAAO,gBAAgB,CAAA;CAAE,CAAC;IACvF,MAAM,CAAC,WAAW,SAA4C;IAExD,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAmClD"}
|
package/lib/tasks/teardown.js
CHANGED
|
@@ -6,6 +6,7 @@ const base_1 = require("@dotcom-tool-kit/base");
|
|
|
6
6
|
const state_1 = require("@dotcom-tool-kit/state");
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
class ServerlessTeardown extends base_1.Task {
|
|
9
|
+
static description = 'Tear down existing serverless functions';
|
|
9
10
|
async run({ cwd }) {
|
|
10
11
|
const { configPath, regions, systemCode } = this.pluginOptions;
|
|
11
12
|
const reviewState = (0, state_1.readState)('review');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcom-tool-kit/serverless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "a plugin to manage and deploy apps using AWS Serverless",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"scripts": {
|
|
@@ -25,18 +25,17 @@
|
|
|
25
25
|
"serverless-offline": "^12.0.4"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@dotcom-tool-kit/base": "^1.1.
|
|
29
|
-
"@dotcom-tool-kit/doppler": "^2.
|
|
28
|
+
"@dotcom-tool-kit/base": "^1.1.10",
|
|
29
|
+
"@dotcom-tool-kit/doppler": "^2.2.0",
|
|
30
30
|
"@dotcom-tool-kit/error": "^4.1.0",
|
|
31
|
+
"@dotcom-tool-kit/logger": "^4.1.1",
|
|
31
32
|
"@dotcom-tool-kit/state": "^4.3.1",
|
|
32
33
|
"get-port": "^5.1.1",
|
|
33
34
|
"tslib": "^2.3.1",
|
|
34
|
-
"wait-port": "^0.2.9"
|
|
35
|
+
"wait-port": "^0.2.9",
|
|
36
|
+
"zod": "^3.24.1"
|
|
35
37
|
},
|
|
36
38
|
"engines": {
|
|
37
39
|
"node": "18.x || 20.x || 22.x"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@dotcom-tool-kit/schemas": "^1.9.0"
|
|
41
40
|
}
|
|
42
41
|
}
|