UNPKG

@setten/mercure

Version:
28 lines (27 loc) 1.18 kB
"use strict"; /** * @setten/mercure * * @license MIT * @copyright Setten - Romain Lanz <romain.lanz@setten.io> */ Object.defineProperty(exports, "__esModule", { value: true }); const node_path_1 = require("node:path"); function getStub(...relativePaths) { return (0, node_path_1.join)(__dirname, 'templates', ...relativePaths); } async function instructions(projectRoot, app, sink) { // Setup config const configPath = app.configPath('mercure.ts'); new sink.files.MustacheFile(projectRoot, configPath, getStub('config.txt')).commit(); const configDir = app.directoriesMap.get('config') || 'config'; sink.logger.action('create').succeeded(`${configDir}/mercure.ts`); // Setup environment const env = new sink.files.EnvFile(projectRoot); env.set('MERCURE_ENDPOINT', 'http://localhost:XXXX/.well-known/mercure'); env.set('MERCURE_ADMIN_JWT', 'eyJhbGciOiJIUzI1NiJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.mx2ROlYlE1rp7udoDy-WCdnpLdPuKWzDxoBJXGMK4OE'); env.set('MERCURE_JWT_SECRET', 'ChangeMe'); env.commit(); sink.logger.action('update').succeeded('.env,.env.example'); } exports.default = instructions;