public autoRestPath()

in src/lib/validators/openApiDiff.ts [153:185]


  public autoRestPath(): string {
    log.silly(`autoRestPath is being called`)

    // When oad is installed globally
    {
      const result = path.join(__dirname, "..", "..", "..", "node_modules", "autorest", "dist", "app.js")
      if (fs.existsSync(result)) {
        log.silly(`Found autoRest:${result} `)
        return `node ${escape(result)}`
      }
    }

    // When oad is installed locally
    {
      const result = path.join(__dirname, "..", "..", "..", "..", "..", "autorest", "dist", "app.js")
      if (fs.existsSync(result)) {
        log.silly(`Found autoRest:${result} `)
        return `node ${escape(result)}`
      }
    }

    // Try to find autorest in `node-modules`
    {
      const result = path.resolve("node_modules/.bin/autorest")
      if (fs.existsSync(result)) {
        log.silly(`Found autoRest:${result} `)
        return escape(result)
      }
    }

    // Assume that autorest is in the path
    return "autorest"
  }