@stouder-io/adonis-scheduler
Version:
Unopinionated scheduler for Adonis
34 lines (33 loc) • 1.64 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_path_1 = require("node:path");
const standalone_1 = require("@adonisjs/core/build/standalone");
class MakeJob extends standalone_1.BaseCommand {
async run() {
const stub = (0, node_path_1.join)(__dirname, '..', '..', '/templates/make_task.txt');
const path = this.application.resolveNamespaceDirectory('tasks');
this.generator
.addFile(this.name, { pattern: 'pascalcase', form: 'singular' })
.stub(stub)
.destinationDir(path || 'app/Tasks')
.useMustache()
.appRoot(this.application.cliCwd || this.application.appRoot);
await this.generator.run();
}
}
MakeJob.commandName = 'make:task';
MakeJob.description = 'Make a new task';
MakeJob.settings = {
loadApp: false,
stayAlive: false,
};
__decorate([
standalone_1.args.string({ description: 'Name of the job class' })
], MakeJob.prototype, "name", void 0);
exports.default = MakeJob;