UNPKG

adonis-recaptcha2

Version:
29 lines (28 loc) 1.07 kB
"use strict"; /* * adonis-recaptcha2 * * (c) Lookin Anton <lookin@lookinlab.ru> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = require("path"); /** * Instructions to be executed when setting up the package. */ async function instructions(projectRoot, app, sink) { const middlewareDir = app.resolveNamespaceDirectory('middleware') || 'app/Middleware'; const middlewarePath = path_1.join(middlewareDir, 'Recaptcha.ts'); const middlewareTemplate = path_1.join(__dirname, 'templates/middleware/Recaptcha.txt'); const middleware = new sink.files.TemplateLiteralFile(projectRoot, middlewarePath, middlewareTemplate); if (middleware.exists()) { sink.logger.action('create').skipped(`${middlewarePath} file already exists`); } else { middleware.apply().commit(); sink.logger.action('create').succeeded(middlewarePath); } } exports.default = instructions;