New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

atm3-postpackager-list-html

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atm3-postpackager-list-html - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

list.html

60

index.js

@@ -1,8 +0,12 @@

module.exports = function(ret, conf, settings, opt) {
var tpl = "<li><a href='{href}'>{title}</a></li>";
var path = require('path'),
listFilePath = path.join(__dirname, "./list.html"),
content = fis.util.read(listFilePath);
module.exports = function (ret, conf, settings, opt) {
var folders = {};
fis.util.map(ret.src, function(subpath, file) {
fis.util.map(ret.src, function (subpath, file) {
if (file.isHtmlLike) {
if (!folders[file.subdirname]) {
folders[file.subdirname] = {
var folderObj = folders[file.subdirname];
if (!folderObj) {
folderObj = folders[file.subdirname] = {
files: [],

@@ -12,28 +16,38 @@ listFile: null

}
var folderObj = folders[file.subdirname];
if (file.basename === 'list.html') {
if (!!folderObj.listFile) {
return false;
} else if (file.basename === 'list.html') {
folderObj.listFile = file;
} else {
folderObj.files.push(file);
folderObj.dirname = file.dirname;
}
}
});
fis.util.map(folders, function(_subdirname, folderObj) {
var listFile = folderObj.listFile;
if (!folderObj.listFile) {
return false;
fis.util.map(folders, function (_subdirname, folderObj) {
if (folderObj.files.length > 1) {
var listFile = folderObj.listFile;
if (!listFile) {
fis.file.wrap(folderObj.dirname + "/list.html");
listFile.setContent(content);
}
generateListFile(listFile, folderObj.files);
fis.log.debug("generate list.html ok");
}
var body = [];
folderObj.files.forEach(function(file) {
var matches = file.getContent().match(/\<title\>\S*\-(\S*)<\/title>/i);
if (!matches) {
matches = file.getContent().match(/\<title\>(\S*)<\/title>/i)
}
var title = matches ? RegExp.$1 : file.basename;
body.push(tpl.replace('{href}', file.basename).replace('{title}', title));
});
listFile.setContent(listFile.getContent().replace('${list}', body.join("\r\n")));
fis.log.debug("generate list.html ok");
});
}
function generateListFile(listFile, files) {
var body = [],
tpl = "<li><a href='{href}'>{title}</a></li>";
files.forEach(function (file) {
var matches = file.getContent().match(/\<title\>\S*\-(\S*)<\/title>/i);
if (!matches) {
matches = file.getContent().match(/\<title\>(\S*)<\/title>/i)
}
var title = matches ? RegExp.$1 : file.basename;
body.push(tpl.replace('{href}', file.basename).replace('{title}', title));
});
listFile.setContent(listFile.getContent().replace('${list}', body.join("\r\n")));
}
{
"name": "atm3-postpackager-list-html",
"version": "0.0.1",
"version": "0.0.2",
"description": "atm3 generate list.html",

@@ -5,0 +5,0 @@ "main": "index.js",

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