How to use @adonisjs/sink - 10 common examples

To help you get started, we’ve selected a few @adonisjs/sink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lookinlab / adonis-lucid-filter / test / make-filter.spec.js View on Github external
test('make a model filter class', async (assert) => {
    const make = new MakeModelFilter(new Helpers(path.join(__dirname)))

    // Name without word 'Filter'
    await make.handle({ name: 'User' })
    const UserFilter = require(path.join(__dirname, './app/ModelFilters/UserFilter'))

    // Name with word 'Filter'
    await make.handle({ name: 'PostFilter' })
    const PostFilter = require(path.join(__dirname, './app/ModelFilters/PostFilter'))

    assert.equal(UserFilter.name, 'UserFilter')
    assert.equal(PostFilter.name, 'PostFilter')
    assert.instanceOf(new UserFilter(), ModelFilter)
  })
github AdonisCommunity / create-adonis-ts-app / index.ts View on Github external
import { tasks } from './tasks'
import { CliState } from './src/contracts'

const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))

/* eslint-disable-next-line */
const BADGE = "    _       _             _         _     \n   / \\   __| | ___  _ __ (_)___    | |___ \n  / _ \\ / _` |/ _ \\| '_ \\| / __|_  | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/   \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"

/**
 * Help screen output
 */
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}

${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')}    ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')}            ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')}         ${colors.dim('Enable/disable eslint setup')}
`

/**
 * Running all the tasks to create a new project.
 */
export async function runTasks (args: string[]) {
  const argv = getops(args, {
    string: ['boilerplate', 'name'],
    boolean: ['eslint'],
    default: {
      eslint: null,
    },
  })

  console.log(BADGE)
github AdonisCommunity / create-adonis-ts-app / index.ts View on Github external
import { CliState } from './src/contracts'

const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))

/* eslint-disable-next-line */
const BADGE = "    _       _             _         _     \n   / \\   __| | ___  _ __ (_)___    | |___ \n  / _ \\ / _` |/ _ \\| '_ \\| / __|_  | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/   \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"

/**
 * Help screen output
 */
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}

${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')}    ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')}            ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')}         ${colors.dim('Enable/disable eslint setup')}
`

/**
 * Running all the tasks to create a new project.
 */
export async function runTasks (args: string[]) {
  const argv = getops(args, {
    string: ['boilerplate', 'name'],
    boolean: ['eslint'],
    default: {
      eslint: null,
    },
  })

  console.log(BADGE)
github AdonisCommunity / create-adonis-ts-app / index.ts View on Github external
import { isEmptyDir, logger, colors } from '@adonisjs/sink'
import { ensureDirSync, removeSync } from 'fs-extra'
import { Application } from '@adonisjs/application/build/standalone'

import { tasks } from './tasks'
import { CliState } from './src/contracts'

const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))

/* eslint-disable-next-line */
const BADGE = "    _       _             _         _     \n   / \\   __| | ___  _ __ (_)___    | |___ \n  / _ \\ / _` |/ _ \\| '_ \\| / __|_  | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/   \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"

/**
 * Help screen output
 */
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}

${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')}    ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')}            ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')}         ${colors.dim('Enable/disable eslint setup')}
`

/**
 * Running all the tasks to create a new project.
 */
export async function runTasks (args: string[]) {
  const argv = getops(args, {
    string: ['boilerplate', 'name'],
    boolean: ['eslint'],
    default: {
      eslint: null,
github AdonisCommunity / create-adonis-ts-app / index.ts View on Github external
import { tasks } from './tasks'
import { CliState } from './src/contracts'

const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))

/* eslint-disable-next-line */
const BADGE = "    _       _             _         _     \n   / \\   __| | ___  _ __ (_)___    | |___ \n  / _ \\ / _` |/ _ \\| '_ \\| / __|_  | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/   \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"

/**
 * Help screen output
 */
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}

${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')}    ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')}            ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')}         ${colors.dim('Enable/disable eslint setup')}
`

/**
 * Running all the tasks to create a new project.
 */
export async function runTasks (args: string[]) {
  const argv = getops(args, {
    string: ['boilerplate', 'name'],
    boolean: ['eslint'],
    default: {
      eslint: null,
    },
  })
github AdonisCommunity / create-adonis-ts-app / index.ts View on Github external
import { Application } from '@adonisjs/application/build/standalone'

import { tasks } from './tasks'
import { CliState } from './src/contracts'

const USING_YARN = !!(process.env.npm_execpath && process.env.npm_execpath.includes('yarn'))

/* eslint-disable-next-line */
const BADGE = "    _       _             _         _     \n   / \\   __| | ___  _ __ (_)___    | |___ \n  / _ \\ / _` |/ _ \\| '_ \\| / __|_  | / __|\n / ___ \\ (_| | (_) | | | | \\__ \\ |_| \\__ \\\n/_/   \\_\\__,_|\\___/|_| |_|_|___/\\___/|___/\n"

/**
 * Help screen output
 */
const HELP = `${colors.green(USING_YARN ? 'yarn create adonis-ts-app' : 'npx create-adonis-ts-app')} ${colors.dim('')}

${colors.yellow('Options')}
${colors.green('--boilerplate')} ${colors.green('')}    ${colors.dim('Choose API boilerplate')}
${colors.green('--name')} ${colors.green('')}            ${colors.dim('Define custom application name')}
${colors.green('--eslint')} ${colors.green('')}         ${colors.dim('Enable/disable eslint setup')}
`

/**
 * Running all the tasks to create a new project.
 */
export async function runTasks (args: string[]) {
  const argv = getops(args, {
    string: ['boilerplate', 'name'],
    boolean: ['eslint'],
    default: {
      eslint: null,
    },
  })
github adonisjs / adonis-shield / test / shield.spec.js View on Github external
test('return decrypted x-xsrf-token', async (assert) => {
    const config = new Config()
    const shield = new Shield(config)
    const request = getReq()
    request.headers = { 'x-xsrf-token': '12' }
    assert.equal(shield.getCsrfToken(request), '12')
  })
github brainnit / adonisjs-scout / test / unit / scout.spec.js View on Github external
it('throw exception when unable to find engine', () => {
    const config = new Config()
    const scout = new Scout(config)
    const fn = () => scout.engine()
    expect(fn).toThrow('E_INVALID_PARAMETER: Make sure to define connection inside config/scout.js file')
  })
github adonisjs / adonis-validation-provider / test / make-validator.spec.js View on Github external
test('make a validator class', async (assert) => {
    const make = new MakeValidator(new Helpers(path.join(__dirname)))
    await make.handle({ name: 'User' })
    const User = require(path.join(__dirname, './app/Validators/User'))
    assert.equal(User.name, 'User')
    assert.deepEqual(new User().rules, {})
  })
github duyluonglc / lucid-mongo / test / functional / migration-run.spec.js View on Github external
ioc.bind('Adonis/Src/Config', () => {
      const config = new Config()
      config.set('database', {
        connection: 'testing',
        testing: helpers.getConfig()
      })
      return config
    })