Skip to content

Commit 57a70ca

Browse files
committed
Add package manager specification and enhance logging in executor and backend config services
1 parent 0df54a1 commit 57a70ca

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,6 @@
8484
},
8585
"pkg": {
8686
"assets": "package.json"
87-
}
87+
},
88+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
8889
}

src/_common/tasks/executor.task.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Job } from 'bullmq';
33
import { ExecutorResponseInterface } from '../interfaces/executor-response.interface';
44
import { ExecutorConfigInterface } from '../interfaces/executor-config.interface';
55
import { join, dirname } from 'path';
6+
import { Logger } from '@nestjs/common';
67

78
function convertNullToEmptyString(obj) {
89
if (obj === null) {
@@ -36,10 +37,11 @@ export async function executorTask(
3637
// const escapedJobDataArg = `'${jobDataArg.replace(/'/g, "'\\''")}'`;
3738

3839
try {
40+
Logger.debug(`Execute command ${command} with data ${jobDataArg}`, 'executorTask');
3941
const child = spawn(join(command), {
4042
shell: options?.shell ?? true,
4143
stdio: 'pipe',
42-
cwd: dirname(command)
44+
cwd: dirname(command),
4345
});
4446

4547
child.stdin.write(jobDataArg);

src/backend-runner/backend-config.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,20 @@ export class BackendConfigService implements OnModuleInit {
3131
const files = crawler.crawl(this.config.get<string>('application.backendsPath')).sync().sort();
3232

3333
for await (const file of files) {
34+
if (!/config.yml$/.test(file)) {
35+
this.logger.debug(`Skipping ${file}...`);
36+
continue;
37+
}
38+
3439
this.logger.log(`Loading ${file}...`);
3540
const data = fs.readFileSync(file, 'utf8');
3641
const config = YAML.parse(data);
3742

43+
if (!config._version || !config.name) {
44+
this.logger.debug(`Skipping with bad structure _version & name: ${file}...`);
45+
continue;
46+
}
47+
3848
try {
3949
if (!config.path) config.path = path.dirname(file);
4050
const schema = plainToInstance(BackendConfigV1Dto, config);

0 commit comments

Comments
 (0)