Skip to content

Commit

Permalink
feat: convert tab to space
Browse files Browse the repository at this point in the history
  • Loading branch information
RodolfoSilva committed Sep 7, 2020
1 parent 837e1f7 commit 33261de
Show file tree
Hide file tree
Showing 14 changed files with 365 additions and 367 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true

[*]
indent_size = 2
indent_style = tab
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ benchmarks
.idea
bin
out
.nyc_output
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"trailingComma": "es5",
"semi": false,
"singleQuote": true,
"useTabs": true,
"useTabs": false,
"quoteProps": "consistent",
"bracketSpacing": true,
"arrowParens": "always",
Expand Down
48 changes: 24 additions & 24 deletions adonis-typings/bull.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
declare module '@ioc:Rocketseat/Bull' {
import { Queue, Processor, JobsOptions, QueueOptions, WorkerOptions, Job } from 'bullmq'
import { Queue, Processor, JobsOptions, QueueOptions, WorkerOptions, Job } from 'bullmq'

export interface JobContract<T = any> {
key: string
options?: JobsOptions
workerOptions?: WorkerOptions
queueOptions?: QueueOptions
concurrency?: number
handle(data: T): Promise<any>
boot?: (queue: Queue) => void
}
export interface JobContract<T = any> {
key: string
options?: JobsOptions
workerOptions?: WorkerOptions
queueOptions?: QueueOptions
concurrency?: number
handle(data: T): Promise<any>
boot?: (queue: Queue) => void
}

export interface QueueContract<T = any> extends JobContract<T> {
bull: Queue<T>
}
export interface QueueContract<T = any> extends JobContract<T> {
bull: Queue<T>
}

export interface BullManagerContract {
queues: { [key: string]: QueueContract }
export interface BullManagerContract {
queues: { [key: string]: QueueContract }

getByKey(key: string): QueueContract
getByKey(key: string): QueueContract

add<T>(name: string, data: T, jobOptions?: JobsOptions): Promise<Job<any, any>>
add<T>(name: string, data: T, jobOptions?: JobsOptions): Promise<Job<any, any>>

remove(name: string, jobId: string): Promise<void>
remove(name: string, jobId: string): Promise<void>

ui(port?: number): void
ui(port?: number): void

shutdown(): Promise<void>
shutdown(): Promise<void>

process(): void
}
process(): void
}

const Bull: BullManagerContract
const Bull: BullManagerContract

export default Bull
export default Bull
}
48 changes: 24 additions & 24 deletions commands/Listen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ import { ApplicationContract } from '@ioc:Adonis/Core/Application'
import { BullManagerContract } from '@ioc:Rocketseat/Bull'

export default class Listen extends BaseCommand {
public static commandName = 'bull:listen'
public static description = 'Start the Bull listener'
constructor(app: ApplicationContract, kernel: Kernel, private bull: BullManagerContract) {
super(app, kernel)
}
public static commandName = 'bull:listen'
public static description = 'Start the Bull listener'
constructor(app: ApplicationContract, kernel: Kernel, private bull: BullManagerContract) {
super(app, kernel)
}

/**
* Start the bull-board
*/
@flags.boolean({ description: "Run bull's dashboard", alias: 'b' })
public board: boolean
/**
* Start the bull-board
*/
@flags.boolean({ description: "Run bull's dashboard", alias: 'b' })
public board: boolean

/**
* Custom port for the bull-board
*/
@flags.number({ description: "Run bull's dashboard in the provided port", alias: 'p' })
public port?: number
/**
* Custom port for the bull-board
*/
@flags.number({ description: "Run bull's dashboard in the provided port", alias: 'p' })
public port?: number

/**
* Execute command
*/
public async handle(): Promise<void> {
this.bull.process()
/**
* Execute command
*/
public async handle(): Promise<void> {
this.bull.process()

if (this.board || (typeof this.board === 'undefined' && typeof this.port !== 'undefined')) {
this.bull.ui(this.port)
}
}
if (this.board || (typeof this.board === 'undefined' && typeof this.port !== 'undefined')) {
this.bull.ui(this.port)
}
}
}
42 changes: 21 additions & 21 deletions commands/MakeJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ import { join } from 'path'
import { BaseCommand, args } from '@adonisjs/ace'

