@mxfb/cli 1.0.3 → 1.0.4

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.
@@ -0,0 +1,2 @@
1
+ mxfb
2
+ scrape-tumblr
@@ -0,0 +1 @@
1
+ 1.0.4
package/mxfb/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{existsSync as r,readdirSync as c}from"node:fs";import{readFile as l}from"node:fs/promises";import t from"node:path";import i from"node:process";import{fileURLToPath as m}from"node:url";import{Command as g}from"commander";import{styles as n}from"@design-edito/tools/agnostic/misc/logs/styles/index.js";var e=t.join(t.dirname(m(import.meta.url)),"..");function f(){try{return c(e).filter(o=>r(t.join(e,o,"index.js"))).sort()}catch{return[]}}var p=[t.join(e,"package.json"),t.join(e,"..","package.json")];async function d(){for(let o of p)try{let a=await l(o,{encoding:"utf-8"});return JSON.parse(a)}catch{continue}return null}var s=new g().name("mxfb").description("The @mxfb command line tools: what this package installs, and which version is here.");s.command("list").description("every command this package installs").action(async()=>{let o=f();if(console.log(""),console.log(n.title("Commands.")),o.length===0){console.log(n.warning("None found.")),console.log(n.light(e)),console.log("");return}o.forEach(a=>console.log(n.important(a))),console.log("")});s.command("version").description("the installed version of this package").action(async()=>{let o=await d();console.log(""),console.log(n.title("Version.")),o===null&&(console.log(n.error("No package.json next to the commands.")),console.log(n.light(e)),console.log(""),i.exit(1)),console.log(`${n.important(o.name??"@mxfb/cli")} ${o.version??"unknown"}`),console.log("")});i.argv.length<=2&&s.help();await s.parseAsync();
2
+ import{spawn as f}from"node:child_process";import{promises as c}from"node:fs";import r from"node:path";import m from"node:process";import h from"node:url";import{program as n}from"commander";var g=h.fileURLToPath(import.meta.url),e=r.dirname(g);n.name("@mxfb/cli").description("The home of @mxfb/cli's project").option("-v, --version","output the current version").action(async t=>"version"in t?await l():n.help());n.command("list").description("list all the available commands").action(v);n.command("version").description("print current version of the package").action(l);var b=await a();b.forEach(t=>{n.command(t,{hidden:!0}).allowUnknownOption(!0).action(async()=>{let[s,i,o,...p]=m.argv;if(o===void 0)return n.help();if(!(await a()).includes(o))return n.help();let d=r.join(e,"../",o,"index.js");f(d,p,{stdio:"inherit"}).on("error",u=>console.error(`Failed to start subprogram '${o}':`,u))})});n.parse(m.argv);async function a(){let t=r.join(e,"assets/list.txt");return(await c.readFile(t,{encoding:"utf-8"})).split(`
3
+ `).map(i=>i.trim())}async function v(){let s=(await a()).map(i=>{let o=Object.assign(new Array(24).fill(" "),i.split("")).join("");return i==="mxfb"?`${o} # npx @mxfb/cli help`:`${o} # npx @mxfb/cli ${i} help`}).join(`
4
+ `);console.log(s)}async function l(){let t=r.join(e,"assets/version.txt"),s=await c.readFile(t,{encoding:"utf-8"});console.log(s)}
3
5
  //# sourceMappingURL=index.js.map
