Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

farm-invest-cli

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

farm-invest-cli - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "farm-invest-cli",
"version": "1.1.0",
"version": "1.1.1",
"description": "Are there new investment opportunities on FarmCrowdy, ThriveAgric or EFarms?",

@@ -5,0 +5,0 @@ "main": "src/farm-invest-cli.js",

@@ -0,0 +0,0 @@ # Farm Invest CLI

@@ -1,43 +0,41 @@

const getAgro = require('./sites/agro')
const getAgro = require('./sites/agro');
const { agroJson } = require('./utils/create-files-dir')
const fs = require('fs')
const diff = require('fast-array-diff')
const { printDiff } = require('./utils/print-diff')
const { comparison } = require('./utils/comparison')
const { agroJson } = require('./utils/create-files-dir');
const fs = require('fs');
const diff = require('fast-array-diff');
const { printDiff } = require('./utils/print-diff');
const { comparison } = require('./utils/comparison');
const syncAgro = async ({ getAgro }) => {
try {
const productList = await getAgro()
try {
const productList = await getAgro();
if (!fs.existsSync(agroJson)) {
fs.writeFileSync(agroJson, JSON.stringify(productList, null, 2))
console.log(productList)
}
else {
const oldProductList = JSON.parse(fs.readFileSync(agroJson, 'utf8'))
if (!fs.existsSync(agroJson)) {
fs.writeFileSync(agroJson, JSON.stringify(productList, null, 2));
console.log(productList);
} else {
const oldProductList = JSON.parse(fs.readFileSync(agroJson, 'utf8'));
fs.writeFileSync(agroJson, JSON.stringify(productList, null, 2))
fs.writeFileSync(agroJson, JSON.stringify(productList, null, 2));
if (diff.diff(oldProductList, productList, comparison).removed.length) {
const diffObj = diff.diff(oldProductList, productList, comparison)
printDiff(diffObj)
return diffObj
}
}
return productList
if (diff.diff(oldProductList, productList, comparison).removed.length) {
const diffObj = diff.diff(oldProductList, productList, comparison);
printDiff(diffObj);
return diffObj;
}
}
catch (ex) {
console.error(ex)
}
}
return productList;
} catch (ex) {
console.error(ex);
}
};
if (require.main === module) {
const program = require('commander')
const program = require('commander');
program.parse(process.argv);
program.parse(process.argv);
(async () => await syncAgro({ getAgro, fs }))()
(async () => await syncAgro({ getAgro, fs }))();
}
module.exports = syncAgro
module.exports = syncAgro;

@@ -0,0 +0,0 @@ const getAgro = require('./sites/agro')

@@ -0,0 +0,0 @@ const getEFarms = require('./sites/efarms')

@@ -0,0 +0,0 @@ const getFarmCrowdy = require('./sites/farm-crowdy')

@@ -0,0 +0,0 @@ const getThriveAgric = require('./sites/thrive-agric')

@@ -0,0 +0,0 @@ #!/usr/bin/env node

@@ -1,29 +0,54 @@

const { default : axios } = require('axios')
const cheerio = require('cheerio')
const fs = require('fs')
const url = require('url')
const { agroHtml } = require('../utils/create-files-dir')
const { default: axios } = require('axios');
const cheerio = require('cheerio');
const fs = require('fs');
const url = require('url');
const { agroHtml } = require('../utils/create-files-dir');
module.exports = function () {
return axios.get('https://agropartnerships.co/investments').then(res => {
const $ = cheerio.load(res.data)
module.exports = function() {
return axios.get('https://agropartnerships.co/investments').then(res => {
const $ = cheerio.load(res.data);
fs.writeFileSync(agroHtml, res.data)
const activeProducts = $('a.farm-block.demo-farm').filter(function () {
return $(this).find('h6.light-green-text').length === 0
})
fs.writeFileSync(agroHtml, res.data);
const productList = activeProducts.map(function () {
const title = $(this).find('h2.white-text').text().trim()
const type = $(this).find('h3.white-text').text().trim()
const price = $(this).find('h5.white-text').text().trim()
const returns = $(this).find('div.preview-yield-block.main-page').text().trim()
const link = url.resolve('https://agropartnerships.co', $(this).attr('href').trim())
const activeProducts = $('a.farm-block.demo-farm').filter(function() {
return $(this).find('h6.light-green-text.no-padding').length === 0;
});
return { title, price, link, returns, type }
}).toArray()
const productList = activeProducts
.map(function() {
const title = $(this)
.find('h2.white-text')
.text()
.trim();
const type = $(this)
.find('h3.white-text')
.text()
.trim();
const price = $(this)
.find('h5.white-text')
.text()
.trim();
const returns =
$(this)
.find('div.preview-yield-block.main-page > div')
.text()
.trim() +
' ' +
$(this)
.find('div.preview-yield-block.main-page > h5')
.text()
.trim();
const link = url.resolve(
'https://agropartnerships.co',
$(this)
.attr('href')
.trim()
);
return productList
})
}
return { title, price, link, returns, type };
})
.toArray();
return productList;
});
};

