xl1 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKNGN2YR6js = require('./chunk-KNGN2YR6.js');var _chunkNEJSZOZXjs = require('./chunk-NEJSZOZX.js');var W=_chunkNEJSZOZXjs.b.call(void 0, (z,g)=>{var c=_chunkNEJSZOZXjs.a.call(void 0, "fs"),n=_chunkNEJSZOZXjs.a.call(void 0, "path"),b=_chunkNEJSZOZXjs.a.call(void 0, "axios"),P=_chunkNEJSZOZXjs.a.call(void 0, "cheerio"),{execSync:$}=_chunkNEJSZOZXjs.a.call(void 0, "child_process"),{html2pdf:B}=_chunkKNGN2YR6js.a.call(void 0, );async function M(){try{return $("wkhtmltopdf --version"),!0}catch (e2){return!1}}async function T(s,e,F,k=null,p=!1){try{let a=s.includes("qiita.com")&&!s.endsWith(".md")?`${s}.md`:s,m=a.replace(/https:\/\//,"").replace(/\//g,"-").replace(/\.md$/,""),o=n.join(e,m)+".md",r=F||"";if(c.existsSync(e)||c.mkdirSync(e,{recursive:!0}),c.existsSync(o)&&!p){console.log(`File already exists: ${o}`);return}let q=await b.get(a);c.writeFileSync(o,q.data,"utf-8"),console.log(`Downloaded file: ${o}`);let h=c.readFileSync(o,"utf-8"),t=P.load(h)("title").text()||"";if(!t){let x=h.match(/title:\s*(.+)/);x&&(t=x[1])}t=t.replace(/[\/$# ]/g,"-"),console.log(`Title: ${t}`);let d=t?`${t}-${m}`:m,u=n.join(e,`${r}${d}.md`);c.copyFileSync(o,u);let j=n.join(__dirname,"template","github-markdown.css"),
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKNGN2YR6js = require('./chunk-KNGN2YR6.js');var _chunkNEJSZOZXjs = require('./chunk-NEJSZOZX.js');var W=_chunkNEJSZOZXjs.b.call(void 0, (z,g)=>{var c=_chunkNEJSZOZXjs.a.call(void 0, "fs"),n=_chunkNEJSZOZXjs.a.call(void 0, "path"),b=_chunkNEJSZOZXjs.a.call(void 0, "axios"),P=_chunkNEJSZOZXjs.a.call(void 0, "cheerio"),{execSync:$}=_chunkNEJSZOZXjs.a.call(void 0, "child_process"),{html2pdf:B}=_chunkKNGN2YR6js.a.call(void 0, );async function M(){try{return $("wkhtmltopdf --version"),!0}catch (e2){return!1}}async function T(s,e,F,k=null,p=!1){try{let a=s.includes("qiita.com")&&!s.endsWith(".md")?`${s}.md`:s,m=a.replace(/https:\/\//,"").replace(/\//g,"-").replace(/\.md$/,""),o=n.join(e,m)+".md",r=F||"";if(c.existsSync(e)||c.mkdirSync(e,{recursive:!0}),c.existsSync(o)&&!p){console.log(`File already exists: ${o}`);return}let q=await b.get(a);c.writeFileSync(o,q.data,"utf-8"),console.log(`Downloaded file: ${o}`);let h=c.readFileSync(o,"utf-8"),t=P.load(h)("title").text()||"";if(!t){let x=h.match(/title:\s*(.+)/);x&&(t=x[1])}t=t.replace(/[\/$# ]/g,"-"),console.log(`Title: ${t}`);let d=t?`${t}-${m}`:m,u=n.join(e,`${r}${d}.md`);c.copyFileSync(o,u);let j=n.join(__dirname,"template","github-markdown.css"),w=n.join(__dirname,"template","template.html"),l=n.join(e,`${r}${d}.html`),f=n.join(e,`${r}${d}.pdf`),y=n.join(e,`${r}${d}.docx`);$(`pandoc -t html --standalone --embed-resources -c "${j}" --template "${w}" --toc -o "${l}" "${u}"`),$(`pandoc "${l}" -o "${y}"`),k==="wkhtmltopdf"||await M()?$(`wkhtmltopdf -B 27 -L 16 -R 16 -T 27 --enable-internal-links --enable-local-file-access "${l}" "${f}"`):B(l,f,p),console.log(`Generated files: ${l}, ${f}, ${y}`)}catch(a){console.error(`Error: ${a.message}`)}}g.exports={qiitaDl:T}});exports.a = W;
|
package/dist/jsd1/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
|
-
"use strict";var _chunkKLMDRKHJjs = require('../chunk-KLMDRKHJ.js');require('../chunk-Y4GMOS4Y.js');require('../chunk-EJUO2FGU.js');var
|
3
|
-
`;u.appendFileSync(d,
|
2
|
+
"use strict";var _chunkKLMDRKHJjs = require('../chunk-KLMDRKHJ.js');require('../chunk-Y4GMOS4Y.js');require('../chunk-EJUO2FGU.js');var _chunkVPQQEJWQjs = require('../chunk-VPQQEJWQ.js');require('../chunk-KNGN2YR6.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var x=_chunkNEJSZOZXjs.b.call(void 0, (A,y)=>{var u=_chunkNEJSZOZXjs.a.call(void 0, "fs"),a=_chunkNEJSZOZXjs.a.call(void 0, "path"),k=_chunkNEJSZOZXjs.a.call(void 0, "axios"),$=_chunkNEJSZOZXjs.a.call(void 0, "marked"),j=_chunkNEJSZOZXjs.a.call(void 0, "glob"),W=_chunkNEJSZOZXjs.a.call(void 0, "https");async function v(t,n,p=!1){try{let d=await k({url:t,method:"GET",responseType:"stream",httpsAgent:new W.Agent({rejectUnauthorized:p})}),i=u.createWriteStream(n);return d.data.pipe(i),new Promise((h,m)=>{i.on("finish",h),i.on("error",m)})}catch(d){console.log("download error",t,n,d)}}async function E(t,n,p,d,i){let h=u.readFileSync(p,"utf-8"),m=$.lexer(h),w=o=>{let s=[];return o.forEach(e=>{e.type==="link"&&s.push(e),e.type==="table"&&e.rows.forEach(r=>{r.forEach(c=>{c.tokens&&(s=s.concat(w(c.tokens)))})}),e.tokens&&(s=s.concat(w(e.tokens))),e.items&&e.items.forEach(r=>{s=s.concat(w(r.tokens))})}),s};for(let o of w(m)){let s=[".mp3",".mp4",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".epub",".mobi",".zip",".rar",".7z",".tar",".gz"].find(e=>o.href.endsWith(e)||o.text.endsWith(e));if(o.type==="link"){let e=o.href;e.startsWith("https://github.com")&&e.includes("/blob/")&&(e=e.replace("github.com","raw.githubusercontent.com").replace("/blob/","/"));let r=a.basename(p).replace(".md",""),c=a.join(t,n,r);if(u.existsSync(c)||u.mkdirSync(c,{recursive:!0}),o.href.startsWith("https://www.slideshare.net")){let f=r+"_"+o.text.replace(/[<>:"/\\|?*\n\r]+/g,"_").replace(".pptx","").replace(".pdf","")+"_";_chunkKLMDRKHJjs.a.call(void 0, ).startDownloadSlideShare(o.href,c,f,["pptx","pdf"],!1)}else if(s){let f=r+"_"+o.text.replace(/[<>:"/\\|?*\n\r]+/g,"_").replace(s,"")+"_"+a.basename(decodeURIComponent(e));f.endsWith(s)||(f+=s);let b=a.join(c,f);if(!u.existsSync(b)&&(console.log(`Downloading ${e} to ${b}`),await v(e,b,i),d)){let g=new Date().toISOString(),q=`${n},${r},${f},${e},${g}
|
3
|
+
`;u.appendFileSync(d,q)}}else o.href.startsWith("https://qiita.com/")&&_chunkVPQQEJWQjs.a.call(void 0, ).qiitaDl(o.href,c,r+"_",null,!1)}}}function O(t){let n=t.docsDir||a.join(process.cwd(),"docs"),p=t.downloadDir||a.join(process.cwd(),"download");j.sync(`${n}/**/*.md`).forEach(i=>{let h=a.relative(n,i),m=a.dirname(h);E(p,m,i,t.csv,t.insecure).catch(console.error)})}var z={command:"*",describe:"jsd1",builder:{docs:{alias:"d",describe:"docs directory",demandOption:!1,default:"docs",type:"string"},output:{alias:"o",describe:"output directory",demandOption:!1,default:"download",type:"string"},csv:{alias:"c",describe:"csv log file",demandOption:!1,default:"output.csv",type:"string"},insecure:{alias:"k",describe:"allow insecure server connections",demandOption:!1,default:!1,type:"boolean"}},handler(t){(async()=>O({docsDir:t.docs,downloadDir:t.output,csv:t.csv,insecure:!t.insecure}))()}};y.exports=z});var F=()=>{let t=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("jsd1");t.command(x());let n=t.parse()};F();
|
package/dist/qidl/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
|
-
"use strict";var
|
2
|
+
"use strict";var _chunkVPQQEJWQjs = require('../chunk-VPQQEJWQ.js');require('../chunk-KNGN2YR6.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var{qiitaDl:d}=_chunkVPQQEJWQjs.a.call(void 0, ),r={command:"*",describe:"qidl",builder:{url:{alias:"u",describe:"URL",demandOption:!0,type:"string"},dir:{alias:"d",describe:"Save directory",demandOption:!1,default:"./download",type:"string"},prefix:{alias:"p",describe:"prefix",demandOption:!1,type:"string"},pdfengine:{alias:"e",describe:"pdf engine",demandOption:!1,type:"string"},overwrite:{alias:"o",describe:"overwrite",demandOption:!1,type:"boolean"}},handler(e){(async()=>d(e.url,e.dir,e.prefix,e.pdfengine,e.overwrite))()}},a=()=>{let e=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("qidl");e.command(r);let s=e.parse()};a();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "xl1",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.2",
|
4
4
|
"description": "just some xlsx script.",
|
5
5
|
"bin": {
|
6
6
|
"bash1": "dist/bash1/index.js",
|
@@ -11,6 +11,7 @@
|
|
11
11
|
"jsd1": "dist/jsd1/index.js",
|
12
12
|
"jsss": "dist/jsss/index.js",
|
13
13
|
"qidl": "dist/qidl/index.js",
|
14
|
+
"scan-dir": "dist/scan-dir/index.js",
|
14
15
|
"ssdl": "dist/ssdl/index.js",
|
15
16
|
"xl1": "dist/xl1/index.js"
|
16
17
|
},
|
@@ -40,6 +41,7 @@
|
|
40
41
|
"pptxgenjs": "^3.12.0",
|
41
42
|
"puppeteer": "^24.1.1",
|
42
43
|
"sharp": "^0.33.5",
|
44
|
+
"sqlite3": "^5.1.7",
|
43
45
|
"ts-stdin": "^1.0.1",
|
44
46
|
"winston": "^3.17.0",
|
45
47
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|