package/mxfb/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/mxfb/index.ts"],
4
- "sourcesContent": ["import { existsSync, readdirSync } from 'node:fs'\nimport { readFile } from 'node:fs/promises'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { Command } from 'commander'\nimport { styles } from '@design-edito/tools/agnostic/misc/logs/styles/index.js'\n\ntype PackageManifest = {\n name?: string\n version?: string\n}\n\n// A built command sits at <package>/<command>/index.js, so its siblings are the other\n// commands and the manifest is one level up.\nconst PACKAGE_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), '..')\n\nfunction listCommandNames (): string[] {\n try {\n return readdirSync(PACKAGE_DIR)\n .filter(name => existsSync(path.join(PACKAGE_DIR, name, 'index.js')))\n .sort()\n }\n catch { return [] }\n}\n\n// Published, the manifest sits next to the commands; in this repo it is one level further\n// up, since build/package.json is only written at publish time.\nconst MANIFEST_PATHS = [\n path.join(PACKAGE_DIR, 'package.json'),\n path.join(PACKAGE_DIR, '..', 'package.json')\n]\n\nasync function readManifest (): Promise<PackageManifest | null> {\n for (const manifestPath of MANIFEST_PATHS) {\n try {\n const raw = await readFile(manifestPath, { encoding: 'utf-8' })\n return JSON.parse(raw) as PackageManifest\n }\n catch { continue }\n }\n return null\n}\n\nconst program = new Command()\n .name('mxfb')\n .description('The @mxfb command line tools: what this package installs, and which version is here.')\n\nprogram\n .command('list')\n .description('every command this package installs')\n .action(async () => {\n const names = listCommandNames()\n console.log('')\n console.log(styles.title('Commands.'))\n if (names.length === 0) {\n console.log(styles.warning('None found.'))\n console.log(styles.light(PACKAGE_DIR))\n console.log('')\n return\n }\n names.forEach(name => console.log(styles.important(name)))\n console.log('')\n })\n\nprogram\n .command('version')\n .description('the installed version of this package')\n .action(async () => {\n const manifest = await readManifest()\n console.log('')\n console.log(styles.title('Version.'))\n if (manifest === null) {\n console.log(styles.error('No package.json next to the commands.'))\n console.log(styles.light(PACKAGE_DIR))\n console.log('')\n process.exit(1)\n }\n console.log(`${styles.important(manifest.name ?? '@mxfb/cli')} ${manifest.version ?? 'unknown'}`)\n console.log('')\n })\n\nif (process.argv.length <= 2) program.help()\nawait program.parseAsync()\n"],
5
- "mappings": "AAAA,OAAS,cAAAA,EAAY,eAAAC,MAAmB,UACxC,OAAS,YAAAC,MAAgB,mBACzB,OAAOC,MAAU,YACjB,OAAOC,MAAa,eACpB,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,WAAAC,MAAe,YACxB,OAAS,UAAAC,MAAc,yDASvB,IAAMC,EAAcL,EAAK,KAAKA,EAAK,QAAQE,EAAc,YAAY,GAAG,CAAC,EAAG,IAAI,EAEhF,SAASI,GAA8B,CACrC,GAAI,CACF,OAAOR,EAAYO,CAAW,EAC3B,OAAOE,GAAQV,EAAWG,EAAK,KAAKK,EAAaE,EAAM,UAAU,CAAC,CAAC,EACnE,KAAK,CACV,MACM,CAAE,MAAO,CAAC,CAAE,CACpB,CAIA,IAAMC,EAAiB,CACrBR,EAAK,KAAKK,EAAa,cAAc,EACrCL,EAAK,KAAKK,EAAa,KAAM,cAAc,CAC7C,EAE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"readdirSync", "readFile", "path", "process", "fileURLToPath", "Command", "styles", "PACKAGE_DIR", "listCommandNames", "name", "MANIFEST_PATHS", "readManifest", "manifestPath", "raw", "program", "names", "manifest"]
4
+ "sourcesContent": ["import { spawn } from 'node:child_process'\nimport { promises as fs } from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport url from 'node:url'\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 .option('-v, --version', 'output the current version')\n .action(async options => 'version' in options\n ? await printVersion()\n : program.help())\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 () => {\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 === 'mxfb') 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,OAAS,SAAAA,MAAa,qBACtB,OAAS,YAAYC,MAAU,UAC/B,OAAOC,MAAU,YACjB,OAAOC,MAAa,eACpB,OAAOC,MAAS,WAChB,OAAS,WAAAC,MAAe,YAExB,IAAMC,EAAaF,EAAI,cAAc,YAAY,GAAG,EAC9CG,EAAYL,EAAK,QAAQI,CAAU,EAEzCD,EACG,KAAK,WAAW,EAChB,YAAY,iCAAkC,EAC9C,OAAO,gBAAiB,4BAA4B,EACpD,OAAO,MAAMG,GAAW,YAAaA,EAClC,MAAMC,EAAa,EACnBJ,EAAQ,KAAK,CAAC,EAEpBA,EACG,QAAQ,MAAM,EACd,YAAY,iCAAiC,EAC7C,OAAOK,CAAa,EAEvBL,EACG,QAAQ,SAAS,EACjB,YAAY,sCAAsC,EAClD,OAAOI,CAAY,EAEtB,IAAME,EAAc,MAAMC,EAAa,EACvCD,EAAY,QAAQE,GAAc,CAChCR,EACG,QAAQQ,EAAY,CAAE,OAAQ,EAAK,CAAC,EACpC,mBAAmB,EAAI,EACvB,OAAO,SAAY,CAClB,GAAM,CAACC,EAAWC,EAAWC,EAAe,GAAGC,CAAa,EAAId,EAAQ,KACxE,GAAIa,IAAkB,OAAW,OAAOX,EAAQ,KAAK,EAErD,GAAI,EADiB,MAAMO,EAAa,GACtB,SAASI,CAAa,EAAG,OAAOX,EAAQ,KAAK,EAC/D,IAAMa,EAAiBhB,EAAK,KAAKK,EAAW,MAAOS,EAAe,UAAU,EACzDhB,EAAMkB,EAAgBD,EAAe,CAAE,MAAO,SAAU,CAAC,EACjE,GAAG,QAASE,GAAO,QAAQ,MAAM,+BAA+BH,CAAa,KAAMG,CAAG,CAAC,CACpG,CAAC,CACL,CAAC,EAEDd,EAAQ,MAAMF,EAAQ,IAAI,EAE1B,eAAeS,GAAgB,CAC7B,IAAMQ,EAAelB,EAAK,KAAKK,EAAW,iBAAiB,EAE3D,OADa,MAAMN,EAAG,SAASmB,EAAc,CAAE,SAAU,OAAQ,CAAC,GACtD,MAAM;AAAA,CAAI,EAAE,IAAIC,GAAKA,EAAE,KAAK,CAAC,CAC3C,CAEA,eAAeX,GAAiB,CAE9B,IAAMY,GADO,MAAMV,EAAa,GAE7B,IAAIW,GAAK,CACR,IAAMC,EAAqB,OAAO,OAChC,IAAI,MAAM,EAAE,EAAE,KAAK,GAAG,EACtBD,EAAE,MAAM,EAAE,CACZ,EAAE,KAAK,EAAE,EACT,OAAIA,IAAM,OAAe,GAAGC,CAAkB,wBACvC,GAAGA,CAAkB,oBAAoBD,CAAC,OACnD,CAAC,EACA,KAAK;AAAA,CAAI,EACZ,QAAQ,IAAID,CAAM,CAEpB,CAEA,eAAeb,GAAgB,CAC7B,IAAMgB,EAAkBvB,EAAK,KAAKK,EAAW,oBAAoB,EAC3DmB,EAAU,MAAMzB,EAAG,SAASwB,EAAiB,CAAE,SAAU,OAAQ,CAAC,EACxE,QAAQ,IAAIC,CAAO,CAErB",
6
+ "names": ["spawn", "fs", "path", "process", "url", "program", "__filename", "__dirname", "options", "printVersion", "printCommands", "subCommands", "listCommands", "subCommand", "_nodePath", "_thisPath", "targetCommand", "forwardedArgs", "subprogramPath", "err", "listFilePath", "e", "output", "c", "twentyFourCharName", "versionFilePath", "version"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxfb/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",