@mxfb/cli 0.0.68 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -24
- package/scrape-tumblr/index.js +5 -0
- package/scrape-tumblr/index.js.map +7 -0
- package/cli/assets/list.txt +0 -7
- package/cli/assets/version.txt +0 -1
- package/cli/index.js +0 -5
- package/cli/index.js.map +0 -7
- package/make-calendar/index.js +0 -8
- package/make-calendar/index.js.map +0 -7
- package/make-template/assets/html/icons/about.txt +0 -6
- package/make-template/assets/html/icons/android-chrome-192x192.png +0 -0
- package/make-template/assets/html/icons/android-chrome-512x512.png +0 -0
- package/make-template/assets/html/icons/apple-touch-icon.png +0 -0
- package/make-template/assets/html/icons/favicon-16x16.png +0 -0
- package/make-template/assets/html/icons/favicon-32x32.png +0 -0
- package/make-template/assets/html/icons/favicon.ico +0 -0
- package/make-template/assets/html/icons/site.webmanifest +0 -1
- package/make-template/assets/html/index.html +0 -20
- package/make-template/assets/react/gitignore +0 -259
- package/make-template/assets/react/package.json +0 -41
- package/make-template/assets/react/public/icons/about.txt +0 -6
- package/make-template/assets/react/public/icons/android-chrome-192x192.png +0 -0
- package/make-template/assets/react/public/icons/android-chrome-512x512.png +0 -0
- package/make-template/assets/react/public/icons/apple-touch-icon.png +0 -0
- package/make-template/assets/react/public/icons/favicon-16x16.png +0 -0
- package/make-template/assets/react/public/icons/favicon-32x32.png +0 -0
- package/make-template/assets/react/public/icons/favicon.ico +0 -0
- package/make-template/assets/react/public/icons/site.webmanifest +0 -1
- package/make-template/assets/react/public/index.html +0 -19
- package/make-template/assets/react/scripts/build/index.ts +0 -44
- package/make-template/assets/react/scripts/tsconfig.json +0 -21
- package/make-template/assets/react/src/components/App/index.tsx +0 -7
- package/make-template/assets/react/src/components/App/style.module.scss +0 -3
- package/make-template/assets/react/src/index.d.ts +0 -9
- package/make-template/assets/react/src/index.tsx +0 -5
- package/make-template/assets/react/src/tsconfig.json +0 -25
- package/make-template/assets/react/src/utils/some-util/index.ts +0 -1
- package/make-template/index.js +0 -4
- package/make-template/index.js.map +0 -7
- package/mxfb-projects-sync/assets/main.sh +0 -211
- package/mxfb-projects-sync/index.js +0 -5
- package/mxfb-projects-sync/index.js.map +0 -7
- package/term-glossary/index.js +0 -32
- package/term-glossary/index.js.map +0 -7
- package/tree/index.js +0 -3
- package/tree/index.js.map +0 -7
- package/tumblr-crawler/index.js +0 -5
- package/tumblr-crawler/index.js.map +0 -7
package/package.json
CHANGED
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mxfb/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/
|
|
9
|
+
"url": "https://github.com/maximefabas/mf-cli"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "index.js",
|
|
13
13
|
"module": "index.js",
|
|
14
14
|
"bin": {
|
|
15
|
-
"
|
|
16
|
-
"make-calendar": "./make-calendar/index.js",
|
|
17
|
-
"make-template": "./make-template/index.js",
|
|
18
|
-
"mxfb-projects-sync": "./mxfb-projects-sync/index.js",
|
|
19
|
-
"term-glossary": "./term-glossary/index.js",
|
|
20
|
-
"tree": "./tree/index.js",
|
|
21
|
-
"tumblr-crawler": "./tumblr-crawler/index.js"
|
|
15
|
+
"scrape-tumblr": "./scrape-tumblr/index.js"
|
|
22
16
|
},
|
|
23
17
|
"dependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"prompts": "^2.4.2",
|
|
29
|
-
"puppeteer": "^22.6.5"
|
|
18
|
+
"@design-edito/tools": "^0.5.39",
|
|
19
|
+
"@inquirer/prompts": "^8.7.4",
|
|
20
|
+
"@mxfb/tools": "^1.0.3",
|
|
21
|
+
"commander": "^14.0.2"
|
|
30
22
|
},
|
|
31
23
|
"devDependencies": {
|
|
32
|
-
"@types/
|
|
33
|
-
"@types/
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"semver": "^7.6.3",
|
|
39
|
-
"simple-git": "^3.25.0",
|
|
40
|
-
"typescript": "^5.5.4"
|
|
24
|
+
"@types/node": "^25.0.3",
|
|
25
|
+
"@types/semver": "^7.7.1",
|
|
26
|
+
"esbuild": "^0.27.2",
|
|
27
|
+
"semver": "^7.7.3",
|
|
28
|
+
"simple-git": "^3.30.0",
|
|
29
|
+
"typescript": "^5.9.3"
|
|
41
30
|
}
|
|
42
31
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import h from"node:process";import{Command as f,InvalidArgumentError as b}from"commander";import{input as w}from"@inquirer/prompts";import{styles as e}from"@design-edito/tools/agnostic/misc/logs/styles/index.js";import{crawlBlog as $,readArchivePosts as y}from"@mxfb/tools/node/scrapers/@tumblr/index.js";var v=500;function g(o){let t=Number.parseInt(o,10);if(Number.isNaN(t)||t<=0)throw new b("Expected a positive number.");return t}function n(o,t){return`${o} ${t}${o===1?"":"s"}`}function P(o){let{url:t,kind:c,postCount:i,newPostCount:a,error:p}=o;if(p!==null){console.log(e.warning(`${"failed".padEnd(10)}${t}`)),console.log(e.light(` ${p}`));return}let d=a===i?n(i,"post"):`${n(i,"post")}, ${a} new`;console.log(`${e.light((c??"unknown").padEnd(10))}${t}`),console.log(e.light(` ${d}`))}var m=new f().name("scrape-tumblr").description("Archives a Tumblr blog: every page it serves, every post it holds.").argument("[blog-url]","any URL on the blog \u2014 only its origin is used").option("-d, --data-dir <path>","where to write, and where to resume from").option("-l, --limit <count>","stop after this many pages",g).option("--delay <ms>","wait between two requests",g,v).option("-r, --resume","pick up where a previous crawl of the same directory stopped",!1).option("--no-sitemap","walk the listings instead of reading the sitemap").option("-q, --quiet","report only the result",!1).parse(),s=m.opts(),[C]=m.args,l=C??await w({message:"Which blog should be scraped?",default:"https://example.tumblr.com"});l.trim()===""&&(console.log(e.error("No blog to scrape.")),h.exit(1));console.log("");console.log(e.title(`Scraping ${l}...`));console.log(e.light("> starting a headless browser, the blog host refuses plain requests"));console.log("");var r=await $(l,{dataDirPath:s.dataDir,limit:s.limit,delayMs:s.delay,resume:s.resume,useSitemap:s.sitemap,onPageCrawled:s.quiet?void 0:P}),u=await y(r.dataDirPath),D=u.filter(o=>o.publishedOn!==null).length,A=u.filter(o=>o.rawHtml!==null).length;console.log("");console.log(e.title("Scrape complete."));console.log(e.important(r.blog?.title??l));console.log(e.success(`${n(r.pageCount,"page")} read, ${n(r.postCount,"post")} found`));console.log(e.light(`${D} with a date, ${A} with their markup kept`));r.failures.length>0&&console.log(e.warning(`${n(r.failures.length,"page")} could not be read`));console.log(e.info(`
|
|
3
|
+
Archive`));console.log(e.light(r.dataDirPath));console.log(e.info(`
|
|
4
|
+
Resume`));console.log(e.light(`> scrape-tumblr ${l} --data-dir ${r.dataDirPath} --resume`));console.log("");
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/scrape-tumblr/index.ts"],
|
|
4
|
+
"sourcesContent": ["import process from 'node:process'\nimport { Command, InvalidArgumentError } from 'commander'\nimport { input } from '@inquirer/prompts'\nimport { styles } from '@design-edito/tools/agnostic/misc/logs/styles/index.js'\nimport { crawlBlog, readArchivePosts } from '@mxfb/tools/node/scrapers/@tumblr/index.js'\nimport type { CrawledPageReport } from '@mxfb/tools/node/scrapers/@tumblr/types.js'\n\nconst DEFAULT_DELAY_MS = 500\n\ntype CommandOptions = {\n dataDir?: string\n limit?: number\n delay: number\n resume: boolean\n sitemap: boolean\n quiet: boolean\n}\n\nfunction toPositiveInteger (raw: string): number {\n const parsed = Number.parseInt(raw, 10)\n if (Number.isNaN(parsed) || parsed <= 0) throw new InvalidArgumentError('Expected a positive number.')\n return parsed\n}\n\nfunction pluralize (count: number, singular: string): string {\n return `${count} ${singular}${count === 1 ? '' : 's'}`\n}\n\nfunction reportPage (report: CrawledPageReport): void {\n const { url, kind, postCount, newPostCount, error } = report\n if (error !== null) {\n console.log(styles.warning(`${'failed'.padEnd(10)}${url}`))\n console.log(styles.light(` ${error}`))\n return\n }\n const posts = newPostCount === postCount\n ? pluralize(postCount, 'post')\n : `${pluralize(postCount, 'post')}, ${newPostCount} new`\n console.log(`${styles.light((kind ?? 'unknown').padEnd(10))}${url}`)\n console.log(styles.light(` ${posts}`))\n}\n\nconst program = new Command()\n .name('scrape-tumblr')\n .description('Archives a Tumblr blog: every page it serves, every post it holds.')\n .argument('[blog-url]', 'any URL on the blog \u2014 only its origin is used')\n .option('-d, --data-dir <path>', 'where to write, and where to resume from')\n .option('-l, --limit <count>', 'stop after this many pages', toPositiveInteger)\n .option('--delay <ms>', 'wait between two requests', toPositiveInteger, DEFAULT_DELAY_MS)\n .option('-r, --resume', 'pick up where a previous crawl of the same directory stopped', false)\n .option('--no-sitemap', 'walk the listings instead of reading the sitemap')\n .option('-q, --quiet', 'report only the result', false)\n .parse()\n\nconst options = program.opts<CommandOptions>()\nconst [blogUrlArgument] = program.args\n\nconst blogUrl = blogUrlArgument ?? await input({\n message: 'Which blog should be scraped?',\n default: 'https://example.tumblr.com'\n})\n\nif (blogUrl.trim() === '') {\n console.log(styles.error('No blog to scrape.'))\n process.exit(1)\n}\n\nconsole.log('')\nconsole.log(styles.title(`Scraping ${blogUrl}...`))\n// Chrome has to clear the blog host's challenge before anything is readable, which takes a\n// few seconds on the first page and nothing on the ones after.\nconsole.log(styles.light('> starting a headless browser, the blog host refuses plain requests'))\nconsole.log('')\n\nconst result = await crawlBlog(blogUrl, {\n dataDirPath: options.dataDir,\n limit: options.limit,\n delayMs: options.delay,\n resume: options.resume,\n useSitemap: options.sitemap,\n onPageCrawled: options.quiet ? undefined : reportPage\n})\n\nconst posts = await readArchivePosts(result.dataDirPath)\nconst dated = posts.filter(post => post.publishedOn !== null).length\nconst withBody = posts.filter(post => post.rawHtml !== null).length\n\nconsole.log('')\nconsole.log(styles.title('Scrape complete.'))\nconsole.log(styles.important(result.blog?.title ?? blogUrl))\nconsole.log(styles.success(`${pluralize(result.pageCount, 'page')} read, ${pluralize(result.postCount, 'post')} found`))\nconsole.log(styles.light(`${dated} with a date, ${withBody} with their markup kept`))\nif (result.failures.length > 0) {\n console.log(styles.warning(`${pluralize(result.failures.length, 'page')} could not be read`))\n}\nconsole.log(styles.info('\\nArchive'))\nconsole.log(styles.light(result.dataDirPath))\nconsole.log(styles.info('\\nResume'))\nconsole.log(styles.light(`> scrape-tumblr ${blogUrl} --data-dir ${result.dataDirPath} --resume`))\nconsole.log('')\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAa,eACpB,OAAS,WAAAC,EAAS,wBAAAC,MAA4B,YAC9C,OAAS,SAAAC,MAAa,oBACtB,OAAS,UAAAC,MAAc,yDACvB,OAAS,aAAAC,EAAW,oBAAAC,MAAwB,6CAG5C,IAAMC,EAAmB,IAWzB,SAASC,EAAmBC,EAAqB,CAC/C,IAAMC,EAAS,OAAO,SAASD,EAAK,EAAE,EACtC,GAAI,OAAO,MAAMC,CAAM,GAAKA,GAAU,EAAG,MAAM,IAAIR,EAAqB,6BAA6B,EACrG,OAAOQ,CACT,CAEA,SAASC,EAAWC,EAAeC,EAA0B,CAC3D,MAAO,GAAGD,CAAK,IAAIC,CAAQ,GAAGD,IAAU,EAAI,GAAK,GAAG,EACtD,CAEA,SAASE,EAAYC,EAAiC,CACpD,GAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,UAAAC,EAAW,aAAAC,EAAc,MAAAC,CAAM,EAAIL,EACtD,GAAIK,IAAU,KAAM,CAClB,QAAQ,IAAIhB,EAAO,QAAQ,GAAG,SAAS,OAAO,EAAE,CAAC,GAAG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,cAAeA,EAAQ,MAAQ,OAAYT,CAC7C,CAAC,EAEKO,EAAQ,MAAMf,EAAiBoB,EAAO,WAAW,EACjDC,EAAQN,EAAM,OAAOO,GAAQA,EAAK,cAAgB,IAAI,EAAE,OACxDC,EAAWR,EAAM,OAAOO,GAAQA,EAAK,UAAY,IAAI,EAAE,OAE7D,QAAQ,IAAI,EAAE,EACd,QAAQ,IAAIxB,EAAO,MAAM,kBAAkB,CAAC,EAC5C,QAAQ,IAAIA,EAAO,UAAUsB,EAAO,MAAM,OAASD,CAAO,CAAC,EAC3D,QAAQ,IAAIrB,EAAO,QAAQ,GAAGO,EAAUe,EAAO,UAAW,MAAM,CAAC,UAAUf,EAAUe,EAAO,UAAW,MAAM,CAAC,QAAQ,CAAC,EACvH,QAAQ,IAAItB,EAAO,MAAM,GAAGuB,CAAK,iBAAiBE,CAAQ,yBAAyB,CAAC,EAChFH,EAAO,SAAS,OAAS,GAC3B,QAAQ,IAAItB,EAAO,QAAQ,GAAGO,EAAUe,EAAO,SAAS,OAAQ,MAAM,CAAC,oBAAoB,CAAC,EAE9F,QAAQ,IAAItB,EAAO,KAAK;AAAA,QAAW,CAAC,EACpC,QAAQ,IAAIA,EAAO,MAAMsB,EAAO,WAAW,CAAC,EAC5C,QAAQ,IAAItB,EAAO,KAAK;AAAA,OAAU,CAAC,EACnC,QAAQ,IAAIA,EAAO,MAAM,mBAAmBqB,CAAO,eAAeC,EAAO,WAAW,WAAW,CAAC,EAChG,QAAQ,IAAI,EAAE",
|
|
6
|
+
"names": ["process", "Command", "InvalidArgumentError", "input", "styles", "crawlBlog", "readArchivePosts", "DEFAULT_DELAY_MS", "toPositiveInteger", "raw", "parsed", "pluralize", "count", "singular", "reportPage", "report", "url", "kind", "postCount", "newPostCount", "error", "posts", "program", "options", "blogUrlArgument", "blogUrl", "result", "dated", "post", "withBody"]
|
|
7
|
+
}
|
package/cli/assets/list.txt
DELETED
package/cli/assets/version.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.0.68
|
package/cli/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import c from"node:process";import{promises as l}from"node:fs";import u from"node:url";import r from"node:path";import{spawn as h}from"node:child_process";import{program as t}from"commander";var g=u.fileURLToPath(import.meta.url),e=r.dirname(g);t.name("@mxfb/cli").description("The home of @mxfb/cli's project");t.command("list").description("list all the available commands").action(w);t.command("version").description("print current version of the package").action(x);var b=await m();b.forEach(n=>{t.command(n,{hidden:!0}).allowUnknownOption(!0).action(async(...i)=>{let[o,a,s,...p]=c.argv;if(s===void 0)return t.help();if(!(await m()).includes(s))return t.help();let d=r.join(e,"../",s,"index.js");h(d,p,{stdio:"inherit"}).on("error",f=>console.error(`Failed to start subprogram '${s}':`,f))})});t.parse(c.argv);async function m(){let n=r.join(e,"assets/list.txt");return(await l.readFile(n,{encoding:"utf-8"})).split(`
|
|
3
|
-
`).map(o=>o.trim())}async function w(){let i=(await m()).map(o=>{let a=Object.assign(new Array(24).fill(" "),o.split("")).join("");return o==="cli"?`${a} # npx @mxfb/cli help`:`${a} # npx @mxfb/cli ${o} help`}).join(`
|
|
4
|
-
`);console.log(i)}async function x(){let n=r.join(e,"assets/version.txt"),i=await l.readFile(n,{encoding:"utf-8"});console.log(i)}
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
package/cli/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/cli/index.ts"],
|
|
4
|
-
"sourcesContent": ["import process from 'node:process'\nimport { promises as fs } from 'node:fs'\nimport url from 'node:url'\nimport path from 'node:path'\nimport { spawn } from 'node:child_process'\nimport { program } from 'commander'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nprogram\n .name('@mxfb/cli')\n .description('The home of @mxfb/cli\\'s project')\n \nprogram\n .command('list')\n .description('list all the available commands')\n .action(printCommands)\n\nprogram\n .command('version')\n .description('print current version of the package')\n .action(printVersion)\n\nconst subCommands = await listCommands()\nsubCommands.forEach(subCommand => {\n program\n .command(subCommand, { hidden: true })\n .allowUnknownOption(true)\n .action(async (...args) => {\n const [_nodePath, _thisPath, targetCommand, ...forwardedArgs] = process.argv\n if (targetCommand === undefined) return program.help()\n const commandsList = await listCommands()\n if (!commandsList.includes(targetCommand)) return program.help()\n const subprogramPath = path.join(__dirname, '../', targetCommand, 'index.js')\n const subprocess = spawn(subprogramPath, forwardedArgs, { stdio: 'inherit' })\n subprocess.on('error', err => console.error(`Failed to start subprogram '${targetCommand}':`, err))\n })\n})\n\nprogram.parse(process.argv)\n\nasync function listCommands () {\n const listFilePath = path.join(__dirname, 'assets/list.txt')\n const list = await fs.readFile(listFilePath, { encoding: 'utf-8' })\n return list.split('\\n').map(e => e.trim())\n}\n\nasync function printCommands () {\n const list = await listCommands()\n const output = list\n .map(c => {\n const twentyFourCharName = Object.assign(\n new Array(24).fill(' ') as string[],\n c.split('') as string[]\n ).join('')\n if (c === 'cli') return `${twentyFourCharName} # npx @mxfb/cli help`\n return `${twentyFourCharName} # npx @mxfb/cli ${c} help`\n })\n .join('\\n')\n console.log(output)\n return;\n}\n\nasync function printVersion () {\n const versionFilePath = path.join(__dirname, 'assets/version.txt')\n const version = await fs.readFile(versionFilePath, { encoding: 'utf-8' })\n console.log(version)\n return;\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAa,eACpB,OAAS,YAAYC,MAAU,UAC/B,OAAOC,MAAS,WAChB,OAAOC,MAAU,YACjB,OAAS,SAAAC,MAAa,qBACtB,OAAS,WAAAC,MAAe,YAExB,IAAMC,EAAaJ,EAAI,cAAc,YAAY,GAAG,EAC9CK,EAAYJ,EAAK,QAAQG,CAAU,EAEzCD,EACG,KAAK,WAAW,EAChB,YAAY,iCAAkC,EAEjDA,EACG,QAAQ,MAAM,EACd,YAAY,iCAAiC,EAC7C,OAAOG,CAAa,EAEvBH,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,EAAK,KAAKI,EAAW,oBAAoB,EAC3DmB,EAAU,MAAMzB,EAAG,SAASwB,EAAiB,CAAE,SAAU,OAAQ,CAAC,EACxE,QAAQ,IAAIC,CAAO,CAErB",
|
|
6
|
-
"names": ["process", "fs", "url", "path", "spawn", "program", "__filename", "__dirname", "printCommands", "printVersion", "subCommands", "listCommands", "subCommand", "args", "_nodePath", "_thisPath", "targetCommand", "forwardedArgs", "subprogramPath", "err", "listFilePath", "e", "output", "c", "twentyFourCharName", "versionFilePath", "version"]
|
|
7
|
-
}
|
package/make-calendar/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{endOfYear as D,startOfYear as i,endOfMonth as p,getWeek as u,eachWeekOfInterval as g,endOfWeek as S,format as r,getMonth as o,getDate as c}from"date-fns";var O=parseInt(`${process.argv[2]}`);l(O);function l(_){let s=parseInt(`${_}`),m=i(new Date(s,0,1)),d=D(new Date(s,11,31)),f=g({start:m,end:d},{weekStartsOn:1}).map(t=>{let e=t,n=S(e,{weekStartsOn:1}),a=n.getFullYear(),y=u(e,{weekStartsOn:1});return{year:a,number:y,firstDay:e,lastDay:n}});console.log(`\u2502 ${s} Pos\xE9s Solde Note
|
|
3
|
-
\u2502 date \u2014 sem \u2014 l m m j v s + l cp rtt cp rtt
|
|
4
|
-
\u2502 \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014
|
|
5
|
-
\u2502`),f.forEach(t=>{let e=o(t.firstDay)!==o(t.lastDay),n=p(t.firstDay),a=c(t.lastDay)===c(n);console.log(`
|
|
6
|
-
\u2502 ${r(t.firstDay,"MMM dd")} \u203A ${r(t.lastDay,"dd")} \u2014 S ${t.number.toString().padStart(2,"0")} \u2014 _ _ _ _ _ + _ _ ___ ___ ___ ___
|
|
7
|
-
`.trim()),(e||a)&&console.log("\u2502")})}export{l as default};
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/make-calendar/index.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n endOfYear,\n startOfYear,\n endOfMonth,\n getWeek,\n eachWeekOfInterval,\n endOfWeek,\n format as dateFormat,\n getMonth,\n getDate\n} from 'date-fns'\n\ntype WeekData = {\n year: number\n number: number\n firstDay: Date\n lastDay: Date\n}\n\n// [WIP] use commander\n\nconst year = parseInt(`${process.argv[2]}`)\nmakeCalendar(year)\n\nexport default function makeCalendar (inputYear: number) {\n const year = parseInt(`${inputYear}`)\n const start = startOfYear(new Date(year, 0, 1))\n const end = endOfYear(new Date(year, 11, 31))\n const weeksStartDates = eachWeekOfInterval({ start, end }, { weekStartsOn: 1 })\n const weeks: WeekData[] = weeksStartDates.map(weekStartDate => {\n const firstDay = weekStartDate\n const lastDay = endOfWeek(firstDay, { weekStartsOn: 1 });\n const year = lastDay.getFullYear();\n const number = getWeek(firstDay, { weekStartsOn: 1 })\n return {\n year,\n number,\n firstDay,\n lastDay\n }\n })\n console.log(\n`\u2502 ${year} Pos\u00E9s Solde Note\n\u2502 date \u2014 sem \u2014 l m m j v s + l cp rtt cp rtt \n\u2502 \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\u2502`)\n weeks.forEach(weekData => {\n const onTwoMonths = getMonth(weekData.firstDay) !== getMonth(weekData.lastDay)\n const monthEnd = endOfMonth(weekData.firstDay)\n const isMonthEnd = getDate(weekData.lastDay) === getDate(monthEnd)\n console.log(`\n \u2502 ${dateFormat(weekData.firstDay, 'MMM dd')} \u203A ${dateFormat(weekData.lastDay, 'dd')} \u2014 S ${weekData.number.toString().padStart(2, '0')} \u2014 _ _ _ _ _ + _ _ ___ ___ ___ ___\n `.trim())\n if (onTwoMonths || isMonthEnd) console.log('\u2502')\n })\n}\n\n/*`\n62 jours\n \n| Calendrier Pos\u00E9s Solde Note\n| date - sem - l m m j v s + l cp rtt cp rtt \n| ------------------------------------------------------------------------------------------------\n|\n| jan XX \u203A XX - S 01 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jan XX \u203A XX - S 02 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jan XX \u203A XX - S 03 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jan XX \u203A XX - S 04 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jan XX \u203A XX - S 05 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| feb XX \u203A XX - S 06 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| feb XX \u203A XX - S 07 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| feb XX \u203A XX - S 08 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| feb XX \u203A XX - S 09 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| \n| mar XX \u203A XX - S 10 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| mar XX \u203A XX - S 11 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| mar XX \u203A XX - S 12 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| mar XX \u203A XX - S 13 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| apr XX \u203A XX - S 14 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| apr XX \u203A XX - S 15 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| apr XX \u203A XX - S 16 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| apr XX \u203A XX - S 17 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| apr XX \u203A XX - S 18 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| may XX \u203A XX - S 19 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| may XX \u203A XX - S 20 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| may XX \u203A XX - S 21 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| may XX \u203A XX - S 22 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| jun XX \u203A XX - S 23 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jun XX \u203A XX - S 24 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jun XX \u203A XX - S 25 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jun XX \u203A XX - S 26 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| jul XX \u203A XX - S 27 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jul XX \u203A XX - S 28 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jul XX \u203A XX - S 29 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jul XX \u203A XX - S 30 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| jul XX \u203A XX - S 31 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| aug XX \u203A XX - S 32 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| aug XX \u203A XX - S 33 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| aug XX \u203A XX - S 34 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| aug XX \u203A XX - S 35 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| sep XX \u203A XX - S 36 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| sep XX \u203A XX - S 37 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| sep XX \u203A XX - S 38 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| sep XX \u203A XX - S 39 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| sep XX \u203A XX - S 40 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| oct XX \u203A XX - S 41 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| oct XX \u203A XX - S 42 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| oct XX \u203A XX - S 43 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| oct XX \u203A XX - S 44 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| nov XX \u203A XX - S 45 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| nov XX \u203A XX - S 46 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| nov XX \u203A XX - S 47 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| nov XX \u203A XX - S 48 - _ _ _ _ _ _ + _ -10 -10 80 80 \n\n| dec XX \u203A XX - S 49 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| dec XX \u203A XX - S 50 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| dec XX \u203A XX - S 51 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| dec XX \u203A XX - S 52 - _ _ _ _ _ _ + _ -10 -10 80 80 \n| dec XX \u203A XX - S 53 - _ _ _ _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I,QAAG,CAChD,CAAC,CACH",
|
|
6
|
-
"names": ["endOfYear", "startOfYear", "endOfMonth", "getWeek", "eachWeekOfInterval", "endOfWeek", "dateFormat", "getMonth", "getDate", "year", "makeCalendar", "inputYear", "start", "end", "weeks", "weekStartDate", "firstDay", "lastDay", "number", "weekData", "onTwoMonths", "monthEnd", "isMonthEnd"]
|
|
7
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
This favicon was generated using the following font:
|
|
2
|
-
|
|
3
|
-
- Font Title: Reddit Mono
|
|
4
|
-
- Font Author: Copyright (c) 2020-2023, Reddit, Inc. (https://github.com/reddit/redditsans)
|
|
5
|
-
- Font Source: https://fonts.gstatic.com/s/redditmono/v1/oPWc_kRmmu4oQ88oo13o48DHbsqn28eR20vUwCYacnnYz7yQYA.ttf
|
|
6
|
-
- Font License: SIL Open Font License, 1.1 (http://scripts.sil.org/OFL))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self';">
|
|
7
|
-
<meta name="author" content="[AUTHOR]">
|
|
8
|
-
<meta name="description" content="[DESCRIPTION]">
|
|
9
|
-
<meta name="keywords" content="[KEYWORDS]">
|
|
10
|
-
<title>[TITLE]</title>
|
|
11
|
-
<link rel="apple-touch-icon" sizes="180x180" href="./icons/apple-touch-icon.png">
|
|
12
|
-
<link rel="icon" type="image/png" sizes="32x32" href="./icons/favicon-32x32.png">
|
|
13
|
-
<link rel="icon" type="image/png" sizes="16x16" href="./icons/favicon-16x16.png">
|
|
14
|
-
<link rel="manifest" href="./icons/site.webmanifest">
|
|
15
|
-
<link rel="stylesheet" href="./styles/index.css">
|
|
16
|
-
<script type="module" src="./scripts/index.js"></script>
|
|
17
|
-
</head>
|
|
18
|
-
<body>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
dist
|
|
2
|
-
|
|
3
|
-
# Created by https://www.toptal.com/developers/gitignore/api/react,nextjs,node,windows,osx,linux
|
|
4
|
-
# Edit at https://www.toptal.com/developers/gitignore?templates=react,nextjs,node,windows,osx,linux
|
|
5
|
-
|
|
6
|
-
### Linux ###
|
|
7
|
-
*~
|
|
8
|
-
|
|
9
|
-
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
10
|
-
.fuse_hidden*
|
|
11
|
-
|
|
12
|
-
# KDE directory preferences
|
|
13
|
-
.directory
|
|
14
|
-
|
|
15
|
-
# Linux trash folder which might appear on any partition or disk
|
|
16
|
-
.Trash-*
|
|
17
|
-
|
|
18
|
-
# .nfs files are created when an open file is removed but is still being accessed
|
|
19
|
-
.nfs*
|
|
20
|
-
|
|
21
|
-
### NextJS ###
|
|
22
|
-
# dependencies
|
|
23
|
-
/node_modules
|
|
24
|
-
/.pnp
|
|
25
|
-
.pnp.js
|
|
26
|
-
|
|
27
|
-
# testing
|
|
28
|
-
/coverage
|
|
29
|
-
|
|
30
|
-
# next.js
|
|
31
|
-
/.next/
|
|
32
|
-
/out/
|
|
33
|
-
|
|
34
|
-
# production
|
|
35
|
-
/build
|
|
36
|
-
|
|
37
|
-
# misc
|
|
38
|
-
.DS_Store
|
|
39
|
-
*.pem
|
|
40
|
-
|
|
41
|
-
# debug
|
|
42
|
-
npm-debug.log*
|
|
43
|
-
yarn-debug.log*
|
|
44
|
-
yarn-error.log*
|
|
45
|
-
.pnpm-debug.log*
|
|
46
|
-
|
|
47
|
-
# local env files
|
|
48
|
-
.env*.local
|
|
49
|
-
|
|
50
|
-
# vercel
|
|
51
|
-
.vercel
|
|
52
|
-
|
|
53
|
-
# typescript
|
|
54
|
-
*.tsbuildinfo
|
|
55
|
-
next-env.d.ts
|
|
56
|
-
|
|
57
|
-
### Node ###
|
|
58
|
-
# Logs
|
|
59
|
-
logs
|
|
60
|
-
*.log
|
|
61
|
-
lerna-debug.log*
|
|
62
|
-
|
|
63
|
-
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
64
|
-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
65
|
-
|
|
66
|
-
# Runtime data
|
|
67
|
-
pids
|
|
68
|
-
*.pid
|
|
69
|
-
*.seed
|
|
70
|
-
*.pid.lock
|
|
71
|
-
|
|
72
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
73
|
-
lib-cov
|
|
74
|
-
|
|
75
|
-
# Coverage directory used by tools like istanbul
|
|
76
|
-
coverage
|
|
77
|
-
*.lcov
|
|
78
|
-
|
|
79
|
-
# nyc test coverage
|
|
80
|
-
.nyc_output
|
|
81
|
-
|
|
82
|
-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
83
|
-
.grunt
|
|
84
|
-
|
|
85
|
-
# Bower dependency directory (https://bower.io/)
|
|
86
|
-
bower_components
|
|
87
|
-
|
|
88
|
-
# node-waf configuration
|
|
89
|
-
.lock-wscript
|
|
90
|
-
|
|
91
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
92
|
-
build/Release
|
|
93
|
-
|
|
94
|
-
# Dependency directories
|
|
95
|
-
node_modules/
|
|
96
|
-
jspm_packages/
|
|
97
|
-
|
|
98
|
-
# Snowpack dependency directory (https://snowpack.dev/)
|
|
99
|
-
web_modules/
|
|
100
|
-
|
|
101
|
-
# TypeScript cache
|
|
102
|
-
|
|
103
|
-
# Optional npm cache directory
|
|
104
|
-
.npm
|
|
105
|
-
|
|
106
|
-
# Optional eslint cache
|
|
107
|
-
.eslintcache
|
|
108
|
-
|
|
109
|
-
# Optional stylelint cache
|
|
110
|
-
.stylelintcache
|
|
111
|
-
|
|
112
|
-
# Microbundle cache
|
|
113
|
-
.rpt2_cache/
|
|
114
|
-
.rts2_cache_cjs/
|
|
115
|
-
.rts2_cache_es/
|
|
116
|
-
.rts2_cache_umd/
|
|
117
|
-
|
|
118
|
-
# Optional REPL history
|
|
119
|
-
.node_repl_history
|
|
120
|
-
|
|
121
|
-
# Output of 'npm pack'
|
|
122
|
-
*.tgz
|
|
123
|
-
|
|
124
|
-
# Yarn Integrity file
|
|
125
|
-
.yarn-integrity
|
|
126
|
-
|
|
127
|
-
# dotenv environment variable files
|
|
128
|
-
.env
|
|
129
|
-
.env.development.local
|
|
130
|
-
.env.test.local
|
|
131
|
-
.env.production.local
|
|
132
|
-
.env.local
|
|
133
|
-
|
|
134
|
-
# parcel-bundler cache (https://parceljs.org/)
|
|
135
|
-
.cache
|
|
136
|
-
.parcel-cache
|
|
137
|
-
|
|
138
|
-
# Next.js build output
|
|
139
|
-
.next
|
|
140
|
-
out
|
|
141
|
-
|
|
142
|
-
# Nuxt.js build / generate output
|
|
143
|
-
.nuxt
|
|
144
|
-
dist
|
|
145
|
-
|
|
146
|
-
# Gatsby files
|
|
147
|
-
.cache/
|
|
148
|
-
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
149
|
-
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
150
|
-
# public
|
|
151
|
-
|
|
152
|
-
# vuepress build output
|
|
153
|
-
.vuepress/dist
|
|
154
|
-
|
|
155
|
-
# vuepress v2.x temp and cache directory
|
|
156
|
-
.temp
|
|
157
|
-
|
|
158
|
-
# Docusaurus cache and generated files
|
|
159
|
-
.docusaurus
|
|
160
|
-
|
|
161
|
-
# Serverless directories
|
|
162
|
-
.serverless/
|
|
163
|
-
|
|
164
|
-
# FuseBox cache
|
|
165
|
-
.fusebox/
|
|
166
|
-
|
|
167
|
-
# DynamoDB Local files
|
|
168
|
-
.dynamodb/
|
|
169
|
-
|
|
170
|
-
# TernJS port file
|
|
171
|
-
.tern-port
|
|
172
|
-
|
|
173
|
-
# Stores VSCode versions used for testing VSCode extensions
|
|
174
|
-
.vscode-test
|
|
175
|
-
|
|
176
|
-
# yarn v2
|
|
177
|
-
.yarn/cache
|
|
178
|
-
.yarn/unplugged
|
|
179
|
-
.yarn/build-state.yml
|
|
180
|
-
.yarn/install-state.gz
|
|
181
|
-
.pnp.*
|
|
182
|
-
|
|
183
|
-
### Node Patch ###
|
|
184
|
-
# Serverless Webpack directories
|
|
185
|
-
.webpack/
|
|
186
|
-
|
|
187
|
-
# Optional stylelint cache
|
|
188
|
-
|
|
189
|
-
# SvelteKit build / generate output
|
|
190
|
-
.svelte-kit
|
|
191
|
-
|
|
192
|
-
### OSX ###
|
|
193
|
-
# General
|
|
194
|
-
.AppleDouble
|
|
195
|
-
.LSOverride
|
|
196
|
-
|
|
197
|
-
# Icon must end with two \r
|
|
198
|
-
Icon
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
# Thumbnails
|
|
202
|
-
._*
|
|
203
|
-
|
|
204
|
-
# Files that might appear in the root of a volume
|
|
205
|
-
.DocumentRevisions-V100
|
|
206
|
-
.fseventsd
|
|
207
|
-
.Spotlight-V100
|
|
208
|
-
.TemporaryItems
|
|
209
|
-
.Trashes
|
|
210
|
-
.VolumeIcon.icns
|
|
211
|
-
.com.apple.timemachine.donotpresent
|
|
212
|
-
|
|
213
|
-
# Directories potentially created on remote AFP share
|
|
214
|
-
.AppleDB
|
|
215
|
-
.AppleDesktop
|
|
216
|
-
Network Trash Folder
|
|
217
|
-
Temporary Items
|
|
218
|
-
.apdisk
|
|
219
|
-
|
|
220
|
-
### react ###
|
|
221
|
-
.DS_*
|
|
222
|
-
**/*.backup.*
|
|
223
|
-
**/*.back.*
|
|
224
|
-
|
|
225
|
-
node_modules
|
|
226
|
-
|
|
227
|
-
*.sublime*
|
|
228
|
-
|
|
229
|
-
psd
|
|
230
|
-
thumb
|
|
231
|
-
sketch
|
|
232
|
-
|
|
233
|
-
### Windows ###
|
|
234
|
-
# Windows thumbnail cache files
|
|
235
|
-
Thumbs.db
|
|
236
|
-
Thumbs.db:encryptable
|
|
237
|
-
ehthumbs.db
|
|
238
|
-
ehthumbs_vista.db
|
|
239
|
-
|
|
240
|
-
# Dump file
|
|
241
|
-
*.stackdump
|
|
242
|
-
|
|
243
|
-
# Folder config file
|
|
244
|
-
[Dd]esktop.ini
|
|
245
|
-
|
|
246
|
-
# Recycle Bin used on file shares
|
|
247
|
-
$RECYCLE.BIN/
|
|
248
|
-
|
|
249
|
-
# Windows Installer files
|
|
250
|
-
*.cab
|
|
251
|
-
*.msi
|
|
252
|
-
*.msix
|
|
253
|
-
*.msm
|
|
254
|
-
*.msp
|
|
255
|
-
|
|
256
|
-
# Windows shortcuts
|
|
257
|
-
*.lnk
|
|
258
|
-
|
|
259
|
-
# End of https://www.toptal.com/developers/gitignore/api/react,nextjs,node,windows,osx,linux
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "-",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build:scripts": "npx tsc -p scripts/tsconfig.json",
|
|
9
|
-
"build:public": "cp -r public/* dist",
|
|
10
|
-
"build:src": "npm run build:scripts && node .scripts/build/index.js",
|
|
11
|
-
"build:src:preact": "PREACT=true npm run build:src",
|
|
12
|
-
"watch:public": "npx chokidar-cli 'public/**/*' -c 'npm run build:public'",
|
|
13
|
-
"watch:src": "WATCH=true npm run build:src",
|
|
14
|
-
"watch:src:preact": "PREACT=true npm run watch:src",
|
|
15
|
-
"make:dist": "mkdir -p dist",
|
|
16
|
-
"serve:dist": "npm run make:dist && npx http-server dist --port ${PORT} --cors -c-1",
|
|
17
|
-
"start": "npx concurrently -n 'watch:src ,watch:public,serve:dist ' 'npm run watch:src' 'npm run watch:public' 'PORT=${PORT_DIST:-3000} npm run serve:dist'",
|
|
18
|
-
"start:preact": "PREACT=true npm start"
|
|
19
|
-
},
|
|
20
|
-
"author": "",
|
|
21
|
-
"license": "ISC",
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/node": "^20.11.30",
|
|
24
|
-
"@types/react": "^18.2.72",
|
|
25
|
-
"@types/react-dom": "^18.2.22",
|
|
26
|
-
"concurrently": "^8.2.2",
|
|
27
|
-
"http-server": "^14.1.1",
|
|
28
|
-
"typescript": "^5.4.3",
|
|
29
|
-
"esbuild": "^0.20.2",
|
|
30
|
-
"esbuild-plugin-inline-image": "^0.0.9",
|
|
31
|
-
"esbuild-sass-plugin": "^3.2.0",
|
|
32
|
-
"postcss": "^8.4.38",
|
|
33
|
-
"postcss-modules": "^6.0.0",
|
|
34
|
-
"sass": "^1.74.1"
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"preact": "^10.20.1",
|
|
38
|
-
"react": "^18.2.0",
|
|
39
|
-
"react-dom": "^18.2.0"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
This favicon was generated using the following font:
|
|
2
|
-
|
|
3
|
-
- Font Title: Reddit Mono
|
|
4
|
-
- Font Author: Copyright (c) 2020-2023, Reddit, Inc. (https://github.com/reddit/redditsans)
|
|
5
|
-
- Font Source: https://fonts.gstatic.com/s/redditmono/v1/oPWc_kRmmu4oQ88oo13o48DHbsqn28eR20vUwCYacnnYz7yQYA.ttf
|
|
6
|
-
- Font License: SIL Open Font License, 1.1 (http://scripts.sil.org/OFL))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<meta name="description" content="PAGE DESCRIPTION">
|
|
7
|
-
<meta author="AUTHOR">
|
|
8
|
-
<title>TITLE</title>
|
|
9
|
-
<link rel="apple-touch-icon" sizes="180x180" href="./icons/apple-touch-icon.png">
|
|
10
|
-
<link rel="icon" type="image/png" sizes="32x32" href="./icons/favicon-32x32.png">
|
|
11
|
-
<link rel="icon" type="image/png" sizes="16x16" href="./icons/favicon-16x16.png">
|
|
12
|
-
<link rel="manifest" href="./icons/site.webmanifest">
|
|
13
|
-
<script type="module" src="http://localhost:3001/index.js"></script>
|
|
14
|
-
<link rel="stylesheet" href="http://localhost:3001/index.css">
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<div class="root"></div>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import esbuild, { BuildOptions } from 'esbuild'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
import { sassPlugin, postcssModules } from 'esbuild-sass-plugin'
|
|
4
|
-
import inlineImageModule from 'esbuild-plugin-inline-image'
|
|
5
|
-
|
|
6
|
-
const PREACT = process.env.PREACT === 'true'
|
|
7
|
-
const WATCH = process.env.WATCH === 'true'
|
|
8
|
-
|
|
9
|
-
console.log(`scripts/build/index.ts PREACT=${PREACT} WATCH=${WATCH}`)
|
|
10
|
-
|
|
11
|
-
const options: BuildOptions = {
|
|
12
|
-
format: 'esm',
|
|
13
|
-
entryPoints: [path.join(process.cwd(), 'src/index.tsx')],
|
|
14
|
-
bundle: true,
|
|
15
|
-
outfile: path.join(process.cwd(), 'dist/index.js'),
|
|
16
|
-
minify: true,
|
|
17
|
-
platform: 'browser',
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
target: ['esnext'],
|
|
20
|
-
tsconfig: path.join(process.cwd(), 'src/tsconfig.json'),
|
|
21
|
-
logLevel: 'info',
|
|
22
|
-
jsxFactory: PREACT ? 'h' : 'React.createElement',
|
|
23
|
-
jsxFragment: PREACT ? 'FRAGMENT' : 'React.Fragment',
|
|
24
|
-
plugins: [
|
|
25
|
-
inlineImageModule({ limit: -1 }),
|
|
26
|
-
sassPlugin({ filter: /\.module\.scss$/, type: 'css', transform: postcssModules({}) }),
|
|
27
|
-
sassPlugin({ filter: /.scss$/, type: 'css' })
|
|
28
|
-
],
|
|
29
|
-
alias: PREACT ? {
|
|
30
|
-
'react': 'preact/compat',
|
|
31
|
-
'react-dom/test-utils': 'preact/test-utils',
|
|
32
|
-
'react-dom': 'preact/compat',
|
|
33
|
-
'react/jsx-runtime': 'preact/jsx-runtime'
|
|
34
|
-
} : {}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (WATCH) {
|
|
38
|
-
const ctx = await esbuild.context(options)
|
|
39
|
-
await ctx.watch()
|
|
40
|
-
console.log('watching...')
|
|
41
|
-
} else {
|
|
42
|
-
await esbuild.build(options)
|
|
43
|
-
console.log('built.')
|
|
44
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"strict": true,
|
|
4
|
-
"lib": ["ESNext"],
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"target": "ESNext",
|
|
7
|
-
"baseUrl": ".",
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"outDir": "../.scripts",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"moduleResolution": "Node",
|
|
13
|
-
"rootDir": ".",
|
|
14
|
-
"noUncheckedIndexedAccess": true,
|
|
15
|
-
},
|
|
16
|
-
"include": ["**/*"],
|
|
17
|
-
"exclude": [
|
|
18
|
-
"../node_modules",
|
|
19
|
-
"../.scripts"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"noUncheckedIndexedAccess": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"module": "esnext",
|
|
13
|
-
"moduleResolution": "node",
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
|
-
"noEmit": true,
|
|
17
|
-
"jsx": "react-jsx",
|
|
18
|
-
"paths": {
|
|
19
|
-
"~/components/*": ["./components/*"],
|
|
20
|
-
"~/utils/*": ["./utils/*"]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"include": ["./"],
|
|
24
|
-
"files": ["./index.d.ts"]
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|
package/make-template/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import n from"node:process";import{promises as a,existsSync as u}from"node:fs";import j from"node:url";import t from"node:path";import{spawn as w}from"node:child_process";import{program as i}from"commander";import y from"prompts";import{Files as P}from"@mxfb/tools/node/files";var k=j.fileURLToPath(import.meta.url),d=t.dirname(k),c=n.cwd();i.name("@mxfb/make-template").description("Generate in cwd a project template");i.command("html").description("make simple html project structure").action(x);i.command("react").description("make react + typescript project structure").action(S);i.parse(n.argv);async function x(){let e=t.join(d,"assets/html");if(!u(e))return console.error(`Could not find the template to copy at ${e}`),n.exit(1);let o=t.join(c,"html-template");await a.cp(e,o,{recursive:!0})}async function S(){let e=t.join(d,"assets/react");if(!u(e))return console.error(`Could not find the template to copy at ${e}`),n.exit(1);let o=t.join(c,"react-template");await a.cp(e,o,{recursive:!0});let{projectName:p}=await y({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),g=t.join(o,"package.json");await P.readWrite(g,r=>{let s=typeof r=="string"?r:r.toString(),f=JSON.parse(s);delete f.name;let h={name:p,...f};return`${JSON.stringify(h,null,2)}
|
|
3
|
-
`},{encoding:"utf-8"});let l=w(`cd ${o} && npm i`,{stdio:"inherit",shell:!0});await new Promise((r,s)=>{l.on("exit",()=>r(!0)),l.on("error",()=>s(!1))});let m=t.join(c,p);await a.rename(o,m),await a.rename(t.join(m,"gitignore"),t.join(m,".gitignore"))}
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/make-template/index.ts"],
|
|
4
|
-
"sourcesContent": ["import process from 'node:process'\nimport { promises as fs, existsSync } from 'node:fs'\nimport url from 'node:url'\nimport path from 'node:path'\nimport { spawn } from 'node:child_process'\nimport { program } from 'commander'\nimport prompts from 'prompts'\nimport { Files } from '@mxfb/tools/node/files'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\nconst CWD = process.cwd()\n\nprogram\n .name('@mxfb/make-template')\n .description('Generate in cwd a project template')\n \nprogram\n .command('html')\n .description('make simple html project structure')\n .action(makeHtml)\n\nprogram\n .command('react')\n .description('make react + typescript project structure')\n .action(makeReact)\n\nprogram.parse(process.argv)\n\nasync function makeHtml () {\n const htmlTemplatePath = path.join(__dirname, 'assets/html')\n if (!existsSync(htmlTemplatePath)) {\n console.error(`Could not find the template to copy at ${htmlTemplatePath}`)\n return process.exit(1)\n }\n const targetPath = path.join(CWD, 'html-template')\n await fs.cp(htmlTemplatePath, targetPath, { recursive: true })\n}\n\nasync function makeReact () {\n const htmlTemplatePath = path.join(__dirname, 'assets/react')\n if (!existsSync(htmlTemplatePath)) {\n console.error(`Could not find the template to copy at ${htmlTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'react-template')\n \n // Copy\n await fs.cp(htmlTemplatePath, defaultTargetPath, { recursive: true })\n const { projectName } = await prompts({\n name: 'projectName',\n message: 'Project name ? (for package.json name field)',\n type: 'text'\n })\n \n // Custom name\n const packageJsonPath = path.join(defaultTargetPath, 'package.json')\n await Files.readWrite(packageJsonPath, rawContent => {\n const content = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n const contentObj = JSON.parse(content) as Record<string, string>\n delete contentObj.name\n const newContentObj = {\n name: projectName,\n ...contentObj\n }\n return `${JSON.stringify(newContentObj, null, 2)}\\n`\n }, { encoding: 'utf-8' })\n \n // Install deps\n const npmISubprocess = spawn(`cd ${defaultTargetPath} && npm i`, { stdio: 'inherit', shell: true })\n await new Promise((resolve, reject) => {\n npmISubprocess.on('exit', () => resolve(true))\n npmISubprocess.on('error', () => reject(false))\n })\n\n // Rename project\n const targetPath = path.join(CWD, projectName)\n await fs.rename(defaultTargetPath, targetPath)\n\n // Rename gitignore\n await fs.rename(\n path.join(targetPath, 'gitignore'),\n path.join(targetPath, '.gitignore')\n )\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAa,eACpB,OAAS,YAAYC,EAAI,cAAAC,MAAkB,UAC3C,OAAOC,MAAS,WAChB,OAAOC,MAAU,YACjB,OAAS,SAAAC,MAAa,qBACtB,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAa,UACpB,OAAS,SAAAC,MAAa,yBAEtB,IAAMC,EAAaN,EAAI,cAAc,YAAY,GAAG,EAC9CO,EAAYN,EAAK,QAAQK,CAAU,EACnCE,EAAMX,EAAQ,IAAI,EAExBM,EACG,KAAK,qBAAqB,EAC1B,YAAY,oCAAoC,EAEnDA,EACG,QAAQ,MAAM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EAAK,CAAC,EAClG,MAAM,IAAI,QAAQ,CAACQ,EAASC,IAAW,CACrCF,EAAe,GAAG,OAAQ,IAAMC,EAAQ,EAAI,CAAC,EAC7CD,EAAe,GAAG,QAAS,IAAME,EAAO,EAAK,CAAC,CAChD,CAAC,EAGD,IAAMV,EAAaX,EAAK,KAAKO,EAAKM,CAAW,EAC7C,MAAMhB,EAAG,OAAOe,EAAmBD,CAAU,EAG7C,MAAMd,EAAG,OACPG,EAAK,KAAKW,EAAY,WAAW,EACjCX,EAAK,KAAKW,EAAY,YAAY,CACpC,CACF",
|
|
6
|
-
"names": ["process", "fs", "existsSync", "url", "path", "spawn", "program", "prompts", "Files", "__filename", "__dirname", "CWD", "makeHtml", "makeReact", "htmlTemplatePath", "targetPath", "defaultTargetPath", "projectName", "packageJsonPath", "rawContent", "content", "contentObj", "newContentObj", "npmISubprocess", "resolve", "reject"]
|
|
7
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
if [ "$#" -ne 2 ]; then
|
|
4
|
-
echo "2 arguments expected Usage: $0 <lemonde_path> <mxfb_path>"
|
|
5
|
-
exit 1
|
|
6
|
-
fi
|
|
7
|
-
|
|
8
|
-
LMDIRPATH="$1"
|
|
9
|
-
MXFBDIRPATH="$2"
|
|
10
|
-
|
|
11
|
-
function bold () {
|
|
12
|
-
echo "\033[1m$1\033[m"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function black_on_white() {
|
|
16
|
-
echo "\033[7m $1 \033[0m"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function throw () {
|
|
20
|
-
if [[ -z "$1" ]]; then
|
|
21
|
-
exit 1
|
|
22
|
-
fi
|
|
23
|
-
echo "$(bold "Error: $1")"
|
|
24
|
-
exit 1
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function relative () {
|
|
28
|
-
if [[ -z "$1" ]]; then
|
|
29
|
-
throw "Missing arguments. Usage: relative <path>"
|
|
30
|
-
fi
|
|
31
|
-
(cd "$1" && pwd) | sed "s|^$HOME/||"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function prompt_continue () {
|
|
35
|
-
read -p "$(bold "Continue?") (y/n) " cont
|
|
36
|
-
if [[ "$cont" != "y" ]]; then
|
|
37
|
-
echo ""
|
|
38
|
-
echo $(bold "Bye.")
|
|
39
|
-
echo ""
|
|
40
|
-
exit 0
|
|
41
|
-
else
|
|
42
|
-
echo "\n"
|
|
43
|
-
fi
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function git_status () {
|
|
47
|
-
if [[ -z "$1" ]]; then
|
|
48
|
-
throw "Missing arguments. Usage: git_status <path>"
|
|
49
|
-
fi
|
|
50
|
-
echo "$(bold "$(black_on_white "Checking git status in $(relative "$1")...")")"
|
|
51
|
-
echo "\n"
|
|
52
|
-
prompt_continue
|
|
53
|
-
cd $1
|
|
54
|
-
git status
|
|
55
|
-
echo "\n"
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function git_log () {
|
|
59
|
-
if [[ -z "$1" ]]; then
|
|
60
|
-
throw "Missing arguments. Usage: git_status <path>"
|
|
61
|
-
fi
|
|
62
|
-
echo "$(bold "$(black_on_white "Logging git history in $(relative "$1")...")")"
|
|
63
|
-
echo "\n"
|
|
64
|
-
cd $1
|
|
65
|
-
git log
|
|
66
|
-
echo "\n"
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function git_pull_master () {
|
|
70
|
-
if [[ -z "$1" ]]; then
|
|
71
|
-
throw "Missing arguments. Usage: git_pull_master <path>"
|
|
72
|
-
fi
|
|
73
|
-
echo "$(bold "$(black_on_white "Pulling origin/master in $(relative "$1")...")")"
|
|
74
|
-
echo "\n"
|
|
75
|
-
prompt_continue
|
|
76
|
-
cd $1
|
|
77
|
-
git pull origin master
|
|
78
|
-
echo "\n"
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function git_push_master () {
|
|
82
|
-
if [[ -z "$1" ]]; then
|
|
83
|
-
throw "Missing arguments. Usage: git_push_master <path>"
|
|
84
|
-
fi
|
|
85
|
-
echo "$(bold "$(black_on_white "Pushing origin/master in $(relative "$1")...")")"
|
|
86
|
-
echo "\n"
|
|
87
|
-
prompt_continue
|
|
88
|
-
cd $1
|
|
89
|
-
git push origin master
|
|
90
|
-
echo "\n"
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function git_fetch_upstream_master () {
|
|
94
|
-
if [[ -z "$1" ]]; then
|
|
95
|
-
throw "Missing arguments. Usage: git_fetch_upstream_master <path>"
|
|
96
|
-
fi
|
|
97
|
-
echo "$(bold "$(black_on_white "Fetching upstream/master in $(relative "$1")...")")"
|
|
98
|
-
echo "\n"
|
|
99
|
-
prompt_continue
|
|
100
|
-
cd $1
|
|
101
|
-
git fetch upstream master
|
|
102
|
-
echo "\n"
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function git_merge_upstream_master () {
|
|
106
|
-
if [[ -z "$1" ]]; then
|
|
107
|
-
throw "Missing arguments. Usage: git_merge_upstream_master <path>"
|
|
108
|
-
fi
|
|
109
|
-
echo "$(bold "$(black_on_white "Merging upstream/master in $(relative "$1")..")")"
|
|
110
|
-
echo "\n"
|
|
111
|
-
prompt_continue
|
|
112
|
-
cd $1
|
|
113
|
-
git merge upstream/master
|
|
114
|
-
echo "\n"
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function npm_install () {
|
|
118
|
-
if [[ -z "$1" ]]; then
|
|
119
|
-
throw "Missing arguments. Usage: npm_instann <path>"
|
|
120
|
-
fi
|
|
121
|
-
echo "$(bold "$(black_on_white "Installing NPM dependencies in $(relative "$1")..")")"
|
|
122
|
-
echo "\n"
|
|
123
|
-
prompt_continue
|
|
124
|
-
cd $1
|
|
125
|
-
npm install
|
|
126
|
-
echo "\n"
|
|
127
|
-
if [[ -n "$2" ]]; then
|
|
128
|
-
echo "installing $2"
|
|
129
|
-
npm install "$2"
|
|
130
|
-
echo "\n"
|
|
131
|
-
fi
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function build () {
|
|
135
|
-
if [[ -z "$1" || -z "$2" ]]; then
|
|
136
|
-
throw "Missing arguments. Usage: build <path> <build_command>"
|
|
137
|
-
fi
|
|
138
|
-
echo "$(bold "$(black_on_white "Building $(relative "$1")..")")"
|
|
139
|
-
echo "\n"
|
|
140
|
-
prompt_continue
|
|
141
|
-
cd $1
|
|
142
|
-
npm run $2
|
|
143
|
-
echo "\n"
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function publish () {
|
|
147
|
-
if [[ -z "$1" ]]; then
|
|
148
|
-
throw "Missing arguments. Usage: npm_instann <path>"
|
|
149
|
-
fi
|
|
150
|
-
cd $1
|
|
151
|
-
read -p "$(bold "$(black_on_white "Do you want to publish to NPM ?")") (y/n) " cont
|
|
152
|
-
echo "\n"
|
|
153
|
-
if [[ "$cont" == "y" ]]; then
|
|
154
|
-
read -p "Enter OTP : " otp
|
|
155
|
-
if [[ "$otp" == "-" ]]; then
|
|
156
|
-
echo "\n"
|
|
157
|
-
return
|
|
158
|
-
fi
|
|
159
|
-
if [[ ${#otp} -eq 6 ]]; then
|
|
160
|
-
OTP=$otp npm publish
|
|
161
|
-
git_push_master "$1"
|
|
162
|
-
echo "\n"
|
|
163
|
-
else
|
|
164
|
-
throw "Invalid OTP. OTP must be 6 characters long."
|
|
165
|
-
fi
|
|
166
|
-
fi
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
# INIT
|
|
170
|
-
echo "\n"
|
|
171
|
-
|
|
172
|
-
# LM TOOLS
|
|
173
|
-
git_status "$LMDIRPATH/lm-tools"
|
|
174
|
-
git_pull_master "$LMDIRPATH/lm-tools"
|
|
175
|
-
npm_install "$LMDIRPATH/lm-tools"
|
|
176
|
-
build "$LMDIRPATH/lm-tools" "build:src"
|
|
177
|
-
git_status "$LMDIRPATH/lm-tools"
|
|
178
|
-
publish "$LMDIRPATH/lm-tools"
|
|
179
|
-
|
|
180
|
-
# LM CLI
|
|
181
|
-
git_status "$LMDIRPATH/lm-cli"
|
|
182
|
-
git_pull_master "$LMDIRPATH/lm-cli"
|
|
183
|
-
npm_install "$LMDIRPATH/lm-cli" "@design-edito/tools@latest"
|
|
184
|
-
build "$LMDIRPATH/lm-cli" "build:src"
|
|
185
|
-
git_status "$LMDIRPATH/lm-cli"
|
|
186
|
-
publish "$LMDIRPATH/lm-cli"
|
|
187
|
-
|
|
188
|
-
# MXFB TOOLS
|
|
189
|
-
git_status "$MXFBDIRPATH/tools"
|
|
190
|
-
git_pull_master "$MXFBDIRPATH/tools"
|
|
191
|
-
git_fetch_upstream_master "$MXFBDIRPATH/tools"
|
|
192
|
-
git_merge_upstream_master "$MXFBDIRPATH/tools"
|
|
193
|
-
git_status "$MXFBDIRPATH/tools"
|
|
194
|
-
git_push_master "$MXFBDIRPATH/tools"
|
|
195
|
-
npm_install "$MXFBDIRPATH/tools"
|
|
196
|
-
build "$MXFBDIRPATH/tools" "build:src"
|
|
197
|
-
publish "$MXFBDIRPATH/tools"
|
|
198
|
-
|
|
199
|
-
# MXFB CLI
|
|
200
|
-
git_status "$MXFBDIRPATH/cli"
|
|
201
|
-
git_pull_master "$MXFBDIRPATH/cli"
|
|
202
|
-
git_fetch_upstream_master "$MXFBDIRPATH/cli"
|
|
203
|
-
git_merge_upstream_master "$MXFBDIRPATH/cli"
|
|
204
|
-
git_status "$MXFBDIRPATH/cli"
|
|
205
|
-
git_push_master "$MXFBDIRPATH/cli"
|
|
206
|
-
npm_install "$MXFBDIRPATH/cli" "@mxfb/tools@latest"
|
|
207
|
-
build "$MXFBDIRPATH/cli" "build:src"
|
|
208
|
-
publish "$MXFBDIRPATH/cli"
|
|
209
|
-
|
|
210
|
-
# END
|
|
211
|
-
echo "$(bold "Everything done. Bye.")\n"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import a from"node:process";import b from"node:url";import m from"node:path";import y from"node:os";import{program as g}from"commander";import s from"prompts";import{getConfig as P,updateConfig as w}from"@mxfb/tools/utils/node/mxfb-cli-config/index.js";import{spawn as _}from"node:child_process";var M=b.fileURLToPath(import.meta.url),v=m.dirname(M),d=a.cwd();g.name("@mxfb/mxfb-projects-sync").description("Keep in sync the different git repos for mxfb/tools & mxfb/cli").argument("[lmpath]","Path for Le Monde folder").argument("[mxfbpath]","Path for Mxfb folder").action(async(o,f,$)=>{let i=await P(!0);if(i instanceof Error)throw i;let{mxfb_projects_sync:{lm_path:p,mxfb_path:c}={}}=i,e="";if(o!==void 0)e=n(`${o}`);else{let{promptsLmPath:t}=await s({type:"text",name:"promptsLmPath",message:`Path to Le Monde directory (absolute or relative to ${d})`,initial:p??""});e=n(`${t}`)}let r="";if(f!==void 0)r=n(`${f}`);else{let{promptsMxfbPath:t}=await s({type:"text",name:"promptsMxfbPath",message:`Path to Mxfb directory (absolute or relative to ${d})`,initial:c??""});r=n(`${t}`)}console.log("Le Monde:",e),console.log("Mxfb: ",r);let{pathsAreOk:u}=await s({type:"confirm",name:"pathsAreOk",message:"Continue using those paths?"});if(u!==!0&&(console.log(`
|
|
3
|
-
Bye.
|
|
4
|
-
`),a.exit(0)),e!==p||r!==c){let{savePaths:t}=await s({type:"confirm",name:"savePaths",message:"Do you want to save those paths for the next time ?"});if(t===!0){let l=await w(x=>({...x,mxfb_projects_sync:{lm_path:e,mxfb_path:r}}),!0);if(l instanceof Error)throw l;console.log("Saved.")}}let h=_("sh",[m.join(v,"./assets/main.sh"),e,r],{stdio:"inherit"});h.on("error",t=>console.error(`Error: ${t.message}`)),h.on("close",t=>console.error(`main.sh exited with code ${t}`))});g.parse(a.argv);function n(o){return o.startsWith("~/")?m.join(y.homedir(),o.slice(2)):o}
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/mxfb-projects-sync/index.ts"],
|
|
4
|
-
"sourcesContent": ["import process from 'node:process'\nimport url from 'node:url'\nimport path from 'node:path'\nimport os from 'node:os'\nimport { program } from 'commander'\nimport prompts from 'prompts'\nimport { getConfig, updateConfig } from '@mxfb/tools/utils/node/mxfb-cli-config/index.js'\nimport { spawn } from 'node:child_process'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\nconst CWD = process.cwd()\n\nprogram\n .name('@mxfb/mxfb-projects-sync')\n .description('Keep in sync the different git repos for mxfb/tools & mxfb/cli')\n .argument('[lmpath]', 'Path for Le Monde folder')\n .argument('[mxfbpath]', 'Path for Mxfb folder')\n .action(async (_lmpath, _mxfbpath, options) => {\n const config = await getConfig(true)\n if (config instanceof Error) throw config\n const { mxfb_projects_sync: {\n lm_path: configLmPath,\n mxfb_path: configMxfbPath\n } = {} } = config\n \n let lmPath: string = ''\n if (_lmpath !== undefined) { lmPath = resolveHome(`${_lmpath}`) }\n else {\n const { promptsLmPath } = await prompts({\n type: 'text',\n name: 'promptsLmPath',\n message: `Path to Le Monde directory (absolute or relative to ${CWD})`,\n initial: configLmPath ?? ''\n })\n lmPath = resolveHome(`${promptsLmPath}`)\n }\n \n let mxfbPath: string = ''\n if (_mxfbpath !== undefined) { mxfbPath = resolveHome(`${_mxfbpath}`) }\n else {\n const { promptsMxfbPath } = await prompts({\n type: 'text',\n name: 'promptsMxfbPath',\n message: `Path to Mxfb directory (absolute or relative to ${CWD})`,\n initial: configMxfbPath ?? ''\n })\n mxfbPath = resolveHome(`${promptsMxfbPath}`)\n }\n\n console.log('Le Monde:', lmPath)\n console.log('Mxfb: ', mxfbPath)\n const { pathsAreOk } = await prompts({\n type: 'confirm',\n name: 'pathsAreOk',\n message: 'Continue using those paths?'\n })\n if (pathsAreOk !== true) {\n console.log('\\nBye.\\n')\n process.exit(0)\n }\n if (lmPath !== configLmPath || mxfbPath !== configMxfbPath) {\n const { savePaths } = await prompts({\n type: 'confirm',\n name: 'savePaths',\n message: 'Do you want to save those paths for the next time ?'\n })\n if (savePaths === true) {\n const updated = await updateConfig(curr => ({\n ...curr,\n mxfb_projects_sync: {\n lm_path: lmPath,\n mxfb_path: mxfbPath\n }\n }), true)\n if (updated instanceof Error) throw updated\n console.log('Saved.')\n }\n }\n \n const shellScriptExecution = spawn('sh', [path.join(__dirname, './assets/main.sh'), lmPath, mxfbPath], { stdio: 'inherit' })\n shellScriptExecution.on('error', err => console.error(`Error: ${err.message}`))\n shellScriptExecution.on('close', code => console.error(`main.sh exited with code ${code}`))\n })\n\nprogram.parse(process.argv)\n\nfunction resolveHome (filePath: string) {\n if (filePath.startsWith('~/')) return path.join(os.homedir(), filePath.slice(2))\n return filePath\n}\n\n"],
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAa,eACpB,OAAOC,MAAS,WAChB,OAAOC,MAAU,YACjB,OAAOC,MAAQ,UACf,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAa,UACpB,OAAS,aAAAC,EAAW,gBAAAC,MAAoB,kDACxC,OAAS,SAAAC,MAAa,qBAEtB,IAAMC,EAAaR,EAAI,cAAc,YAAY,GAAG,EAC9CS,EAAYR,EAAK,QAAQO,CAAU,EACnCE,EAAMX,EAAQ,IAAI,EAExBI,EACG,KAAK,0BAA0B,EAC/B,YAAY,gEAAgE,EAC5E,SAAS,WAAY,0BAA0B,EAC/C,SAAS,aAAc,sBAAsB,EAC7C,OAAO,MAAOQ,EAASC,EAAWC,IAAY,CAC7C,IAAMC,EAAS,MAAMT,EAAU,EAAI,EACnC,GAAIS,aAAkB,MAAO,MAAMA,EACnC,GAAM,CAAE,mBAAoB,CAC1B,QAASC,EACT,UAAWC,CACb,EAAI,CAAC,CAAE,EAAIF,EAEPG,EAAiB,GACrB,GAAIN,IAAY,OAAaM,EAASC,EAAY,GAAGP,CAAO,EAAE,MACzD,CACH,GAAM,CAAE,cAAAQ,CAAc,EAAI,MAAMf,EAAQ,CACtC,KAAM,OACN,KAAM,gBACN,QAAS,uDAAuDM,CAAG,IACn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EAEHzB,EAAQ,MAAMJ,EAAQ,IAAI,EAE1B,SAASmB,EAAaW,EAAkB,CACtC,OAAIA,EAAS,WAAW,IAAI,EAAU5B,EAAK,KAAKC,EAAG,QAAQ,EAAG2B,EAAS,MAAM,CAAC,CAAC,EACxEA,CACT",
|
|
6
|
-
"names": ["process", "url", "path", "os", "program", "prompts", "getConfig", "updateConfig", "spawn", "__filename", "__dirname", "CWD", "_lmpath", "_mxfbpath", "options", "config", "configLmPath", "configMxfbPath", "lmPath", "resolveHome", "promptsLmPath", "mxfbPath", "promptsMxfbPath", "pathsAreOk", "savePaths", "updated", "curr", "shellScriptExecution", "err", "code", "filePath"]
|
|
7
|
-
}
|
package/term-glossary/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
console.log(`: <<'END'
|
|
3
|
-
|
|
4
|
-
\u2039 TERM GLOSSARY \u203A
|
|
5
|
-
|
|
6
|
-
1. git & GitHub
|
|
7
|
-
|
|
8
|
-
1.1 Forking
|
|
9
|
-
|
|
10
|
-
1.1.1 Creating the fork
|
|
11
|
-
|
|
12
|
-
1.1.2 Comparing
|
|
13
|
-
|
|
14
|
-
git fetch upstream # r\xE9cup upstream \xE0 jour
|
|
15
|
-
git status # Affiche le diff avec upstream/master
|
|
16
|
-
git log HEAD..upstream/master # log les commits de upstream/master
|
|
17
|
-
|
|
18
|
-
1.1.3 Updating
|
|
19
|
-
|
|
20
|
-
git merge upstream/master # r\xE9cup\xE8re upstream/master dans origin/master
|
|
21
|
-
git push origin master
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
2. Processes & IP
|
|
25
|
-
|
|
26
|
-
lsof -i :<port> # Liste les process utilisant le port <port>
|
|
27
|
-
ps aux | grep <processName> # Liste les process en cours en filtrant sur le nom
|
|
28
|
-
|
|
29
|
-
END
|
|
30
|
-
|
|
31
|
-
`);
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/term-glossary/index.ts"],
|
|
4
|
-
"sourcesContent": ["// [WIP] use commander\n\nconsole.log(`: <<'END'\n\n\u2039 TERM GLOSSARY \u203A\n\n1. git & GitHub\n\n 1.1 Forking\n\n 1.1.1 Creating the fork\n \n 1.1.2 Comparing\n\n git fetch upstream # r\u00E9cup upstream \u00E0 jour\n git status # Affiche le diff avec upstream/master\n git log HEAD..upstream/master # log les commits de upstream/master\n\n 1.1.3 Updating\n\n git merge upstream/master # r\u00E9cup\u00E8re upstream/master dans origin/master\n git push origin master\n\n\n2. Processes & IP\n\n lsof -i :<port> # Liste les process utilisant le port <port>\n ps aux | grep <processName> # Liste les process en cours en filtrant sur le nom\n\nEND\n\n`)\n"],
|
|
5
|
-
"mappings": "AAEA,QAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CA6BX",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/tree/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{program as b}from"commander";import{isInDirectory as f}from"@mxfb/tools/node/files/is-in-directory";import{Subpaths as w}from"@mxfb/tools/node/files/subpaths";var h=process.cwd();b.name("@mxfb/tree").description("List subpaths from the current working directory").argument("[depth]","Depth (optional, defaults to 0)").option("-f, --files [bool]","Include files",i,!0).option("-H, --hidden [bool]","Include hidden files",i,!0).option("-d, --directories [bool]","Include directories",i,!0).option("-s, --symlinks [bool]","Include symlinks",i,!0).option("-F, --follow [bool]","Follow symlinks",i,!1).option("-u, --unique [bool]","Ensures followed symlinks contents don't create duplicates",i,!1).option("-e, --exclude [pattern]","Regexp patterns to exclude from the result").option("-i, --include [pattern]","Regexp patterns to include in the result").action(async(n,e)=>{let r=n!==void 0?parseInt(n):0;if(Number.isNaN(r))return console.error("Depth should be a number"),process.exit(1);let s=(await w.list(h,{maxDepth:r,files:e.files,hidden:e.hidden,directories:e.directories,symlinks:e.symlinks,followSimlinks:e.follow,dedupeSimlinksContents:e.unique,exclude:m(e.exclude),include:m(e.include),returnRelative:!0})).reduce((u,l)=>{let a=x(l),c={value:l,level:a,children:[]};u.filter(t=>t.level===a-1&&f(l,t.value)).forEach(t=>t.children.push(c));let p=u.filter(t=>t.level===a+1&&f(t.value,l));return c.children.push(...p),[...u,c]},[]);console.log(h),g(s)});b.parse(process.argv);function i(n){let e=`${n}`.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}function m(n){if(typeof n!="string")return;let e=/^\/(.+)\/([a-z]*)$/,r=n.match(e);if(r===null)return;let[,o,s]=r;return new RegExp(o,s)}function x(n){return n.split("/").length-1}function g(n,e=0,r=[]){n.filter(o=>o.level===e).forEach((o,s,u)=>{let l=s===u.length-1,a=l?"\u2514\u2500\u2500":"\u251C\u2500\u2500",{value:c,level:d,children:p}=o,t=c.split("/").slice(d).join("/"),v=new Array(d).fill(null).map((y,k)=>r[k]===!0?" ":"\u2502 ").join("");console.log(`${v}${a} ${t}`),g(p,d+1,[...r,l])})}
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
package/tree/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/tree/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { program } from 'commander'\nimport { isInDirectory } from '@mxfb/tools/node/files/is-in-directory'\nimport { Subpaths } from '@mxfb/tools/node/files/subpaths'\n\nconst CWD = process.cwd()\n\ntype SubpathData = {\n value: string\n level: number\n children: SubpathData[]\n}\n\nprogram\n .name('@mxfb/tree')\n .description('List subpaths from the current working directory')\n .argument('[depth]', 'Depth (optional, defaults to 0)')\n .option('-f, --files [bool]', 'Include files', parseBoolean, true)\n .option('-H, --hidden [bool]', 'Include hidden files', parseBoolean, true)\n .option('-d, --directories [bool]', 'Include directories', parseBoolean, true)\n .option('-s, --symlinks [bool]', 'Include symlinks', parseBoolean, true)\n .option('-F, --follow [bool]', 'Follow symlinks', parseBoolean, false)\n .option('-u, --unique [bool]', 'Ensures followed symlinks contents don\\'t create duplicates', parseBoolean, false)\n .option('-e, --exclude [pattern]', 'Regexp patterns to exclude from the result')\n .option('-i, --include [pattern]', 'Regexp patterns to include in the result')\n .action(async (_depth, options) => {\n const depth = _depth !== undefined ? parseInt(_depth) : 0\n if (Number.isNaN(depth)) {\n console.error('Depth should be a number')\n return process.exit(1)\n }\n const subpaths = await Subpaths.list(CWD, {\n maxDepth: depth,\n files: options.files,\n hidden: options.hidden,\n directories: options.directories,\n symlinks: options.symlinks,\n followSimlinks: options.follow,\n dedupeSimlinksContents: options.unique,\n exclude: makeRegexp(options.exclude),\n include: makeRegexp(options.include),\n returnRelative: true\n })\n const subpathsData = subpaths.reduce<SubpathData[]>((reduced, subpath) => {\n const level = getLevel(subpath)\n const thisSubpathData = {\n value: subpath,\n level,\n children: [] as SubpathData[]\n }\n // Parents\n const parents = reduced.filter(subpathData => subpathData.level === level - 1 && isInDirectory(subpath, subpathData.value))\n parents.forEach(parent => parent.children.push(thisSubpathData))\n // Children\n const children = reduced.filter(subpathData => subpathData.level === level + 1 && isInDirectory(subpathData.value, subpath))\n thisSubpathData.children.push(...children)\n return [...reduced, thisSubpathData]\n }, [])\n console.log(CWD)\n printSubpathData(subpathsData)\n })\n\nprogram.parse(process.argv)\n\nfunction parseBoolean (val: unknown) {\n const strVal = `${val}`.trim().toLowerCase()\n if (strVal === 'true') return true\n if (strVal === 'false') return false\n return undefined\n}\n\nfunction makeRegexp (strRegexp: unknown) {\n if (typeof strRegexp !== 'string') return undefined\n const validRegexpRegexp = /^\\/(.+)\\/([a-z]*)$/\n const inputMatches = strRegexp.match(validRegexpRegexp)\n if (inputMatches === null) return undefined\n const [, pattern, flags] = inputMatches\n return new RegExp(pattern!, flags!)\n}\n\nfunction getLevel (path: string) {\n const chunks = path.split('/')\n return chunks.length - 1\n}\n\nfunction printSubpathData (\n subpathsData: SubpathData[],\n level: number = 0,\n parentsAreLastMap: boolean[] = []) {\n subpathsData\n .filter(subpathData => subpathData.level === level)\n .forEach((subpathsData, pos, filtered) => {\n const isLast = pos === filtered.length - 1\n const indentChar = isLast ? '\u2514\u2500\u2500' : '\u251C\u2500\u2500'\n const { value, level, children } = subpathsData\n const toPrint = value.split('/').slice(level).join('/')\n const indentChars = new Array(level).fill(null).map((e, pos) => {\n if (parentsAreLastMap[pos] === true) return ' '\n else return '\u2502 '\n }).join('')\n console.log(`${indentChars}${indentChar} ${toPrint}`)\n printSubpathData(children, level + 1, [...parentsAreLastMap, isLast])\n })\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,WAAAA,MAAe,YACxB,OAAS,iBAAAC,MAAqB,yCAC9B,OAAS,YAAAC,MAAgB,kCAEzB,IAAMC,EAAM,QAAQ,IAAI,EAQxBH,EACG,KAAK,YAAY,EACjB,YAAY,kDAAkD,EAC9D,SAAS,UAAW,iCAAiC,EACrD,OAAO,qBAAsB,gBAAiBI,EAAc,EAAI,EAChE,OAAO,sBAAuB,uBAAwBA,EAAc,EAAI,EACxE,OAAO,2BAA4B,sBAAuBA,EAAc,EAAI,EAC5E,OAAO,wBAAyB,mBAAoBA,EAAc,EAAI,EACtE,OAAO,sBAAuB,kBAAmBA,EAAc,EAAK,EACpE,OAAO,sBAAuB,6DAA+DA,EAAc,EAAK,EAChH,OAAO,0BAA2B,4CAA4C,EAC9E,OAAO,0BAA2B,0CAA0C,EAC5E,OAAO,MAAOC,EAAQC,IAAY,CACjC,IAAMC,EAAQF,IAAW,OAAY,SAASA,CAAM,EAAI,EACxD,GAAI,OAAO,MAAME,CAAK,EACpB,eAAQ,MAAM,0BAA0B,EACjC,QAAQ,KAAK,CAAC,EAcvB,IAAMC,GAZ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EAAc,CAE/B,OADeA,EAAK,MAAM,GAAG,EACf,OAAS,CACzB,CAEA,SAASR,EACPV,EACAI,EAAgB,EAChBe,EAA+B,CAAC,EAAG,CACnCnB,EACG,OAAOO,GAAeA,EAAY,QAAUH,CAAK,EACjD,QAAQ,CAACJ,EAAcoB,EAAKC,IAAa,CACxC,IAAMC,EAASF,IAAQC,EAAS,OAAS,EACnCE,EAAaD,EAAS,qBAAQ,qBAC9B,CAAE,MAAAE,EAAO,MAAApB,EAAO,SAAAK,CAAS,EAAIT,EAC7ByB,EAAUD,EAAM,MAAM,GAAG,EAAE,MAAMpB,CAAK,EAAE,KAAK,GAAG,EAChDsB,EAAc,IAAI,MAAMtB,CAAK,EAAE,KAAK,IAAI,EAAE,IAAI,CAACuB,EAAGP,IAClDD,EAAkBC,CAAG,IAAM,GAAa,OAChC,WACb,EAAE,KAAK,EAAE,EACV,QAAQ,IAAI,GAAGM,CAAW,GAAGH,CAAU,IAAIE,CAAO,EAAE,EACpDf,EAAiBD,EAAUL,EAAQ,EAAG,CAAC,GAAGe,EAAmBG,CAAM,CAAC,CACtE,CAAC,CACL",
|
|
6
|
-
"names": ["program", "isInDirectory", "Subpaths", "CWD", "parseBoolean", "_depth", "options", "depth", "subpathsData", "makeRegexp", "reduced", "subpath", "level", "getLevel", "thisSubpathData", "subpathData", "parent", "children", "printSubpathData", "val", "strVal", "strRegexp", "validRegexpRegexp", "inputMatches", "pattern", "flags", "path", "parentsAreLastMap", "pos", "filtered", "isLast", "indentChar", "value", "toPrint", "indentChars", "e"]
|
|
7
|
-
}
|
package/tumblr-crawler/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import w from"node:process";import d from"node:path";import{promises as p}from"node:fs";import b from"prompts";import{program as g}from"commander";import{JSDOM as S}from"jsdom";import{parse as _}from"date-fns";import C from"@mxfb/tools/utils/agnostic/wait/index.js";import I from"@mxfb/tools/utils/agnostic/round-numbers/index.js";g.name("@mxfb/tumblr-crawler").description("Crawls a Tumblr blog");g.command("fetch").description("Fetch all pages DOM content").argument("url","Root URL of the tumblr blog").action(async e=>{let{outputPath:t}=await b({type:"text",name:"outputPath",message:"Please select an output path for the data files",initial:`${w.cwd()}/.tmblrcrwlr`}),a=e.trim(),o=[a];/^https?:\/\//i.test(a)||(a.startsWith("://")?o.unshift("https"):o.unshift("https://"));let r=new URL(o.join("")).toString().replace(/\/+$/igm,"");console.log("you wanna crawl",r);let s=await q(r,t),i=JSON.stringify(s,null,2),u=d.join(t,"shallow.json");console.log(`outputting fetched data (${s.length}) pages`),await p.mkdir(t,{recursive:!0}),await p.writeFile(u,i,{encoding:"utf-8"}),console.log("Wrote data at",u)});g.command("extract-posts").description("Axtracts post data from the outputs of tumblr-crawler fetch <url>").action(async()=>{let{shallowJsonPath:e}=await b({type:"text",name:"shallowJsonPath",message:"Please enter a shallow.json file path",initial:`${w.cwd()}/.tmblrcrwlr/shallow.json`}),t=await p.readFile(e,{encoding:"utf-8"}),a=JSON.parse(t),o=await F(a),n=Object.fromEntries(o),r=JSON.stringify(n,null,2),s=d.join(d.dirname(e),"extracted.json");await p.writeFile(s,r,{encoding:"utf-8"})});g.command("output").description("Fills missing post data").action(async()=>{let{extractedJsonPath:e}=await b({type:"text",name:"extractedJsonPath",message:"Please enter a extracted.json file path",initial:`${w.cwd()}/.tmblrcrwlr/extracted.json`}),t=await p.readFile(e,{encoding:"utf-8"}),a=JSON.parse(t),o=[];Object.entries(a).forEach(([s,i])=>{let{id:u,date:c,url:l,youtube_id:m,youtube_title:h,post_content:y}=i,f=c!==null?_(c,"EEE. MMMM d, yyyy '@' h:mm a",new Date).toISOString():null;o.push({publishOn:f,publishOnRaw:c,songTitle:y,youtubeId:m,youtubeTitle:h,postUrl:l,postId:u})});let n=JSON.stringify(o,null,2),r=d.join(d.dirname(e),"output.json");await p.writeFile(r,n,{encoding:"utf-8"})});g.parse(w.argv);async function q(e,t,a=0){let o=new Map,n=0+a;try{for(;;){n++;let s=`${e}/page/${n}`;if(n>200)break;console.log(s,"...");let i=await A(n,e);if(i===void 0){o.set(n,{isValid:!1,domString:"",dom:null,url:s});break}let{isValid:u,dom:c}=await $(i);if(o.set(n,{isValid:u,domString:i,dom:c,url:s}),!u)break;let l=Math.random()*2e3+2e3;console.log(`Waiting before new request... (${I(l/1e3,1)}s)
|
|
3
|
-
|
|
4
|
-
`),await C(l)}}catch(s){console.log("Something went wrong while crawling..."),console.log(s)}let r=[];return o.forEach((s,i)=>{r.push({number:i,url:s.url,content:s.domString,isValid:s.isValid})}),r}async function A(e,t){if(!Number.isInteger(e)||e<=0)throw new Error(`Page number must be a non-zero positive integer. Found: ${e}`);return await(await fetch(`${t}/page/${e}`)).text()}async function $(e){let t=new S(e),{window:{document:a}}=t,o=a.querySelector("#page");if(o===null)return{isValid:!1,dom:t};let n=o.querySelector("#content");return n===null?{isValid:!1,dom:t}:n.querySelectorAll("article.post").length===0?{isValid:!1,dom:t}:{isValid:!0,dom:t}}async function F(e){let t=new Map;for(let a of e)(await R(a))?.forEach((n,r)=>t.set(r,n));return t}async function R(e){let t=new Map,{number:a,url:o,content:n,isValid:r}=e;if(!r)return;let s=new S(n),{window:{document:i}}=s,u=i.querySelector("#page");if(u===null)return;let c=u.querySelectorAll("article.post");if(c.length!==0){for(let l of Array.from(c)){let m=l.getAttribute("id")?.split("post-").at(1);if(m===void 0)continue;let h=Array.from(l.classList).find(V=>V.trim().match(/^type\-/igm))?.replace(/^type\-/igm,""),f=l.querySelector(".post-panel .media")?.querySelector('iframe[src^="https://www.youtube.com/embed/"]')??null,J=f?.getAttribute("src")?.split("https://www.youtube.com/embed/").at(1)?.split("?").at(0),x=f?.getAttribute("title")??void 0,O=l.querySelector(".post-panel .copy")?.textContent?.trim(),P=l.querySelector(".post-panel .meta .meta-list"),D=P?.querySelector(".date a"),j=P?.querySelector(".permalink a"),M=D?.getAttribute("title"),E=j?.getAttribute("href");t.set(m,{id:m,url:E??null,date:M??null,type:h??null,post_element_outerhtml:l.outerHTML,youtube_id:J??null,youtube_title:x??null,post_content:O??null})}return t}}
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/tumblr-crawler/index.ts"],
|
|
4
|
-
"sourcesContent": ["import process from 'node:process'\nimport path from 'node:path'\nimport { promises as fs } from 'node:fs'\nimport prompts from 'prompts'\nimport { program } from 'commander'\nimport { JSDOM } from 'jsdom'\nimport { parse as dateParse } from 'date-fns'\nimport wait from '@mxfb/tools/utils/agnostic/wait/index.js'\nimport roundNumbers from '@mxfb/tools/utils/agnostic/round-numbers/index.js'\nimport { beforeForcedExit, beforeExit } from '@mxfb/tools/utils/node/process-exit/index.js'\n\n// const browser = await puppeteer.launch()\n// beforeExit(async () => browser.close())\n// beforeForcedExit(async () => browser.close())\n\nprogram\n .name('@mxfb/tumblr-crawler')\n .description('Crawls a Tumblr blog')\n\nprogram\n .command('fetch')\n .description('Fetch all pages DOM content')\n .argument('url', 'Root URL of the tumblr blog')\n .action(async inputUrl => {\n const { outputPath } = await prompts({\n type: 'text',\n name: 'outputPath',\n message: 'Please select an output path for the data files',\n initial: `${process.cwd()}/.tmblrcrwlr`\n }) as { outputPath: string }\n const trimmedInput = inputUrl.trim()\n const urlChunks = [trimmedInput]\n if (!/^https?:\\/\\//i.test(trimmedInput)) {\n if (trimmedInput.startsWith('://')) urlChunks.unshift('https')\n else urlChunks.unshift('https://')\n }\n const url = new URL(urlChunks.join(''))\n const stringifiedUrl = url.toString().replace(/\\/+$/igm, '')\n console.log('you wanna crawl', stringifiedUrl)\n const shallowJson = await fetchPagesDom(stringifiedUrl, outputPath)\n const shallowJsonContent = JSON.stringify(shallowJson, null, 2)\n const outputShallowJsonPath = path.join(outputPath, `shallow.json`)\n console.log(`outputting fetched data (${shallowJson.length}) pages`)\n await fs.mkdir(outputPath, { recursive: true })\n await fs.writeFile(outputShallowJsonPath, shallowJsonContent, { encoding: 'utf-8' })\n console.log('Wrote data at', outputShallowJsonPath)\n // await browser.close()\n })\n\nprogram\n .command('extract-posts')\n .description('Axtracts post data from the outputs of tumblr-crawler fetch <url>')\n .action(async () => {\n const { shallowJsonPath } = await prompts({\n type: 'text',\n name: 'shallowJsonPath',\n message: 'Please enter a shallow.json file path',\n initial: `${process.cwd()}/.tmblrcrwlr/shallow.json`\n })\n const shallowJsonContent = await fs.readFile(shallowJsonPath, { encoding: 'utf-8' })\n const shallowJsonObj = JSON.parse(shallowJsonContent) as ShallowJson\n const extractedPages = await extractPages(shallowJsonObj)\n const postsDataObj = Object.fromEntries(extractedPages)\n const postsDataContent = JSON.stringify(postsDataObj, null, 2)\n const extractedPath = path.join(path.dirname(shallowJsonPath), 'extracted.json')\n await fs.writeFile(extractedPath, postsDataContent, { encoding: 'utf-8' })\n // await browser.close()\n })\n\ntype OutputPostData = {\n publishOn: string | null,\n publishOnRaw: string | null,\n songTitle: string | null,\n youtubeId: string | null,\n youtubeTitle: string | null,\n postUrl: string | null,\n postId: string | null\n}\n\nprogram\n .command('output')\n .description('Fills missing post data')\n .action(async () => {\n const { extractedJsonPath } = await prompts({\n type: 'text',\n name: 'extractedJsonPath',\n message: 'Please enter a extracted.json file path',\n initial: `${process.cwd()}/.tmblrcrwlr/extracted.json`\n })\n const extractedJsonContent = await fs.readFile(extractedJsonPath, { encoding: 'utf-8' })\n const extractedJsonObj = JSON.parse(extractedJsonContent) as Record<string, PostData>\n const output: OutputPostData[] = []\n Object.entries(extractedJsonObj).forEach(([_id, postData]) => {\n const { id, date, url, youtube_id, youtube_title, post_content } = postData\n const dt = date !== null ? dateParse(date, 'EEE. MMMM d, yyyy \\'@\\' h:mm a', new Date()).toISOString() : null\n output.push({\n publishOn: dt,\n publishOnRaw: date,\n songTitle: post_content,\n youtubeId: youtube_id,\n youtubeTitle: youtube_title,\n postUrl: url,\n postId: id\n })\n })\n const jsonOutput = JSON.stringify(output, null, 2)\n const outputPath = path.join(path.dirname(extractedJsonPath), 'output.json')\n await fs.writeFile(outputPath, jsonOutput, { encoding: 'utf-8' })\n })\n \nprogram.parse(process.argv)\n\ntype PageData = {\n isValid: boolean\n domString: string\n dom: JSDOM | null\n url: string\n}\n\ntype ShallowJson = Array<{\n number: number\n url: string\n content: string\n isValid: boolean\n}>\n\nasync function fetchPagesDom (rootUrl: string, outputPath: string, startOffset: number = 0) {\n const pagesMap = new Map<number, PageData>()\n let pagePos = 0 + startOffset\n try {\n while (true) {\n pagePos ++\n const url = `${rootUrl}/page/${pagePos}`\n if (pagePos > 200) break;\n console.log(url, '...')\n const domString = await fetchPostsPageContent(pagePos, rootUrl)\n if (domString === undefined) {\n pagesMap.set(pagePos, { isValid: false, domString: '', dom: null, url })\n break;\n }\n const { isValid, dom } = await validatePageContent(domString)\n pagesMap.set(pagePos, { isValid, domString, dom, url })\n if (!isValid) break;\n const delay = (Math.random() * 2000) + 2000\n console.log(`Waiting before new request... (${roundNumbers(delay / 1000, 1)}s)\\n\\n`)\n await wait(delay)\n }\n } catch (err) {\n console.log('Something went wrong while crawling...')\n console.log(err)\n }\n const shallowJson: ShallowJson = []\n pagesMap.forEach((pageData, pagePos) => {\n shallowJson.push({\n number: pagePos,\n url: pageData.url,\n content: pageData.domString,\n isValid: pageData.isValid\n })\n })\n return shallowJson\n}\n\nasync function fetchPostsPageContent (pagePos: number, rootUrl: string) {\n const isInteger = Number.isInteger(pagePos)\n if (!isInteger || pagePos <= 0) throw new Error(`Page number must be a non-zero positive integer. Found: ${pagePos}`)\n // const page = await browser.newPage()\n // page.goto(`${rootUrl}/page/${pagePos}`, { waitUntil: 'networkidle2' })\n // await page.waitForNavigation()\n // await wait(1000)\n // const content = await page.evaluate(() => {\n // try { return document.documentElement.outerHTML }\n // catch { return undefined }\n // })\n // page.close()\n return await (await fetch(`${rootUrl}/page/${pagePos}`)).text()\n // return content\n}\n\ntype PageValidationResult = {\n isValid: boolean\n dom: JSDOM\n}\n\nasync function validatePageContent (pageContent: string): Promise<PageValidationResult> {\n const dom = new JSDOM(pageContent)\n const { window: { document } } = dom\n const page = document.querySelector('#page')\n if (page === null) return { isValid: false, dom }\n const content = page.querySelector('#content')\n if (content === null) return { isValid: false, dom }\n const posts = content.querySelectorAll('article.post')\n if (posts.length === 0) return { isValid: false, dom }\n return { isValid: true, dom }\n}\n\ntype PostData = {\n id: string\n url: string | null\n date: string | null\n type: string | null\n post_element_outerhtml: string | null\n post_content: string | null\n youtube_id: string | null\n youtube_title: string | null\n}\n\nasync function extractPages (shallowJson: ShallowJson): Promise<Map<string, PostData>> {\n const postsData = new Map<string, PostData>()\n for (const shallowPage of shallowJson) {\n const extractedPage = await analysePage(shallowPage)\n extractedPage?.forEach((postData, postId) => postsData.set(postId, postData))\n }\n return postsData\n}\n\nasync function analysePage (shallowPage: ShallowJson[number]) {\n const postData = new Map<string, PostData>()\n const { number, url, content, isValid } = shallowPage\n if (!isValid) return;\n const dom = new JSDOM(content)\n const { window: { document } } = dom\n const page = document.querySelector('#page')\n if (page === null) return;\n const posts = page.querySelectorAll('article.post')\n if (posts.length === 0) return;\n for (const postElement of Array.from(posts)) {\n const id = postElement.getAttribute('id')?.split('post-').at(1)\n if (id === undefined) continue\n const type = Array\n .from(postElement.classList)\n .find(clss => clss.trim().match(/^type\\-/igm))\n ?.replace(/^type\\-/igm, '')\n const mediaContainer = postElement.querySelector('.post-panel .media')\n const youtubeIframeContainer = mediaContainer?.querySelector('iframe[src^=\"https://www.youtube.com/embed/\"]') ?? null\n const youtubeIframeId = youtubeIframeContainer\n ?.getAttribute('src')\n ?.split('https://www.youtube.com/embed/').at(1)\n ?.split('?').at(0)\n const youtubeIframeTitle = youtubeIframeContainer?.getAttribute('title') ?? undefined\n const postContent = postElement.querySelector('.post-panel .copy')?.textContent?.trim()\n const postMetaListElement = postElement.querySelector('.post-panel .meta .meta-list')\n const postDateElement = postMetaListElement?.querySelector('.date a')\n const postPermalinkElement = postMetaListElement?.querySelector('.permalink a')\n const postDate = postDateElement?.getAttribute('title')\n const postUrl = postPermalinkElement?.getAttribute('href')\n postData.set(id, {\n id,\n url: postUrl ?? null,\n date: postDate ?? null,\n type: type ?? null,\n post_element_outerhtml: postElement.outerHTML,\n youtube_id: youtubeIframeId ?? null,\n youtube_title: youtubeIframeTitle ?? null,\n post_content: postContent ?? null\n })\n }\n return postData\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAa,eACpB,OAAOC,MAAU,YACjB,OAAS,YAAYC,MAAU,UAC/B,OAAOC,MAAa,UACpB,OAAS,WAAAC,MAAe,YACxB,OAAS,SAAAC,MAAa,QACtB,OAAS,SAASC,MAAiB,WACnC,OAAOC,MAAU,2CACjB,OAAOC,MAAkB,oDAOzBJ,EACG,KAAK,sBAAsB,EAC3B,YAAY,sBAAsB,EAErCA,EACG,QAAQ,OAAO,EACf,YAAY,6BAA6B,EACzC,SAAS,MAAO,6BAA6B,EAC7C,OAAO,MAAMK,GAAY,CACxB,GAAM,CAAE,WAAAC,CAAW,EAAI,MAAMP,EAAQ,CACnC,KAAM,OACN,KAAM,aACN,QAAS,kDACT,QAAS,GAAGH,EAAQ,IAAI,CAAC,cAC3B,CAAC,EACKW,EAAeF,EAAS,KAAK,EAC7BG,EAAY,CAACD,CAAY,EAC1B,gBAAgB,KAAKA,CAAY,IAChCA,EAAa,WAAW,KAAK,EAAGC,EAAU,QAAQ,OAAO,EACxDA,EAAU,QAAQ,UAAU,GAGnC,IAAMC,EADM,IAAI,IAAID,EAAU,KAAK,EAAE,CAAC,EACX,SAAS,EAAE,QAAQ,UAAW,EAAE,EAC3D,QAAQ,IAAI,kBAAmBC,CAAc,EAC7C,IAAMC,EAAc,MAAMC,EAAcF,EAAgBH,CAAU,EAC5DM,EAAqB,KAAK,UAAUF,EAAa,KAAM,CAAC,EACxDG,EAAwBhB,EAAK,KAAKS,EAAY,cAAc,EAClE,QAAQ,IAAI,4BAA4BI,EAAY,MAAM,SAAS,EACnE,MAAMZ,EAAG,MAA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ateParse", "wait", "roundNumbers", "inputUrl", "outputPath", "trimmedInput", "urlChunks", "stringifiedUrl", "shallowJson", "fetchPagesDom", "shallowJsonContent", "outputShallowJsonPath", "shallowJsonPath", "shallowJsonObj", "extractedPages", "extractPages", "postsDataObj", "postsDataContent", "extractedPath", "extractedJsonPath", "extractedJsonContent", "extractedJsonObj", "output", "_id", "postData", "id", "date", "url", "youtube_id", "youtube_title", "post_content", "dt", "jsonOutput", "rootUrl", "startOffset", "pagesMap", "pagePos", "domString", "fetchPostsPageContent", "isValid", "dom", "validatePageContent", "delay", "err", "pageData", "pageContent", "document", "page", "content", "postsData", "shallowPage", "analysePage", "postId", "number", "posts", "postElement", "type", "clss", "youtubeIframeContainer", "youtubeIframeId", "youtubeIframeTitle", "postContent", "postMetaListElement", "postDateElement", "postPermalinkElement", "postDate", "postUrl"]
|
|
7
|
-
}
|