@@ -1,26 +0,44 @@

const { default : axios } = require('axios')
const cheerio = require('cheerio')
const fs = require('fs')
const { default: axios } = require('axios');
const cheerio = require('cheerio');
const fs = require('fs');
const { eFarmsHtml } = require('../utils/create-files-dir')
const { eFarmsHtml } = require('../utils/create-files-dir');
module.exports = function () {
return axios.get('https://www.efarms.com.ng/index.php/en/farms').then(res => {
const $ = cheerio.load(res.data)
module.exports = function() {
return axios.get('https://www.efarms.com.ng/index.php/en/farms').then(res => {
const $ = cheerio.load(res.data);
fs.writeFileSync(eFarmsHtml, res.data)
const activeProducts = $('section.causes div.grid')
fs.writeFileSync(eFarmsHtml, res.data);
const productList = activeProducts.map(function () {
const title = $(this).find('h3 a').text().trim()
const price = $(this).find('div.raised').text().trim();
const returns = $(this).find('div.goal').text().trim();
const daysLeft = $(this).find('span.remaining-days').text().trim();
const link = $(this).find('h3 a').attr('href').trim()
return { title, price, link, returns, daysLeft, farm: 'efarms' }
}).toArray().filter(({ daysLeft }) => daysLeft && !daysLeft.endsWith('ago'))
const activeProducts = $('section.causes div.grid');
return productList
})
}
const productList = activeProducts
.map(function() {
const title = $(this)
.find('h3 a')
.text()
.trim();
const price = $(this)
.find('div.raised > h4 > span')
.text()
.trim();
const returns = $(this)
.find('div.goal > h4 > span')
.text()
.trim();
const daysLeft = $(this)
.find('span.remaining-days')
.text()
.trim();
const link = $(this)
.find('h3 a')
.attr('href')
.trim();
return { title, price, link, returns, daysLeft, farm: 'efarms' };
})
.toArray()
.filter(({ daysLeft }) => daysLeft && !daysLeft.endsWith('ago'));
return productList;
});
};

@@ -1,26 +0,41 @@

const { default : axios } = require('axios')
const cheerio = require('cheerio')
const fs = require('fs')
const { farmCrowdyHtml } = require('../utils/create-files-dir')
const { default: axios } = require('axios');
const cheerio = require('cheerio');
const fs = require('fs');
const { farmCrowdyHtml } = require('../utils/create-files-dir');
module.exports = function () {
return axios.get('https://www.farmcrowdy.com/farmshop').then(res => {
const $ = cheerio.load(res.data)
fs.writeFileSync(farmCrowdyHtml, res.data)
const activeProducts = $('div.project').filter(function () {
return $(this).find('div.project-image a span strong').length == 0
})
const productList = activeProducts.map(function () {
const title = $(this).find('div.project-content h5').text().trim()
const price = $(this).find('div.project-content span').text().trim()
const link = $(this).find('div.project-image a').attr('href').trim()
const returns = $(this).find('div.project-content p').text().trim()
return { title, price, link, returns }
}).toArray()
return productList
})
}
module.exports = function() {
return axios.get('https://www.farmcrowdy.com/farmshop').then(res => {
const $ = cheerio.load(res.data);
fs.writeFileSync(farmCrowdyHtml, res.data);
const activeProducts = $('div.row.farmshop.h-100').filter(function() {
return $(this).find('span.sold-out').length === 0;
});
const productList = activeProducts
.map(function() {
const title = $(this)
.find('h4')
.text()
.trim();
const price = $(this)
.find('a > p')
.text()
.trim();
const link = $(this)
.find('a')
.attr('href')
.trim();
const returns = $(this)
.find('span.duration')
.text()
.trim();
return { title, price, link, returns };
})
.toArray();
return productList;
});
};

@@ -0,0 +0,0 @@ const { default : axios } = require('axios')

@@ -0,0 +0,0 @@ const comparison = (a, b) => {

@@ -0,0 +0,0 @@ const fs = require('fs')

@@ -0,0 +0,0 @@ const chalk = require('chalk').default

@@ -0,0 +0,0 @@ const syncAgro = require('../src/farm-invest-cli-agro')

@@ -0,0 +0,0 @@ const syncEFarms = require('../src/farm-invest-cli-efarms')

@@ -0,0 +0,0 @@ const syncFarmCrowdy = require('../src/farm-invest-cli-farm-crowdy')

@@ -0,0 +0,0 @@ const syncThriveAgric = require('../src/farm-invest-cli-thrive-agric')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc