UNPKG

ao-message-signer

Version:

A React component for signing messages with AO Protocol

35 lines (29 loc) 1.25 kB
import { fileURLToPath } from 'url'; import { dirname, resolve, join } from 'path'; import { existsSync, mkdirSync, copyFileSync } from 'fs'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); function copyLuaHandler() { try { // Get the path to the user's project root (where node_modules is) const projectRoot = resolve(__dirname, '../../..'); // Create handlers directory if it doesn't exist const handlersDir = join(projectRoot, 'src', 'handlers'); if (!existsSync(handlersDir)) { mkdirSync(handlersDir, { recursive: true }); } // Copy the Lua file const sourcePath = join(__dirname, '../src/handlers/sign-message.lua'); const destPath = join(handlersDir, 'sign-message.lua'); // Only copy if it doesn't exist if (!existsSync(destPath)) { copyFileSync(sourcePath, destPath); console.log('✅ Successfully copied AO sign-message handler to src/handlers/sign-message.lua'); } else { console.log('ℹ️ AO sign-message handler already exists in src/handlers/'); } } catch (error) { console.error('❌ Error copying AO sign-message handler:', error.message); } } copyLuaHandler();