How to use the @adonisjs/sink.executeInstructions function in @adonisjs/sink

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 adonisjs / adonis-cli / src / Commands / RunInstructions.ts View on Github external
public async handle () {
    const rcContents = await getRcContents(this.projectRoot)
    if (!rcContents) {
      this.logger.error('Make sure your project root has .adonisrc.json file to continue')
      return
    }

    try {
      const app = new Application(this.projectRoot, {} as any, rcContents, {})
      await executeInstructions(this.projectName, this.projectRoot, app)
    } catch (error) {
      this.logger.error(`Unable to execute instructions for ${this.projectName} package`)
      this.logger.info(`Sink version: ${sinkVersion}`)

      console.log('')
      this.logger.fatal(error)
    }
  }
}
github AdonisCommunity / create-adonis-ts-app / tasks / executeInstructions.ts View on Github external
const task: TaskFn = async (absPath, application, state) => {
  let instructionsError: Error | null = null
  logger.pauseLogger()

  /**
   * Executing instructions in sequence. Do not convert this block to
   * parallel execution, since two instructions touching the same
   * file may lead to race conditions.
   */
  try {
    for (let pkg of Object.keys(packages[state.boilerplate])) {
      await executeInstructions(pkg, absPath, application)
    }
  } catch (error) {
    instructionsError = error
  }

  /**
   * Print logs and filter out duplicate one's
  */
  logger.resumeLogger((message) => {
    if (LOG_MESSAGES.has(message.message as string) && message.action !== 'fatal') {
      return false
    }

    LOG_MESSAGES.add(message.message as string)
    return true
  })