@vyriy/scripts 0.1.9

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vyriy contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # @vyriy/scripts
2
+
3
+ Shared scripts package for Vyriy projects.
4
+
5
+ ## Purpose
6
+
7
+ This package exposes reusable CDK deployment, smoke-test, and e2e script factories used by Vyriy projects.
8
+
9
+ ## Install
10
+
11
+ With npm:
12
+
13
+ ```bash
14
+ npm install @vyriy/scripts
15
+ ```
16
+
17
+ With Yarn:
18
+
19
+ ```bash
20
+ yarn add @vyriy/scripts
21
+ ```
22
+
23
+ ## Exports
24
+
25
+ - `api` for API smoke checks
26
+ - `deploy` for CDK synth, diff, and deploy execution
27
+ - `docker` for Docker image build and push to ECR
28
+ - `e2e` for custom end-to-end scenarios
29
+ - `kaniko` for container build and push with Kaniko
30
+ - `lambda` for Lambda smoke checks
31
+ - `ui` for static UI smoke checks
32
+ - `webhooks` for webhook execution
33
+
34
+ ## Usage
35
+
36
+ Import from the package root:
37
+
38
+ ```ts
39
+ import { api, deploy, docker, e2e, kaniko, lambda, ui, webhooks } from '@vyriy/scripts';
40
+ ```
41
+
42
+ Or use subpath exports:
43
+
44
+ ```ts
45
+ import { api } from '@vyriy/scripts/api';
46
+ import { deploy } from '@vyriy/scripts/deploy';
47
+ import { docker } from '@vyriy/scripts/docker';
48
+ import { e2e } from '@vyriy/scripts/e2e';
49
+ import { kaniko } from '@vyriy/scripts/kaniko';
50
+ import { lambda } from '@vyriy/scripts/lambda';
51
+ import { ui } from '@vyriy/scripts/ui';
52
+ import { webhooks } from '@vyriy/scripts/webhooks';
53
+ ```
54
+
55
+ ## Examples
56
+
57
+ ### API smoke test
58
+
59
+ ```ts
60
+ import { api } from '@vyriy/scripts/api';
61
+
62
+ await api();
63
+ ```
64
+
65
+ ### CDK deployment
66
+
67
+ ```ts
68
+ import { deploy } from '@vyriy/scripts/deploy';
69
+
70
+ await deploy();
71
+ ```
72
+
73
+ ### Docker deployment
74
+
75
+ ```ts
76
+ import { docker } from '@vyriy/scripts/docker';
77
+
78
+ await docker('./apps/api');
79
+ ```
80
+
81
+ ### E2E scenario
82
+
83
+ ```ts
84
+ import { e2e } from '@vyriy/scripts/e2e';
85
+
86
+ await e2e(async (url) => {
87
+ await fetch(`${url}healthcheck`);
88
+ });
89
+ ```
90
+
91
+ ### Kaniko deployment
92
+
93
+ ```ts
94
+ import { kaniko } from '@vyriy/scripts/kaniko';
95
+
96
+ await kaniko('./apps/api');
97
+ ```
98
+
99
+ ### Lambda smoke test
100
+
101
+ ```ts
102
+ import { lambda } from '@vyriy/scripts/lambda';
103
+
104
+ await lambda('my-function');
105
+ ```
106
+
107
+ ### UI smoke test
108
+
109
+ ```ts
110
+ import { ui } from '@vyriy/scripts/ui';
111
+
112
+ await ui();
113
+ await ui('DistributionUrl', false); // skip index.js for HTML-only output
114
+ ```
115
+
116
+ ### Webhook execution
117
+
118
+ ```ts
119
+ import { webhooks } from '@vyriy/scripts/webhooks';
120
+
121
+ await webhooks(['webhooks/build', 'webhooks/deploy']);
122
+ ```
package/api.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const api: (stackApiResource?: string, healthcheckUrl?: string) => import("@vyriy/script").Result;
package/api.js ADDED
@@ -0,0 +1,15 @@
1
+ import { script } from '@vyriy/script';
2
+ import { createLogger } from '@vyriy/logger';
3
+ import { retry } from '@vyriy/retry';
4
+ import { request } from '@vyriy/request';
5
+ import { output } from '@vyriy/cdk';
6
+ export const api = (stackApiResource = 'ApiGatewayUrl', healthcheckUrl = 'healthcheck') => script(async () => {
7
+ const logger = createLogger();
8
+ logger.info('API Smoke testing...');
9
+ const url = output()[stackApiResource];
10
+ logger.info('API url:', url);
11
+ const testingUrl = `${url}${healthcheckUrl}`;
12
+ logger.info(`Testing: ${testingUrl}`);
13
+ await retry(async () => request(testingUrl), { retries: 2, delay: 2000 });
14
+ logger.info('\nAPI Smoke testing finished!');
15
+ });
package/deploy.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const deploy: () => import("@vyriy/script").Result;
package/deploy.js ADDED
@@ -0,0 +1,12 @@
1
+ import { script } from '@vyriy/script';
2
+ import { createLogger } from '@vyriy/logger';
3
+ import { exec } from '@vyriy/exec';
4
+ export const deploy = () => script(async () => {
5
+ const logger = createLogger();
6
+ logger.info('Deploying...');
7
+ await exec('mkdir cdk.out');
8
+ await exec('npx cdk synth > cdk.out/cloudformation.yml');
9
+ await exec('npx aws-cdk diff');
10
+ await exec('npx cdk deploy --outputs-file ./cdk.out/cdk-outputs.json --require-approval never --ci --progress events');
11
+ logger.info('Deploying finished!');
12
+ });
package/docker.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const docker: (path: string, repositoryUri?: string) => import("@vyriy/script").Result;
package/docker.js ADDED
@@ -0,0 +1,17 @@
1
+ import { script } from '@vyriy/script';
2
+ import { createLogger } from '@vyriy/logger';
3
+ import { output } from '@vyriy/cdk';
4
+ import { exec } from '@vyriy/exec';
5
+ export const docker = (path, repositoryUri = 'RepositoryUri') => script(async () => {
6
+ const logger = createLogger();
7
+ logger.info('Docker deploying...');
8
+ const stackInfo = output();
9
+ const region = stackInfo.Region;
10
+ logger.info('Region:', region);
11
+ const repository = stackInfo[repositoryUri];
12
+ logger.info('Repository:', repository);
13
+ const tag = `${repository}:latest`;
14
+ await exec(`aws ecr get-login-password --region ${region} | docker login --username AWS --password-stdin ${repository}`);
15
+ await exec(`docker buildx build --push -t ${tag} -f ${path}/Dockerfile --no-cache ${path}`);
16
+ logger.info('Docker deploying finished!');
17
+ });
package/e2e.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const e2e: (callback: (url: string) => Promise<void>, resourceName?: string) => import("@vyriy/script").Result;
package/e2e.js ADDED
@@ -0,0 +1,11 @@
1
+ import { createLogger } from '@vyriy/logger';
2
+ import { output } from '@vyriy/cdk';
3
+ import { script } from '@vyriy/script';
4
+ export const e2e = (callback, resourceName = 'ApiGatewayUrl') => script(async () => {
5
+ const logger = createLogger();
6
+ logger.info('E2E testing...');
7
+ const apiGatewayUrl = output()[resourceName];
8
+ logger.info('API Gateway url:', apiGatewayUrl);
9
+ await callback(apiGatewayUrl);
10
+ logger.info('E2E testing finished!');
11
+ });
package/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from './api.js';
2
+ export * from './deploy.js';
3
+ export * from './docker.js';
4
+ export * from './e2e.js';
5
+ export * from './kaniko.js';
6
+ export * from './lambda.js';
7
+ export * from './ui.js';
8
+ export * from './webhooks.js';
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export * from './api.js';
2
+ export * from './deploy.js';
3
+ export * from './docker.js';
4
+ export * from './e2e.js';
5
+ export * from './kaniko.js';
6
+ export * from './lambda.js';
7
+ export * from './ui.js';
8
+ export * from './webhooks.js';
package/kaniko.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const kaniko: (path: string, repositoryUri?: string) => import("@vyriy/script").Result;
package/kaniko.js ADDED
@@ -0,0 +1,16 @@
1
+ import { exec } from '@vyriy/exec';
2
+ import { script } from '@vyriy/script';
3
+ import { createLogger } from '@vyriy/logger';
4
+ import { output } from '@vyriy/cdk';
5
+ export const kaniko = (path, repositoryUri = 'RepositoryUri') => script(async () => {
6
+ const logger = createLogger();
7
+ logger.info('Kaniko deploying...');
8
+ const repository = output()[repositoryUri];
9
+ logger.info('Repository:', repository);
10
+ await exec(`/kaniko/executor \
11
+ --context "${path}" \
12
+ --dockerfile "${path}/Dockerfile" \
13
+ --destination "${repository}:latest" \
14
+ --single-snapshot > cdk.out/kaniko.logs.txt`);
15
+ logger.info('Kaniko deploying finished!');
16
+ });
package/lambda.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const lambda: (name: string) => import("@vyriy/script").Result;
package/lambda.js ADDED
@@ -0,0 +1,17 @@
1
+ import { createLogger } from '@vyriy/logger';
2
+ import { script } from '@vyriy/script';
3
+ import { invoke } from '@vyriy/services/lambda';
4
+ import { request, response } from '@vyriy/smoke';
5
+ export const lambda = (name) => script(async () => {
6
+ const logger = createLogger();
7
+ logger.info('Lambda Smoke testing...');
8
+ logger.info('Lambda:', name);
9
+ const res = await invoke(name, JSON.stringify(request));
10
+ logger.info('Response:', res);
11
+ const result = new TextDecoder().decode(res.Payload);
12
+ logger.info('Result:', result);
13
+ if (result !== JSON.stringify(response)) {
14
+ throw new Error('Lambda Smoke testing error!');
15
+ }
16
+ logger.info('Lambda Smoke testing finished!');
17
+ });
package/package.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "@vyriy/scripts",
3
+ "version": "0.1.9",
4
+ "description": "Shared scripts package for Vyriy projects",
5
+ "type": "module",
6
+ "main": "./index.js",
7
+ "dependencies": {
8
+ "@vyriy/cdk": "0.1.9",
9
+ "@vyriy/exec": "0.1.9",
10
+ "@vyriy/logger": "0.1.9",
11
+ "@vyriy/request": "0.1.9",
12
+ "@vyriy/retry": "0.1.9",
13
+ "@vyriy/script": "0.1.9",
14
+ "@vyriy/services": "0.1.9",
15
+ "@vyriy/smoke": "0.1.9"
16
+ },
17
+ "license": "MIT",
18
+ "types": "./index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./index.d.ts",
22
+ "import": "./index.js",
23
+ "default": "./index.js"
24
+ },
25
+ "./api": {
26
+ "types": "./api.d.ts",
27
+ "import": "./api.js",
28
+ "default": "./api.js"
29
+ },
30
+ "./api.js": {
31
+ "types": "./api.d.ts",
32
+ "import": "./api.js",
33
+ "default": "./api.js"
34
+ },
35
+ "./deploy": {
36
+ "types": "./deploy.d.ts",
37
+ "import": "./deploy.js",
38
+ "default": "./deploy.js"
39
+ },
40
+ "./deploy.js": {
41
+ "types": "./deploy.d.ts",
42
+ "import": "./deploy.js",
43
+ "default": "./deploy.js"
44
+ },
45
+ "./docker": {
46
+ "types": "./docker.d.ts",
47
+ "import": "./docker.js",
48
+ "default": "./docker.js"
49
+ },
50
+ "./docker.js": {
51
+ "types": "./docker.d.ts",
52
+ "import": "./docker.js",
53
+ "default": "./docker.js"
54
+ },
55
+ "./e2e": {
56
+ "types": "./e2e.d.ts",
57
+ "import": "./e2e.js",
58
+ "default": "./e2e.js"
59
+ },
60
+ "./e2e.js": {
61
+ "types": "./e2e.d.ts",
62
+ "import": "./e2e.js",
63
+ "default": "./e2e.js"
64
+ },
65
+ "./index": {
66
+ "types": "./index.d.ts",
67
+ "import": "./index.js",
68
+ "default": "./index.js"
69
+ },
70
+ "./index.js": {
71
+ "types": "./index.d.ts",
72
+ "import": "./index.js",
73
+ "default": "./index.js"
74
+ },
75
+ "./kaniko": {
76
+ "types": "./kaniko.d.ts",
77
+ "import": "./kaniko.js",
78
+ "default": "./kaniko.js"
79
+ },
80
+ "./kaniko.js": {
81
+ "types": "./kaniko.d.ts",
82
+ "import": "./kaniko.js",
83
+ "default": "./kaniko.js"
84
+ },
85
+ "./lambda": {
86
+ "types": "./lambda.d.ts",
87
+ "import": "./lambda.js",
88
+ "default": "./lambda.js"
89
+ },
90
+ "./lambda.js": {
91
+ "types": "./lambda.d.ts",
92
+ "import": "./lambda.js",
93
+ "default": "./lambda.js"
94
+ },
95
+ "./ui": {
96
+ "types": "./ui.d.ts",
97
+ "import": "./ui.js",
98
+ "default": "./ui.js"
99
+ },
100
+ "./ui.js": {
101
+ "types": "./ui.d.ts",
102
+ "import": "./ui.js",
103
+ "default": "./ui.js"
104
+ },
105
+ "./webhooks": {
106
+ "types": "./webhooks.d.ts",
107
+ "import": "./webhooks.js",
108
+ "default": "./webhooks.js"
109
+ },
110
+ "./webhooks.js": {
111
+ "types": "./webhooks.d.ts",
112
+ "import": "./webhooks.js",
113
+ "default": "./webhooks.js"
114
+ }
115
+ }
116
+ }
package/ui.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const ui: (resourceName?: string, hasJs?: boolean) => import("@vyriy/script").Result;
package/ui.js ADDED
@@ -0,0 +1,34 @@
1
+ import { createLogger } from '@vyriy/logger';
2
+ import { output } from '@vyriy/cdk';
3
+ import { script } from '@vyriy/script';
4
+ import { request } from '@vyriy/request';
5
+ import { retry } from '@vyriy/retry';
6
+ export const ui = (resourceName = 'DistributionUrl', hasJs = true) => script(async () => {
7
+ const logger = createLogger();
8
+ logger.info('UI Smoke testing...');
9
+ const retryOptions = {
10
+ retries: 2,
11
+ delay: 2000,
12
+ };
13
+ const uiUrl = output()[resourceName];
14
+ logger.info('\nUI domain:', uiUrl);
15
+ await retry(async () => {
16
+ logger.info(`Testing: ${uiUrl}`);
17
+ await request(uiUrl);
18
+ }, retryOptions);
19
+ await retry(async () => {
20
+ logger.info(`Testing: ${uiUrl}index.html`);
21
+ await request(`${uiUrl}index.html`);
22
+ }, retryOptions);
23
+ if (hasJs) {
24
+ await retry(async () => {
25
+ logger.info(`Testing: ${uiUrl}index.js`);
26
+ await request(`${uiUrl}index.js`);
27
+ }, retryOptions);
28
+ }
29
+ await retry(async () => {
30
+ logger.info(`Testing: ${uiUrl}robots.txt`);
31
+ await request(`${uiUrl}robots.txt`);
32
+ }, retryOptions);
33
+ logger.info('UI Smoke testing finished!');
34
+ });
package/webhooks.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const webhooks: (paths?: string[], stackApiResource?: string) => import("@vyriy/script").Result;
package/webhooks.js ADDED
@@ -0,0 +1,21 @@
1
+ import { createLogger } from '@vyriy/logger';
2
+ import { output } from '@vyriy/cdk';
3
+ import { script } from '@vyriy/script';
4
+ import { request } from '@vyriy/request';
5
+ import { retry } from '@vyriy/retry';
6
+ export const webhooks = (paths = [], stackApiResource = 'ApiGatewayUrl') => script(async () => {
7
+ const logger = createLogger();
8
+ logger.info('Webhooks running...');
9
+ const retryOptions = {
10
+ retries: 2,
11
+ delay: 2000,
12
+ };
13
+ const api = output()[stackApiResource];
14
+ logger.info('API url:', api);
15
+ await Promise.all(paths.map((path) => retry(async () => {
16
+ const webhook = `${api}${path}`;
17
+ logger.info(`Running: ${webhook}`);
18
+ await request(webhook);
19
+ }, retryOptions)));
20
+ logger.info('API webhooks running finished!');
21
+ });