@joltdesign/scripts 0.19.3 → 0.21.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/README.md +85 -0
- package/dist/AWSClient.js +102 -0
- package/dist/AWSClient.js.map +1 -0
- package/dist/AWSConsoleUrlGenerator.js +59 -0
- package/dist/AWSConsoleUrlGenerator.js.map +1 -0
- package/dist/Command/AWS.js +354 -25
- package/dist/Command/AWS.js.map +1 -1
- package/dist/Command/Build.js +1 -1
- package/dist/Command/Build.js.map +1 -1
- package/dist/Command/Cache.js +1 -1
- package/dist/Command/Cache.js.map +1 -1
- package/dist/Command/Cmd.js +2 -2
- package/dist/Command/Cmd.js.map +1 -1
- package/dist/Command/Config.js +161 -3
- package/dist/Command/Config.js.map +1 -1
- package/dist/Command/DB.js +34 -19
- package/dist/Command/DB.js.map +1 -1
- package/dist/Command/Docker.js +10 -8
- package/dist/Command/Docker.js.map +1 -1
- package/dist/Command/JoltCommand.js +44 -1
- package/dist/Command/JoltCommand.js.map +1 -1
- package/dist/Command/Nexcess.js +64 -3
- package/dist/Command/Nexcess.js.map +1 -1
- package/dist/Command/Prepare.js +17 -5
- package/dist/Command/Prepare.js.map +1 -1
- package/dist/Command/SSH.js +13 -13
- package/dist/Command/SSH.js.map +1 -1
- package/dist/Command/WP.js +725 -5
- package/dist/Command/WP.js.map +1 -1
- package/dist/Config.js +91 -17
- package/dist/Config.js.map +1 -1
- package/dist/cli.js +12 -4
- package/dist/cli.js.map +1 -1
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/schemas.js +109 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils.js +145 -11
- package/dist/utils.js.map +1 -1
- package/jolt-config.schema.json +308 -0
- package/package.json +25 -10
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { readFile, stat } from 'node:fs/promises';
|
|
2
|
+
import ansis from 'ansis';
|
|
3
|
+
import { camelCase, constantCase } from 'change-case';
|
|
2
4
|
import { execa } from 'execa';
|
|
3
5
|
import realWhich from 'which';
|
|
6
|
+
import { ContainerRuntimeError } from './errors.js';
|
|
4
7
|
export async function fileExists(path) {
|
|
5
8
|
try {
|
|
6
9
|
return (await stat(path)).isFile();
|
|
@@ -18,17 +21,90 @@ export async function directoryExists(path) {
|
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
export function constToCamel(key) {
|
|
21
|
-
|
|
22
|
-
parts = parts.map((x) => x.toLocaleLowerCase().replace(/^./, (y) => y.toLocaleUpperCase()));
|
|
23
|
-
parts[0] = parts[0].toLocaleLowerCase();
|
|
24
|
-
return parts.join('');
|
|
24
|
+
return camelCase(key);
|
|
25
25
|
}
|
|
26
26
|
export function keyToConst(str) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return constantCase(str);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Detects if an error message indicates a container runtime daemon is not running
|
|
31
|
+
* Supports Docker, Podman, and Rancher Desktop
|
|
32
|
+
*/
|
|
33
|
+
function isContainerRuntimeError(errorMessage) {
|
|
34
|
+
const containerRuntimeErrorPatterns = [
|
|
35
|
+
// Docker patterns
|
|
36
|
+
/cannot connect to the docker daemon/i,
|
|
37
|
+
/docker: error during connect/i,
|
|
38
|
+
/is the docker daemon running/i,
|
|
39
|
+
/connection refused.*docker/i,
|
|
40
|
+
/docker desktop is not running/i,
|
|
41
|
+
/error during connect.*docker/i,
|
|
42
|
+
/failed to connect to.*docker/i,
|
|
43
|
+
/dial unix.*docker\.sock.*connection refused/i,
|
|
44
|
+
/connect: no such file or directory.*docker\.sock/i,
|
|
45
|
+
// Podman patterns
|
|
46
|
+
/cannot connect to podman/i,
|
|
47
|
+
/error: unable to connect to podman/i,
|
|
48
|
+
/is the podman service running/i,
|
|
49
|
+
/connection refused.*podman/i,
|
|
50
|
+
/podman desktop is not running/i,
|
|
51
|
+
/unable to connect to podman socket/i,
|
|
52
|
+
/dial unix.*podman\.sock.*connection refused/i,
|
|
53
|
+
/connect: no such file or directory.*podman\.sock/i,
|
|
54
|
+
// Rancher Desktop patterns (uses Docker API but with Rancher-specific paths)
|
|
55
|
+
/rancher desktop is not running/i,
|
|
56
|
+
/connection refused.*rancher/i,
|
|
57
|
+
/dial unix.*rancher.*docker\.sock.*connection refused/i,
|
|
58
|
+
/connect: no such file or directory.*rancher.*docker\.sock/i,
|
|
59
|
+
/dial unix.*\.rd\/.*connection refused/i,
|
|
60
|
+
/connect: no such file or directory.*\.rd\//i,
|
|
61
|
+
];
|
|
62
|
+
return containerRuntimeErrorPatterns.some((pattern) => pattern.test(errorMessage));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Detects the container runtime type from the command and error message
|
|
66
|
+
*/
|
|
67
|
+
function detectContainerRuntime(command, errorMessage) {
|
|
68
|
+
if (command.includes('podman') || /podman/i.test(errorMessage)) {
|
|
69
|
+
return 'podman';
|
|
70
|
+
}
|
|
71
|
+
// Check for Rancher Desktop indicators in the error message
|
|
72
|
+
if (/rancher/i.test(errorMessage) || /\.rd\//i.test(errorMessage)) {
|
|
73
|
+
return 'rancher';
|
|
74
|
+
}
|
|
75
|
+
if (command.includes('docker') || /docker/i.test(errorMessage)) {
|
|
76
|
+
return 'docker';
|
|
77
|
+
}
|
|
78
|
+
return 'unknown';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Creates a user-friendly error message for container runtime issues
|
|
82
|
+
*/
|
|
83
|
+
function createContainerRuntimeErrorMessage(command, originalError) {
|
|
84
|
+
const runtime = detectContainerRuntime(command, originalError);
|
|
85
|
+
let runtimeName;
|
|
86
|
+
let suggestion;
|
|
87
|
+
switch (runtime) {
|
|
88
|
+
case 'podman':
|
|
89
|
+
runtimeName = 'Podman';
|
|
90
|
+
suggestion = 'Please start Podman Desktop or ensure the Podman service is running before retrying.';
|
|
91
|
+
break;
|
|
92
|
+
case 'rancher':
|
|
93
|
+
runtimeName = 'Rancher Desktop';
|
|
94
|
+
suggestion = 'Please start Rancher Desktop or ensure the container runtime is running before retrying.';
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
runtimeName = 'Docker';
|
|
98
|
+
suggestion = 'Please start Docker Desktop or ensure the Docker daemon is running before retrying.';
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
const header = ansis.red(`🐳 ${runtimeName} daemon is not running!`);
|
|
102
|
+
const suggestionText = ansis.yellow(suggestion);
|
|
103
|
+
const details = ansis.gray(`Original error: ${originalError}`);
|
|
104
|
+
return `${header}\n${suggestionText}\n${details}`;
|
|
30
105
|
}
|
|
31
106
|
export async function execC(command, args = [], options = {}) {
|
|
107
|
+
var _a;
|
|
32
108
|
const allOptions = {
|
|
33
109
|
shell: true,
|
|
34
110
|
cleanArgs: true,
|
|
@@ -43,7 +119,29 @@ export async function execC(command, args = [], options = {}) {
|
|
|
43
119
|
if (allOptions.cleanArgs) {
|
|
44
120
|
argsToUse = args.filter((x) => !!x);
|
|
45
121
|
}
|
|
46
|
-
|
|
122
|
+
try {
|
|
123
|
+
return await execa(command, argsToUse, allOptions);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
// Check if this is a container runtime command that failed due to daemon not running
|
|
127
|
+
if (error instanceof Error &&
|
|
128
|
+
'stderr' in error &&
|
|
129
|
+
typeof error.stderr === 'string' &&
|
|
130
|
+
(command.includes('docker') || command.includes('podman'))) {
|
|
131
|
+
const errorMessage = error.stderr || error.message || '';
|
|
132
|
+
if (isContainerRuntimeError(errorMessage)) {
|
|
133
|
+
const friendlyMessage = createContainerRuntimeErrorMessage(command, errorMessage);
|
|
134
|
+
// Write the friendly error to stderr if available
|
|
135
|
+
if ((_a = options.context) === null || _a === void 0 ? void 0 : _a.stderr) {
|
|
136
|
+
options.context.stderr.write(`${friendlyMessage}\n`);
|
|
137
|
+
}
|
|
138
|
+
// Throw a specific ContainerRuntimeError for programmatic handling
|
|
139
|
+
throw new ContainerRuntimeError(friendlyMessage);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Re-throw the original error if it's not a container runtime daemon issue
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
47
145
|
}
|
|
48
146
|
export function delay(ms) {
|
|
49
147
|
return new Promise((res) => setTimeout(res, ms, null));
|
|
@@ -59,13 +157,49 @@ asyncFn) {
|
|
|
59
157
|
const data = await Promise.all(promises);
|
|
60
158
|
return str.replace(replace, () => data.shift() || '');
|
|
61
159
|
}
|
|
160
|
+
// Cache for memoizing which() results since command availability doesn't change during execution
|
|
161
|
+
const whichCache = new Map();
|
|
162
|
+
/**
|
|
163
|
+
* Clear the which() cache - primarily for testing purposes
|
|
164
|
+
*/
|
|
165
|
+
export function clearWhichCache() {
|
|
166
|
+
whichCache.clear();
|
|
167
|
+
}
|
|
62
168
|
export async function which(cmd) {
|
|
169
|
+
var _a;
|
|
170
|
+
// Check cache first
|
|
171
|
+
if (whichCache.has(cmd)) {
|
|
172
|
+
return (_a = whichCache.get(cmd)) !== null && _a !== void 0 ? _a : null;
|
|
173
|
+
}
|
|
174
|
+
let result = null;
|
|
63
175
|
const parts = cmd.split(' ');
|
|
64
176
|
if (parts[1] === 'compose') {
|
|
65
|
-
//
|
|
66
|
-
|
|
177
|
+
// First check if docker exists
|
|
178
|
+
const dockerPath = await which(parts[0]);
|
|
179
|
+
if (!dockerPath) {
|
|
180
|
+
result = null;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
// Then verify docker compose plugin is available
|
|
184
|
+
try {
|
|
185
|
+
await execa(parts[0], ['compose', 'version'], {
|
|
186
|
+
stdio: 'ignore',
|
|
187
|
+
timeout: 5000,
|
|
188
|
+
});
|
|
189
|
+
result = dockerPath;
|
|
190
|
+
}
|
|
191
|
+
catch (_b) {
|
|
192
|
+
// docker compose plugin not available
|
|
193
|
+
result = null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
result = await realWhich(cmd, { nothrow: true });
|
|
67
199
|
}
|
|
68
|
-
|
|
200
|
+
// Cache the result
|
|
201
|
+
whichCache.set(cmd, result);
|
|
202
|
+
return result;
|
|
69
203
|
}
|
|
70
204
|
export async function getPackageJson() {
|
|
71
205
|
const contents = await readFile(`${import.meta.dirname}/../package.json`);
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,SAAS,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAOnD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAc;IAC7C,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;IACpC,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAc;IAClD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;IACzC,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,MAAM,UA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3B,+BAA+B;QAC/B,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAExC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,GAAG,IAAI,CAAA;QACf,CAAC;aAAM,CAAC;YACN,iDAAiD;YACjD,IAAI,CAAC;gBACH,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE;oBAC5C,KAAK,EAAE,QAAQ;oBACf,OAAO,EAAE,IAAI;iBACd,CAAC,CAAA;gBAEF,MAAM,GAAG,UAAU,CAAA;YACrB,CAAC;YAAC,WAAM,CAAC;gBACP,sCAAsC;gBACtC,MAAM,GAAG,IAAI,CAAA;YACf,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;IAClD,CAAC;IAED,mBAAmB;IACnB,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAE3B,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAA;IACzE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;AACxC,CAAC"}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"awsRegion": {
|
|
6
|
+
"default": "eu-west-1",
|
|
7
|
+
"description": "AWS region for operations",
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"imageName": {
|
|
11
|
+
"description": "Docker image name for production builds",
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"devImageName": {
|
|
15
|
+
"description": "Docker image name for development builds (overrides imageName + dev suffix)",
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"devSuffix": {
|
|
19
|
+
"default": "-dev",
|
|
20
|
+
"description": "Suffix to append to image name for development builds",
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"buildPlatform": {
|
|
24
|
+
"description": "Docker build platform (e.g., linux/amd64, linux/arm64)",
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"buildContext": {
|
|
28
|
+
"default": ".",
|
|
29
|
+
"description": "Docker build context path",
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"ecrBaseUrl": {
|
|
33
|
+
"description": "ECR repository base URL",
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"ecsCluster": {
|
|
37
|
+
"description": "Production ECS cluster name",
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"devEcsCluster": {
|
|
41
|
+
"description": "Development ECS cluster name",
|
|
42
|
+
"type": "string"
|
|
43
|
+
},
|
|
44
|
+
"ecsService": {
|
|
45
|
+
"description": "Production ECS service name",
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"devEcsService": {
|
|
49
|
+
"description": "Development ECS service name",
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"codebuildProject": {
|
|
53
|
+
"description": "Production CodeBuild project name",
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"devCodebuildProject": {
|
|
57
|
+
"description": "Development CodeBuild project name",
|
|
58
|
+
"type": "string"
|
|
59
|
+
},
|
|
60
|
+
"cloudfrontDistribution": {
|
|
61
|
+
"description": "CloudFront distribution ID for cache invalidation",
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"sshAccount": {
|
|
65
|
+
"description": "SSH account for production deployments (user@host format)",
|
|
66
|
+
"type": "string"
|
|
67
|
+
},
|
|
68
|
+
"devSshAccount": {
|
|
69
|
+
"description": "SSH account for development deployments (user@host format)",
|
|
70
|
+
"type": "string"
|
|
71
|
+
},
|
|
72
|
+
"sshPort": {
|
|
73
|
+
"default": "22",
|
|
74
|
+
"description": "SSH port number",
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
"liveFolder": {
|
|
78
|
+
"description": "Remote folder path for production deployments",
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"devFolder": {
|
|
82
|
+
"description": "Remote folder path for development deployments",
|
|
83
|
+
"type": "string"
|
|
84
|
+
},
|
|
85
|
+
"branch": {
|
|
86
|
+
"description": "Git branch for production deployments",
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"devBranch": {
|
|
90
|
+
"description": "Git branch for development deployments",
|
|
91
|
+
"type": "string"
|
|
92
|
+
},
|
|
93
|
+
"repo": {
|
|
94
|
+
"description": "Git repository URL",
|
|
95
|
+
"type": "string"
|
|
96
|
+
},
|
|
97
|
+
"codeSubfolder": {
|
|
98
|
+
"description": "Subfolder within repository containing the code",
|
|
99
|
+
"type": "string"
|
|
100
|
+
},
|
|
101
|
+
"nexcessDeployScript": {
|
|
102
|
+
"default": "bin/nexcess-deploy-script.sh",
|
|
103
|
+
"description": "Path to Nexcess deployment script",
|
|
104
|
+
"type": "string"
|
|
105
|
+
},
|
|
106
|
+
"nexcessCleanupScript": {
|
|
107
|
+
"default": "bin/nexcess-cleanup.sh",
|
|
108
|
+
"description": "Path to Nexcess cleanup script",
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"dbSeed": {
|
|
112
|
+
"description": "Database seed file path",
|
|
113
|
+
"type": "string"
|
|
114
|
+
},
|
|
115
|
+
"dbBackupPath": {
|
|
116
|
+
"description": "Path for database backups",
|
|
117
|
+
"type": "string"
|
|
118
|
+
},
|
|
119
|
+
"devPlugins": {
|
|
120
|
+
"description": "WordPress plugins to activate in development",
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"devPluginDelay": {
|
|
124
|
+
"default": "30",
|
|
125
|
+
"description": "Delay in seconds before activating dev plugins",
|
|
126
|
+
"type": "string"
|
|
127
|
+
},
|
|
128
|
+
"wpCliContainer": {
|
|
129
|
+
"description": "Docker container name for WP-CLI operations",
|
|
130
|
+
"type": "string"
|
|
131
|
+
},
|
|
132
|
+
"wpCliContainerProfile": {
|
|
133
|
+
"description": "Docker Compose profile for WP-CLI container",
|
|
134
|
+
"type": "string"
|
|
135
|
+
},
|
|
136
|
+
"wpUpdates": {
|
|
137
|
+
"description": "WordPress automatic update configuration",
|
|
138
|
+
"type": "object",
|
|
139
|
+
"properties": {
|
|
140
|
+
"doNotUpdate": {
|
|
141
|
+
"description": "List of plugins/themes to skip during updates",
|
|
142
|
+
"default": [],
|
|
143
|
+
"type": "array",
|
|
144
|
+
"items": {
|
|
145
|
+
"type": "string"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"pluginFolder": {
|
|
149
|
+
"description": "Path to WordPress plugins folder",
|
|
150
|
+
"default": "code/wp-content/plugins",
|
|
151
|
+
"type": "string"
|
|
152
|
+
},
|
|
153
|
+
"themeFolder": {
|
|
154
|
+
"description": "Path to WordPress themes folder",
|
|
155
|
+
"default": "code/wp-content/themes",
|
|
156
|
+
"type": "string"
|
|
157
|
+
},
|
|
158
|
+
"wpRoot": {
|
|
159
|
+
"description": "Path to WordPress root directory",
|
|
160
|
+
"default": "code/",
|
|
161
|
+
"type": "string"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"additionalProperties": false
|
|
165
|
+
},
|
|
166
|
+
"dockerCommand": {
|
|
167
|
+
"default": "docker",
|
|
168
|
+
"description": "Override for docker command",
|
|
169
|
+
"type": "string"
|
|
170
|
+
},
|
|
171
|
+
"composeCommand": {
|
|
172
|
+
"default": "docker compose",
|
|
173
|
+
"description": "Override for docker compose command",
|
|
174
|
+
"type": "string"
|
|
175
|
+
},
|
|
176
|
+
"terraformCommand": {
|
|
177
|
+
"description": "Override for terraform/tofu command (auto-detects tofu vs terraform)",
|
|
178
|
+
"type": "string"
|
|
179
|
+
},
|
|
180
|
+
"nodeCommand": {
|
|
181
|
+
"default": "node",
|
|
182
|
+
"description": "Override for node command",
|
|
183
|
+
"type": "string"
|
|
184
|
+
},
|
|
185
|
+
"yarnCommand": {
|
|
186
|
+
"default": "yarn",
|
|
187
|
+
"description": "Override for yarn command",
|
|
188
|
+
"type": "string"
|
|
189
|
+
},
|
|
190
|
+
"awsCommand": {
|
|
191
|
+
"default": "aws",
|
|
192
|
+
"description": "Override for aws command",
|
|
193
|
+
"type": "string"
|
|
194
|
+
},
|
|
195
|
+
"sshCommand": {
|
|
196
|
+
"default": "ssh",
|
|
197
|
+
"description": "Override for ssh command",
|
|
198
|
+
"type": "string"
|
|
199
|
+
},
|
|
200
|
+
"rsyncCommand": {
|
|
201
|
+
"default": "rsync",
|
|
202
|
+
"description": "Override for rsync command",
|
|
203
|
+
"type": "string"
|
|
204
|
+
},
|
|
205
|
+
"gitCommand": {
|
|
206
|
+
"default": "git",
|
|
207
|
+
"description": "Override for git command",
|
|
208
|
+
"type": "string"
|
|
209
|
+
},
|
|
210
|
+
"gzipCommand": {
|
|
211
|
+
"default": "gzip",
|
|
212
|
+
"description": "Override for gzip command",
|
|
213
|
+
"type": "string"
|
|
214
|
+
},
|
|
215
|
+
"prepareCommands": {
|
|
216
|
+
"description": "Commands to run during preparation phase",
|
|
217
|
+
"type": "array",
|
|
218
|
+
"items": {
|
|
219
|
+
"anyOf": [
|
|
220
|
+
{
|
|
221
|
+
"description": "Simple command string",
|
|
222
|
+
"type": "string"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"cmd": {
|
|
228
|
+
"description": "Command to execute",
|
|
229
|
+
"type": "string"
|
|
230
|
+
},
|
|
231
|
+
"name": {
|
|
232
|
+
"description": "Display name for the command",
|
|
233
|
+
"type": "string"
|
|
234
|
+
},
|
|
235
|
+
"fail": {
|
|
236
|
+
"description": "Whether to fail if command returns non-zero exit code",
|
|
237
|
+
"default": true,
|
|
238
|
+
"type": "boolean"
|
|
239
|
+
},
|
|
240
|
+
"dir": {
|
|
241
|
+
"description": "Working directory for the command",
|
|
242
|
+
"type": "string"
|
|
243
|
+
},
|
|
244
|
+
"timing": {
|
|
245
|
+
"description": "When to run the command during preparation",
|
|
246
|
+
"default": "normal",
|
|
247
|
+
"type": "string",
|
|
248
|
+
"enum": ["early", "normal"]
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"required": ["cmd"],
|
|
252
|
+
"additionalProperties": false
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"sites": {
|
|
258
|
+
"description": "Site-specific configuration overrides",
|
|
259
|
+
"type": "object",
|
|
260
|
+
"propertyNames": {
|
|
261
|
+
"type": "string"
|
|
262
|
+
},
|
|
263
|
+
"additionalProperties": {
|
|
264
|
+
"type": "object",
|
|
265
|
+
"propertyNames": {
|
|
266
|
+
"type": "string"
|
|
267
|
+
},
|
|
268
|
+
"additionalProperties": {
|
|
269
|
+
"type": "string"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"$schema": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"description": "JSON Schema reference for IDE support"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"additionalProperties": {
|
|
279
|
+
"type": "string"
|
|
280
|
+
},
|
|
281
|
+
"$id": "https://github.com/Jolt-Design/jolt-scripts/schema/jolt-config.json",
|
|
282
|
+
"title": "Jolt Scripts Configuration",
|
|
283
|
+
"description": "Configuration schema for Jolt Scripts DevOps automation tool",
|
|
284
|
+
"examples": [
|
|
285
|
+
{
|
|
286
|
+
"imageName": "my-app",
|
|
287
|
+
"awsRegion": "us-east-1",
|
|
288
|
+
"ecsCluster": "production-cluster",
|
|
289
|
+
"ecsService": "my-app-service",
|
|
290
|
+
"devEcsCluster": "dev-cluster",
|
|
291
|
+
"devEcsService": "my-app-dev-service",
|
|
292
|
+
"prepareCommands": [
|
|
293
|
+
"yarn install",
|
|
294
|
+
{
|
|
295
|
+
"cmd": "yarn build",
|
|
296
|
+
"name": "Build application",
|
|
297
|
+
"timing": "normal"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
"sites": {
|
|
301
|
+
"staging": {
|
|
302
|
+
"ecsCluster": "staging-cluster",
|
|
303
|
+
"ecsService": "my-app-staging"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
package/package.json
CHANGED
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joltdesign/scripts",
|
|
3
|
-
"packageManager": "yarn@4.
|
|
3
|
+
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f",
|
|
4
4
|
"bin": {
|
|
5
5
|
"jolt": "./dist/cli.js"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.21.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@biomejs/biome": "^2.2.
|
|
11
|
-
"@types/node": "^24.
|
|
10
|
+
"@biomejs/biome": "^2.2.4",
|
|
11
|
+
"@types/node": "^24.6.1",
|
|
12
12
|
"@types/which": "^3.0.4",
|
|
13
|
-
"
|
|
13
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
14
|
+
"@vitest/ui": "^3.2.4",
|
|
15
|
+
"rimraf": "^6.0.1",
|
|
16
|
+
"typescript": "^5.9.3",
|
|
17
|
+
"vitest": "^3.2.4"
|
|
14
18
|
},
|
|
15
19
|
"files": [
|
|
16
|
-
"/dist"
|
|
20
|
+
"/dist",
|
|
21
|
+
"jolt-config.schema.json"
|
|
17
22
|
],
|
|
18
23
|
"scripts": {
|
|
19
|
-
"build": "tsc",
|
|
24
|
+
"build": "tsc -b && yarn run generate-schema",
|
|
25
|
+
"clean": "rimraf dist",
|
|
20
26
|
"debug": "node --inspect-brk ./dist/cli.js",
|
|
27
|
+
"generate-schema": "yarn node ./scripts/generate-schema.js && yarn lint --write jolt-config.schema.json",
|
|
21
28
|
"lint": "biome check",
|
|
22
29
|
"fmt": "biome format",
|
|
23
30
|
"prepack": "run build",
|
|
24
31
|
"prepare": "jolt prepare",
|
|
32
|
+
"release": "yarn test:run && yarn lint && && yarn clean && yarn build && git stash push -u -m 'temp stash for release' && npm version patch --tag-version-prefix='' --message='Version %s' && git push && git push --tags && yarn npm publish --access=public && git stash pop || true",
|
|
33
|
+
"release:minor": "yarn test:run && yarn lint && && yarn clean && yarn build && git stash push -u -m 'temp stash for release' && npm version minor --tag-version-prefix='' --message='Version %s' && git push && git push --tags && yarn npm publish --access=public && git stash pop || true",
|
|
34
|
+
"release:major": "yarn test:run && yarn lint && && yarn clean && yarn build && git stash push -u -m 'temp stash for release' && npm version major --tag-version-prefix='' --message='Version %s' && git push && git push --tags && yarn npm publish --access=public && git stash pop || true",
|
|
35
|
+
"test": "vitest",
|
|
36
|
+
"test:coverage": "vitest --coverage.enabled=true",
|
|
37
|
+
"test:run": "vitest run",
|
|
25
38
|
"watch": "tsc -w"
|
|
26
39
|
},
|
|
27
40
|
"dependencies": {
|
|
28
|
-
"ansis": "^4.
|
|
41
|
+
"ansis": "^4.2.0",
|
|
42
|
+
"change-case": "^5.4.4",
|
|
29
43
|
"clipanion": "^4.0.0-rc.4",
|
|
30
|
-
"dotenv": "^17.2.
|
|
44
|
+
"dotenv": "^17.2.3",
|
|
31
45
|
"execa": "^9.6.0",
|
|
32
46
|
"object-resolve-path": "^1.1.1",
|
|
33
47
|
"typanion": "^3.14.0",
|
|
34
|
-
"which": "^5.0.0"
|
|
48
|
+
"which": "^5.0.0",
|
|
49
|
+
"zod": "^4.1.11"
|
|
35
50
|
}
|
|
36
51
|
}
|