export default class MakeJob extends BaseCommand {
public static commandName = 'make:job'
public static description = 'Make a new Bull job'
public static commandName = 'make:job'
public static description = 'Make a new Bull job'

/**
* The name of the job file.
*/
@args.string({ description: 'Name of the job class' })
public name: string
/**
* The name of the job file.
*/
@args.string({ description: 'Name of the job class' })
public name: string

/**
* Execute command
*/
public async handle(): Promise<void> {
const stub = join(__dirname, '..', 'templates', 'job.txt')
/**
* Execute command
*/
public async handle(): Promise<void> {
const stub = join(__dirname, '..', 'templates', 'job.txt')

const path = this.application.resolveNamespaceDirectory('jobs')
const path = this.application.resolveNamespaceDirectory('jobs')

this.generator
.addFile(this.name, { pattern: 'pascalcase', form: 'singular' })
.stub(stub)
.destinationDir(path || 'app/Jobs')
.useMustache()
.appRoot(this.application.cliCwd || this.application.appRoot)
this.generator
.addFile(this.name, { pattern: 'pascalcase', form: 'singular' })
.stub(stub)
.destinationDir(path || 'app/Jobs')
.useMustache()
.appRoot(this.application.cliCwd || this.application.appRoot)

await this.generator.run()
}
await this.generator.run()
}
}
2 changes: 1 addition & 1 deletion npm-audit.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h5 class="card-title">
<div class="card">
<div class="card-body">
<h5 class="card-title">
September 7th 2020, 1:20:50 am
September 7th 2020, 1:48:10 am
</h5>
<p class="card-text">Last updated</p>
</div>
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"mrm": "mrm --preset=@adonisjs/mrm-preset",
"pretest": "npm run lint",
"test:docker": "docker-compose build && docker-compose run --rm tests",
"test:local": "node japaFile.js",
"test": "nyc npm run test:local",
"test": "node japaFile.js",
"coverage:local": "nyc npm run test",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"clean": "del build",
"copyfiles": "copyfiles \"templates/**/*.txt\" build",
"compile": "npm run lint && npm run clean && tsc",
Expand Down
34 changes: 17 additions & 17 deletions providers/BullProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ import { BullManagerContract } from '@ioc:Rocketseat/Bull'
* Provider to bind bull to the container
*/
export default class BullProvider {
constructor(protected container: IocContract) {}
constructor(protected container: IocContract) {}

public register() {
this.container.singleton('Rocketseat/Bull', () => {
const app = this.container.use('Adonis/Core/Application')
const Logger = this.container.use('Adonis/Core/Logger')
const Redis = this.container.use('Adonis/Addons/Redis')
public register() {
this.container.singleton('Rocketseat/Bull', () => {
const app = this.container.use('Adonis/Core/Application')
const Logger = this.container.use('Adonis/Core/Logger')
const Redis = this.container.use('Adonis/Addons/Redis')

const jobs = require(app.startPath('jobs'))?.default || []
const { BullManager } = require('../src/BullManager')
const jobs = require(app.startPath('jobs'))?.default || []
const { BullManager } = require('../src/BullManager')

return new BullManager(this.container, Logger, Redis, jobs)
})
return new BullManager(this.container, Logger, Redis, jobs)
})

this.container.alias('Rocketseat/Bull', 'Bull')
}
this.container.alias('Rocketseat/Bull', 'Bull')
}

public async boot() {}
public async boot() {}

public async ready() {}
public async ready() {}

public async shutdown() {
await this.container.use<BullManagerContract>('Rocketseat/Bull').shutdown()
}
public async shutdown() {
await this.container.use<BullManagerContract>('Rocketseat/Bull').shutdown()
}
}
Loading

0 comments on commit 33261de

Please sign in to comment.