Socket
Socket
Sign inDemoInstall

cocoons.io

Package Overview
Dependencies
288
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 1.0.0

16

bin/exec.js

@@ -30,3 +30,3 @@ #!/usr/bin/env node

if (process.argv.length == 4) {
if (process.argv.length === 4) {
siteTemplateName = process.argv[3];

@@ -48,15 +48,19 @@ }

if (process.argv.length != 4 && process.argv.length != 5) {
console.log('Usage: cocoons mindmap [mindmapFile] [pathPrefix]\n');
if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage: cocoons mindmap [mindmapFile] [pathPrefix] [proxy-file]\n');
return;
}
if (process.argv.length >= 4) {
if (process.argv[3]) {
config.mindmapFile = process.argv[3];
}
if (process.argv.length == 5) {
if (process.argv[4]) {
config.mindmapPrefix = process.argv[4];
}
if (process.argv[5]) {
config.proxyFile = process.argv[5];
}
mindmap.generateFromMindmap(config,function(error, folder){

@@ -76,3 +80,3 @@ if (error) {

if (process.argv.length == 4) {
if (process.argv.length === 4) {
projectFolder = process.argv[3];

@@ -79,0 +83,0 @@ }

@@ -29,3 +29,3 @@ var log = require('../logger').Logger;

// -----------------------------------------------------
configFile = process.cwd() + "/cocoons.json";
var configFile = process.cwd() + "/cocoons.json";

@@ -53,6 +53,11 @@ init(configFile, function(error, config){

var engine = require(config.mindmapEngine);
if (params.mindmapPrefix) {
config.mindmapPrefix = params.mindmapPrefix;
}
if (params.proxyFile) {
config.proxyFile = params.proxyFile;
}
var mindmapEngine = new engine.Mindmap(config);

@@ -70,3 +75,3 @@

}
};

@@ -89,7 +94,7 @@

})
});
}
};
exports.generateFromMindmap = generateFromMindmap;

@@ -7,2 +7,3 @@ var pt = require('path');

var jade = require('jade');
var proxyLoader = require("simple-proxies/lib/proxyfileloader");
var log = require('../logger.js').Logger;

@@ -71,3 +72,25 @@ var util = require('../util.js');

async.waterfall([
// If exist, load proxies
function(callback) {
if (that.config.proxyFile) {
var config = proxyLoader.config().setProxyFile(that.config.proxyFile)
.setCheckProxies(true)
.setRemoveInvalidProxies(false);
proxyLoader.loadProxyFile(config,function(error, proxyList){
if (error) {
callback(error);
}
that.config.proxyList = proxyList;
callback();
});
}
else {
callback();
}
},
// Compile the jade templates that will be used to generate the different page files (md & json).

@@ -286,3 +309,3 @@ // & Read the mindmap file

corpus.generateCorpus(page.kws, that.config.country, that.config.language, function(error, corpus) {
corpus.generateCorpus(page.kws, that.config, function(error, corpus) {
if (error) {

@@ -289,0 +312,0 @@ return callback(error);

var _ = require("underscore");
var search = require("generate-corpus");
module.exports.generateCorpus= function(keywords, country, language, callback ) {
module.exports.generateCorpus= function(keywords, config, callback ) {
var proxy = null;
if (config.proxyList) {
proxy = config.proxyList.pick().getUrl();
}
var options = {
host : "google." + country,
host : "google." + config.country,
num : 30,

@@ -18,6 +23,6 @@ qs: {

withStopWords : false,
language : language,
language : config.language,
removeSpecials : true,
removeDiacritics : true
//,proxy
removeDiacritics : true,
proxy : proxy
};

@@ -33,5 +38,4 @@

var allWords = Array.from(corpus[0].stats.values()).concat(Array.from(corpus[1].stats.values()).concat(Array.from(corpus[2].stats.values())));
allWords = _.sortBy(allWords, function(word) { return -word.tfIdfSum;});
allWords = _.map(allWords.slice(0,199), function(word) {return word.word; });
//allWords = _.map(allWords.slice(0,199), function(word) {return word.word; });
allWords = _.map(_.filter(_.sortBy(allWords, function(word) { return -word.tfIdfSum;}), function(word){ return word.nbrDocs > 1;}), function(word) {return word.word; }).slice(0,100);
callback(null, allWords);

@@ -38,0 +42,0 @@

{
"name": "cocoons.io",
"version": "0.6.0",
"version": "1.0.0",
"author": "Christophe Lombart <christophe.lombart@gmail.com>",

@@ -10,2 +10,6 @@ "description": "Web site generator for the SEO ! Made with nodejs, markdown and jade with optionnally cloakings & mindmaps.",

},
"scripts" : {
"test" : "mocha",
"pretest" : "rm -rf ./logs"
},
"repository": {

@@ -29,3 +33,3 @@ "type": "git",

"ncp": "*",
"node-json-minify": "0.1.4-a",
"node-json-minify": "*",
"rimraf": "*",

@@ -35,3 +39,3 @@ "serve-favicon": "*",

"underscore": "*",
"xml2js": "^0.4.10",
"xml2js": "*",
"generate-corpus": "*"

@@ -38,0 +42,0 @@ },

var fs = require("fs");
var assert = require("assert");
var proxyLoader = require("simple-proxies/lib/proxyfileloader");
var m = require("../lib/fs/mindmap-fs.js");

@@ -8,2 +9,23 @@

var proxyList = null;
before(function(done) {
this.timeout(100000);
var config = proxyLoader.config().setProxyFile("/Users/christophe/nodejs/_MODULES/cocoons/cocoons-cms/proxies.txt")
.setCheckProxies(true)
.setRemoveInvalidProxies(false);
proxyLoader.loadProxyFile(config,function(error, pl){
//proxyLoader.loadDefaultProxies(function(error, pl){
if (error) {
done(error);
}
proxyList = pl;
done();
});
});
it.skip('Generate a site from a mindmap - opml file', function(done) {

@@ -49,3 +71,4 @@ var mindmapFilePath = "test/site-test-mindmap/test.opml";

country : "be",
language : "fr"
language : "fr",
proxyList : proxyList
};

@@ -58,16 +81,10 @@

done(error);
/*
if (error) {
done(error);
}
else {
fs.exists('test/site-test-mindmap/gg/content/pret-voiture-moto/moto.md', function (exists) {
done();
});
}
*/
});
});
it('Empty', function(done) {
done();
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc