From dfca208f58d78ecb397b2e12a3b420b219546ed4 Mon Sep 17 00:00:00 2001 From: Hernan Alberto Castro Paniagua <66583189+acastrocrdev@users.noreply.github.com> Date: Sun, 27 Mar 2022 04:38:24 -0600 Subject: [PATCH] fix StringTransformer --- commands/MakeJob.ts | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/commands/MakeJob.ts b/commands/MakeJob.ts index e71e1f9..c424280 100644 --- a/commands/MakeJob.ts +++ b/commands/MakeJob.ts @@ -1,7 +1,6 @@ import { join } from 'path' import fs from 'fs' import { BaseCommand, args } from '@adonisjs/core/build/standalone' -import { StringTransformer } from '@adonisjs/ace/build/src/Generator/StringTransformer' export default class MakeJob extends BaseCommand { public static commandName = 'make:job' @@ -18,26 +17,14 @@ export default class MakeJob extends BaseCommand { */ public async run(): Promise { const stub = join(__dirname, '..', 'templates', 'job.txt') - const jobName = new StringTransformer(this.name) - .changeCase('pascalcase') - .changeForm('singular') - .toValue() - + const path = this.application.resolveNamespaceDirectory('jobs') const rootDir = this.application.cliCwd || this.application.appRoot const jobPath = join(path || 'app/Jobs', `${jobName}.ts`) - const exist = fs.existsSync(jobPath) - - if (exist) { - this.logger.action('create').skipped(jobPath, 'File already exists') - - return - } - this.generator - .addFile(jobName) + .addFile(this.name, { pattern: 'pascalcase', form: 'singular' }) .stub(stub) .destinationDir(path || 'app/Jobs') .useMustache()