Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
group.before(async () => {
await registrar.providers([
path.join(__dirname, '../providers/SwaggerProvider')
]).register()
// call in boot SwaggerProvider
ace.addCommand('Adonis/Commands/SwaggerExport')
ace.addCommand('Adonis/Commands/SwaggerExportDocs')
ace.addCommand('Adonis/Commands/SwaggerRemove')
ace.addCommand('Adonis/Commands/SwaggerRemoveDocs')
})
const ace = require("@adonisjs/ace");
ace.command(
"make:auth",
"Generates Views, Controllers and Models for user authentication",
function({ name }) {
console.log(`Scaffolding basic authentication`);
}
);
// Boot ace to execute commands
ace.wireUpWithCommander();
ace.invoke();
public async handle (argv: string[]) {
const { Kernel, handleError, Manifest, BaseCommand } = require('@adonisjs/ace')
const manifest = new Manifest(this._ignitor.application.appRoot)
const kernel = new Kernel()
kernel.useManifest(manifest)
/**
* Print help when no command is defined
*/
if (!argv.length) {
await kernel.handle() // This will load the commands from manifest
this._printHelp(kernel)
return
}
/**
* Generate manifest when command is `generate:manifest`
*/
if (argv[0] === 'generate:manifest') {
class Noop extends BaseCommand {}
public async handle (argv: string[]) {
const { Kernel, handleError, Manifest, BaseCommand } = require('@adonisjs/ace')
const manifest = new Manifest(this._ignitor.application.appRoot)
const kernel = new Kernel()
kernel.useManifest(manifest)
/**
* Print help when no command is defined
*/
if (!argv.length) {
await kernel.handle() // This will load the commands from manifest
this._printHelp(kernel)
return
}
/**
* Generate manifest when command is `generate:manifest`
*/
if (argv[0] === 'generate:manifest') {
// 测试uc
'./commands/utils/testUC',
// 心跳
'./commands/utils/heart_beat',
// 初始化日报订阅表
'./commands/utils/init_daily_subscription'
]
// register commands
for (let command of registedCommandList) {
ace.addCommand(require(command)['default'])
}
// Boot ace to execute commands
ace.wireUpWithCommander()
ace.invoke()
// './command/generate/author', // 按用户生成电子书
// './command/generate/activity', // 按用户点赞回答&文章生成电子书
// './command/generate/column', // 按专栏生成电子书
// './command/generate/topic', // 按话题生成电子书
// './command/generate/collection', // 按收藏夹生成电子书
'./command/fetch/customer', // [抓取]执行自定义任务
'./command/generate/customer', // [生成]执行自定义任务
]
// register commands
for (const command of registedCommandList) {
ace.addCommand(require(command)['default'])
}
// Boot ace to execute commands
ace.wireUpWithCommander()
ace.invoke()
// './command/fetch/collection', // 抓取收藏夹记录
// './command/generate/author', // 按用户生成电子书
// './command/generate/activity', // 按用户点赞回答&文章生成电子书
// './command/generate/column', // 按专栏生成电子书
// './command/generate/topic', // 按话题生成电子书
// './command/generate/collection', // 按收藏夹生成电子书
'./command/fetch/customer', // [抓取]执行自定义任务
'./command/generate/customer', // [生成]执行自定义任务
]
// register commands
for (const command of registedCommandList) {
ace.addCommand(require(command)['default'])
}
// Boot ace to execute commands
ace.wireUpWithCommander()
ace.invoke()
// 测试uc
'./commands/utils/testUC',
// 心跳
'./commands/utils/heart_beat',
// 初始化日报订阅表
'./commands/utils/init_daily_subscription'
]
// register commands
for (let command of registedCommandList) {
ace.addCommand(require(command)['default'])
}
// Boot ace to execute commands
ace.wireUpWithCommander()
ace.invoke()
test('log queries when asked to log', async (assert) => {
ace.addCommand(MigrationRun)
ace.addCommand(MigrationRollback)
await fs.writeFile(path.join(__dirname, 'database/migrations/User.js'), `
const Schema = use('Schema')
class User extends Schema {
up () {
this.createTable('schema_users', (table) => {
table.increments()
table.string('username')
})
}
down () {
this.drop('schema_users')
}
}
it('import models', async () => {
ace.addCommand(Import)
jest.spyOn(console, 'log')
const TestModel = require('../unit/fixtures/TestModel')
TestModel._bootIfNotBooted()
ioc.bind('App/Models/TestModel', () => TestModel)
await ioc.use('Database').table('posts').insert([
{ title: 'foo' },
{ title: 'bar' },
{ title: 'foobar' }
])
await ace.call('scout:import', { model: 'TestModel' })