UNPKG

@directctrl/fixturelibrary

Version:

Utility library making it easy to work with the open-fixture-library.

35 lines 1.31 kB
#!/usr/bin/env node "use strict"; /* eslint-disable no-console */ /* eslint-disable consistent-return */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const node_fetch_1 = __importDefault(require("node-fetch")); const fixturelibrary_1 = require("./fixturelibrary"); // If all files should be downloaded let deepSync = true; if (process.argv[3] === 'shallow') { deepSync = false; } const fl = new fixturelibrary_1.FixtureLibrary(true); async function main() { // Now we check if github is live const response = await (0, node_fetch_1.default)('https://github.com/status'); if (!response.ok) return console.error('Github is currently not available. Please check your internet connection.'); console.log('Starting OpenFixtureLibrary Synchronization.'); let updates; if (deepSync) { updates = await fl.downloadOfl(); } else { updates = await fl.fetchOfl(); } const length = updates ? updates.length : 0; console.log(`Applied ${length} Update${length === 1 ? '' : 's'}!`); console.log('Finished OpenFixtureLibrary Synchronization.'); } main(); //# sourceMappingURL=syncOfl.js.map