UNPKG

git-arweave-lfs

Version:

A Git extension for versioning large files with Arweave storage

36 lines 1.63 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.initCommand = void 0; const simple_git_1 = __importDefault(require("simple-git")); const fs_1 = require("fs"); const path_1 = require("path"); const initCommand = async () => { try { const git = (0, simple_git_1.default)(); const isRepo = await git.checkIsRepo(); if (!isRepo) { console.error('Error: Not a Git repository'); process.exit(1); } const root = await git.revparse(['--show-toplevel']); const gitDir = (0, path_1.join)(root, '.git'); const infoDir = (0, path_1.join)(gitDir, 'info'); (0, fs_1.mkdirSync)(infoDir, { recursive: true }); await git.addConfig('filter.arweave-lfs.clean', 'git-arweave-lfs clean %f'); await git.addConfig('filter.arweave-lfs.smudge', 'git-arweave-lfs smudge %f'); await git.addConfig('filter.arweave-lfs.required', 'true'); await git.addConfig('diff.arweave-lfs.command', 'git-arweave-lfs diff'); console.log('Git Arweave LFS initialized successfully.'); console.log('📁 File references will be stored in .git/info/arweave-lfs-refs.json'); console.log('💡 Use "git arweave-lfs track <pattern>" to track file types'); } catch (error) { console.error('Error initializing Git Arweave LFS:', error); process.exit(1); } }; exports.initCommand = initCommand; //# sourceMappingURL=init.js.map