@solidactions/cli 0.6.3 → 0.7.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/dist/commands/deploy.js +24 -11
- package/dist/commands/logs.js +7 -0
- package/package.json +1 -1
package/dist/commands/deploy.js
CHANGED
|
@@ -206,14 +206,14 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
206
206
|
process.exit(1);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
const
|
|
210
|
-
const output = fs_1.default.createWriteStream(
|
|
211
|
-
const archive = (0, archiver_1.default)('
|
|
209
|
+
const archivePath = path_1.default.join(sourceDir, '.steps-deploy.tar.gz');
|
|
210
|
+
const output = fs_1.default.createWriteStream(archivePath);
|
|
211
|
+
const archive = (0, archiver_1.default)('tar', { gzip: true, gzipOptions: { level: 9 } });
|
|
212
212
|
output.on('close', async () => {
|
|
213
|
-
console.log(chalk_1.default.gray(`
|
|
213
|
+
console.log(chalk_1.default.gray(`Archived ${archive.pointer()} total bytes`));
|
|
214
214
|
try {
|
|
215
215
|
const form = new form_data_1.default();
|
|
216
|
-
form.append('source', fs_1.default.createReadStream(
|
|
216
|
+
form.append('source', fs_1.default.createReadStream(archivePath));
|
|
217
217
|
console.log(chalk_1.default.yellow('Uploading...'));
|
|
218
218
|
await axios_1.default.post(`${config.host}/api/v1/projects/${projectSlug}/deploy`, form, {
|
|
219
219
|
headers: {
|
|
@@ -253,7 +253,7 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
253
253
|
if (yamlConfig) {
|
|
254
254
|
await pushYamlDeclarations(config.host, config.apiKey, projectSlug, yamlConfig);
|
|
255
255
|
}
|
|
256
|
-
fs_1.default.unlinkSync(
|
|
256
|
+
fs_1.default.unlinkSync(archivePath);
|
|
257
257
|
process.exit(0);
|
|
258
258
|
}
|
|
259
259
|
else if (status === 'error') {
|
|
@@ -264,13 +264,13 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
264
264
|
console.log(chalk_1.default.gray(build_log));
|
|
265
265
|
console.log(chalk_1.default.yellow('--- End Build Log ---\n'));
|
|
266
266
|
}
|
|
267
|
-
fs_1.default.unlinkSync(
|
|
267
|
+
fs_1.default.unlinkSync(archivePath);
|
|
268
268
|
process.exit(1);
|
|
269
269
|
}
|
|
270
270
|
else if (attempts >= maxAttempts) {
|
|
271
271
|
clearInterval(poll);
|
|
272
272
|
console.error(chalk_1.default.red('\nTimeout waiting for build. It might still finish.'));
|
|
273
|
-
fs_1.default.unlinkSync(
|
|
273
|
+
fs_1.default.unlinkSync(archivePath);
|
|
274
274
|
process.exit(1);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
@@ -292,8 +292,8 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
292
292
|
else {
|
|
293
293
|
console.error(error.message);
|
|
294
294
|
}
|
|
295
|
-
if (fs_1.default.existsSync(
|
|
296
|
-
fs_1.default.unlinkSync(
|
|
295
|
+
if (fs_1.default.existsSync(archivePath))
|
|
296
|
+
fs_1.default.unlinkSync(archivePath);
|
|
297
297
|
process.exit(1);
|
|
298
298
|
}
|
|
299
299
|
});
|
|
@@ -302,11 +302,24 @@ async function deploy(projectName, sourcePath, options = {}) {
|
|
|
302
302
|
});
|
|
303
303
|
archive.pipe(output);
|
|
304
304
|
// Glob patterns to ignore
|
|
305
|
-
const ignore = ['node_modules/**', '.git/**', '.steps-deploy.zip', 'dist/**', 'vendor/**', '**/node_modules/**'];
|
|
305
|
+
const ignore = ['node_modules/**', '.git/**', '.steps-deploy.tar.gz', '.steps-deploy.zip', 'dist/**', 'vendor/**', '**/node_modules/**'];
|
|
306
|
+
// User code goes under tenantcode/ so it never conflicts with our Dockerfile
|
|
306
307
|
archive.glob('**/*', {
|
|
307
308
|
cwd: sourceDir,
|
|
308
309
|
ignore: ignore,
|
|
309
310
|
dot: true
|
|
311
|
+
}, {
|
|
312
|
+
prefix: 'tenantcode'
|
|
310
313
|
});
|
|
314
|
+
// Dockerfile always at archive root, referencing tenantcode/
|
|
315
|
+
const universalDockerfile = [
|
|
316
|
+
'FROM node:20-alpine',
|
|
317
|
+
'WORKDIR /app',
|
|
318
|
+
'COPY tenantcode/package.json tenantcode/package-lock.json* ./',
|
|
319
|
+
'RUN npm install',
|
|
320
|
+
'COPY tenantcode/ .',
|
|
321
|
+
'RUN npm run build',
|
|
322
|
+
].join('\n') + '\n';
|
|
323
|
+
archive.append(universalDockerfile, { name: 'Dockerfile' });
|
|
311
324
|
await archive.finalize();
|
|
312
325
|
}
|
package/dist/commands/logs.js
CHANGED
|
@@ -32,6 +32,13 @@ async function logs(runId, options) {
|
|
|
32
32
|
'Accept': 'application/json',
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
|
+
const errors = logsResponse.data.errors || [];
|
|
36
|
+
if (errors.length > 0) {
|
|
37
|
+
for (const err of errors) {
|
|
38
|
+
console.log(chalk_1.default.red(`Worker ${err.worker}: ${err.error}`));
|
|
39
|
+
}
|
|
40
|
+
console.log(chalk_1.default.gray('---'));
|
|
41
|
+
}
|
|
35
42
|
const logData = logsResponse.data.logs || '';
|
|
36
43
|
let printed = displayLogs(logData);
|
|
37
44
|
if (options.follow && runData.status === 'running') {
|