@design-edito/cli 0.0.76 → 0.0.78
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/cli/assets/version.txt +1 -1
- package/cli/index.js +2 -2
- package/cli/index.js.map +3 -3
- package/package.json +3 -3
- package/upgrade/index.js +8 -8
- package/upgrade/index.js.map +3 -3
package/cli/assets/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.78
|
package/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import m from"node:process";import{promises as l}from"node:fs";import
|
|
2
|
+
import m from"node:process";import{promises as l}from"node:fs";import h from"node:url";import r from"node:path";import{spawn as g}from"node:child_process";import{program as n}from"commander";var v=h.fileURLToPath(import.meta.url),a=r.dirname(v);n.name("@design-edito/cli").description("The home of @design-edito/cli's project").option("-v, --version","output the current version").action(async t=>"version"in t?await p():n.help());n.command("list").description("list all the available commands").action(j);n.command("version").description("print current version of the package").action(p);var w=await c();w.forEach(t=>{n.command(t,{hidden:!0}).allowUnknownOption(!0).action(async(...i)=>{let[o,e,s,...d]=m.argv;if(s===void 0)return n.help();if(!(await c()).includes(s))return n.help();let u=r.join(a,"../",s,"index.js");g(u,d,{stdio:"inherit"}).on("error",f=>console.error(`Failed to start subprogram '${s}':`,f))})});n.parse(m.argv);async function c(){let t=r.join(a,"assets/list.txt");return(await l.readFile(t,{encoding:"utf-8"})).split(`
|
|
3
3
|
`).map(o=>o.trim())}async function j(){let i=(await c()).map(o=>{let e=Object.assign(new Array(24).fill(" "),o.split("")).join("");return o==="cli"?`${e} # npx @design-edito/cli help`:`${e} # npx @design-edito/cli ${o} help`}).join(`
|
|
4
|
-
`);console.log(i)}async function
|
|
4
|
+
`);console.log(i)}async function p(){let t=r.join(a,"assets/version.txt"),i=await l.readFile(t,{encoding:"utf-8"});console.log(i)}
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/cli/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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('@design-edito/cli')\n .description('The home of @design-edito/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 @design-edito/cli help`\n return `${twentyFourCharName} # npx @design-edito/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,mBAAmB,EACxB,YAAY,yCAA0C,
|
|
6
|
-
"names": ["process", "fs", "url", "path", "spawn", "program", "__filename", "__dirname", "
|
|
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('@design-edito/cli')\n .description('The home of @design-edito/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 (...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 @design-edito/cli help`\n return `${twentyFourCharName} # npx @design-edito/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,mBAAmB,EACxB,YAAY,yCAA0C,EACtD,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,SAAUC,IAAS,CACzB,GAAM,CAACC,EAAWC,EAAWC,EAAe,GAAGC,CAAa,EAAIlB,EAAQ,KACxE,GAAIiB,IAAkB,OAAW,OAAOZ,EAAQ,KAAK,EAErD,GAAI,EADiB,MAAMO,EAAa,GACtB,SAASK,CAAa,EAAG,OAAOZ,EAAQ,KAAK,EAC/D,IAAMc,EAAiBhB,EAAK,KAAKI,EAAW,MAAOU,EAAe,UAAU,EACzDb,EAAMe,EAAgBD,EAAe,CAAE,MAAO,SAAU,CAAC,EACjE,GAAG,QAASE,GAAO,QAAQ,MAAM,+BAA+BH,CAAa,KAAMG,CAAG,CAAC,CACpG,CAAC,CACL,CAAC,EAEDf,EAAQ,MAAML,EAAQ,IAAI,EAE1B,eAAeY,GAAgB,CAC7B,IAAMS,EAAelB,EAAK,KAAKI,EAAW,iBAAiB,EAE3D,OADa,MAAMN,EAAG,SAASoB,EAAc,CAAE,SAAU,OAAQ,CAAC,GACtD,MAAM;AAAA,CAAI,EAAE,IAAIC,GAAKA,EAAE,KAAK,CAAC,CAC3C,CAEA,eAAeZ,GAAiB,CAE9B,IAAMa,GADO,MAAMX,EAAa,GAE7B,IAAIY,GAAK,CACR,IAAMC,EAAqB,OAAO,OAChC,IAAI,MAAM,EAAE,EAAE,KAAK,GAAG,EACtBD,EAAE,MAAM,EAAE,CACZ,EAAE,KAAK,EAAE,EACT,OAAIA,IAAM,MAAc,GAAGC,CAAkB,gCACtC,GAAGA,CAAkB,4BAA4BD,CAAC,OAC3D,CAAC,EACA,KAAK;AAAA,CAAI,EACZ,QAAQ,IAAID,CAAM,CAEpB,CAEA,eAAed,GAAgB,CAC7B,IAAMiB,EAAkBvB,EAAK,KAAKI,EAAW,oBAAoB,EAC3DoB,EAAU,MAAM1B,EAAG,SAASyB,EAAiB,CAAE,SAAU,OAAQ,CAAC,EACxE,QAAQ,IAAIC,CAAO,CAErB",
|
|
6
|
+
"names": ["process", "fs", "url", "path", "spawn", "program", "__filename", "__dirname", "options", "printVersion", "printCommands", "subCommands", "listCommands", "subCommand", "args", "_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": "@design-edito/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.78",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"bin": {
|
|
15
15
|
"cli": "./cli/index.js",
|
|
16
16
|
"make-template": "./make-template/index.js",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"upgrade": "./upgrade/index.js",
|
|
18
|
+
"tree": "./tree/index.js"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@design-edito/tools": "^0.1.8",
|
package/upgrade/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{spawn as
|
|
2
|
+
import{spawn as n}from"node:child_process";import t from"node:process";import{program as l}from"commander";import c from"prompts";import{Logs as e}from"@design-edito/tools/agnostic/misc/logs/index.js";var o={title:e.styles.title("Global upgrade of @design-edito/cli"),installed:e.styles.info(`
|
|
3
3
|
Currently installed NPM packages:
|
|
4
|
-
`)
|
|
5
|
-
Something went wrong while listing the globally installed NPM packages. Aborting.`)
|
|
6
|
-
Aborting.`)
|
|
7
|
-
`)
|
|
8
|
-
|
|
9
|
-
`)
|
|
4
|
+
`),listError:e.styles.error(`
|
|
5
|
+
Something went wrong while listing the globally installed NPM packages. Aborting.`),confirm:"You may be prompted for your sudo password to complete the installation. Do you want to continue?",aborting:e.styles.error(`
|
|
6
|
+
Aborting.`),installing:e.styles.important(`Installing @design-edito/cli globally...
|
|
7
|
+
`),success:e.styles.success(`
|
|
8
|
+
Success.
|
|
9
|
+
`),installationError:e.styles.error(`
|
|
10
10
|
Installation failed. Please check your permissions and try again.
|
|
11
|
-
`)),o.exit(t))})})});
|
|
11
|
+
`)};l.name("@design-edito/upgrade").description("Upgrades @design-edito/cli to the latest version available").action(async()=>{console.log(o.title),console.log(o.installed),n("npm",["list","-g"],{stdio:"inherit"}).on("exit",async s=>{if(s!==0)return console.log(o.listError),t.exit(s);let{proceedUpgrade:r}=await c({name:"proceedUpgrade",type:"confirm",message:o.confirm});if(r!==!0)return console.log(o.aborting),t.exit(1);console.log("");let a=n("sudo",["npm","i","-g","@design-edito/cli"],{stdio:"inherit"});console.log(o.installing),a.on("exit",i=>{i===0?console.log(o.success):(console.error(o.installationError),t.exit(i))})})});l.parse(t.argv);
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/upgrade/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/upgrade/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { spawn } from 'node:child_process'\nimport process from 'node:process'\nimport { program } from 'commander'\nimport prompts from 'prompts'\nimport { Logs } from '@design-edito/tools/agnostic/misc/logs/index.js'\n\nprogram\n .name('@design-edito/upgrade')\n .description('Upgrades @design-edito/cli to the latest version available')\n .action(async () => {\n console.log(
|
|
5
|
-
"mappings": "AAAA,OAAS,SAAAA,MAAa,qBACtB,OAAOC,MAAa,eACpB,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAa,UACpB,OAAS,QAAAC,MAAY,
|
|
6
|
-
"names": ["spawn", "process", "program", "prompts", "Logs", "code", "proceedUpgrade", "child2"]
|
|
4
|
+
"sourcesContent": ["import { spawn } from 'node:child_process'\nimport process from 'node:process'\nimport { program } from 'commander'\nimport prompts from 'prompts'\nimport { Logs } from '@design-edito/tools/agnostic/misc/logs/index.js'\n\nconst logged = {\n title: Logs.styles.title('Global upgrade of @design-edito/cli'),\n installed: Logs.styles.info('\\nCurrently installed NPM packages:\\n'),\n listError: Logs.styles.error('\\nSomething went wrong while listing the globally installed NPM packages. Aborting.'),\n confirm: 'You may be prompted for your sudo password to complete the installation. Do you want to continue?',\n aborting: Logs.styles.error('\\nAborting.'),\n installing: Logs.styles.important('Installing @design-edito/cli globally...\\n'),\n success: Logs.styles.success('\\nSuccess.\\n'),\n installationError: Logs.styles.error('\\nInstallation failed. Please check your permissions and try again.\\n')\n}\n\nprogram\n .name('@design-edito/upgrade')\n .description('Upgrades @design-edito/cli to the latest version available')\n .action(async () => {\n console.log(logged.title)\n console.log(logged.installed)\n const child1 = spawn('npm', ['list', '-g'], { stdio: 'inherit' })\n child1.on('exit', async code => {\n if (code !== 0) {\n console.log(logged.listError)\n return process.exit(code)\n }\n const { proceedUpgrade } = await prompts({\n name: 'proceedUpgrade',\n type: 'confirm',\n message: logged.confirm\n })\n if (proceedUpgrade !== true) {\n console.log(logged.aborting)\n return process.exit(1)\n }\n console.log('')\n const child2 = spawn('sudo', ['npm', 'i', '-g', '@design-edito/cli'], { stdio: 'inherit' })\n console.log(logged.installing)\n child2.on('exit', code => {\n if (code === 0) console.log(logged.success)\n else {\n console.error(logged.installationError)\n process.exit(code) \n }\n })\n })\n })\n\nprogram.parse(process.argv)\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,SAAAA,MAAa,qBACtB,OAAOC,MAAa,eACpB,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAa,UACpB,OAAS,QAAAC,MAAY,kDAErB,IAAMC,EAAS,CACb,MAAOD,EAAK,OAAO,MAAM,qCAAqC,EAC9D,UAAWA,EAAK,OAAO,KAAK;AAAA;AAAA,CAAuC,EACnE,UAAWA,EAAK,OAAO,MAAM;AAAA,kFAAqF,EAClH,QAAS,oGACT,SAAUA,EAAK,OAAO,MAAM;AAAA,UAAa,EACzC,WAAYA,EAAK,OAAO,UAAU;AAAA,CAA4C,EAC9E,QAASA,EAAK,OAAO,QAAQ;AAAA;AAAA,CAAc,EAC3C,kBAAmBA,EAAK,OAAO,MAAM;AAAA;AAAA,CAAuE,CAC9G,EAEAF,EACG,KAAK,uBAAuB,EAC5B,YAAY,4DAA4D,EACxE,OAAO,SAAY,CAClB,QAAQ,IAAIG,EAAO,KAAK,EACxB,QAAQ,IAAIA,EAAO,SAAS,EACbL,EAAM,MAAO,CAAC,OAAQ,IAAI,EAAG,CAAE,MAAO,SAAU,CAAC,EACzD,GAAG,OAAQ,MAAMM,GAAQ,CAC9B,GAAIA,IAAS,EACX,eAAQ,IAAID,EAAO,SAAS,EACrBJ,EAAQ,KAAKK,CAAI,EAE1B,GAAM,CAAE,eAAAC,CAAe,EAAI,MAAMJ,EAAQ,CACvC,KAAM,iBACN,KAAM,UACN,QAASE,EAAO,OAClB,CAAC,EACD,GAAIE,IAAmB,GACrB,eAAQ,IAAIF,EAAO,QAAQ,EACpBJ,EAAQ,KAAK,CAAC,EAEvB,QAAQ,IAAI,EAAE,EACd,IAAMO,EAASR,EAAM,OAAQ,CAAC,MAAO,IAAK,KAAM,mBAAmB,EAAG,CAAE,MAAO,SAAU,CAAC,EAC1F,QAAQ,IAAIK,EAAO,UAAU,EAC7BG,EAAO,GAAG,OAAQF,GAAQ,CACpBA,IAAS,EAAG,QAAQ,IAAID,EAAO,OAAO,GAExC,QAAQ,MAAMA,EAAO,iBAAiB,EACtCJ,EAAQ,KAAKK,CAAI,EAErB,CAAC,CACH,CAAC,CACH,CAAC,EAEHJ,EAAQ,MAAMD,EAAQ,IAAI",
|
|
6
|
+
"names": ["spawn", "process", "program", "prompts", "Logs", "logged", "code", "proceedUpgrade", "child2"]
|
|
7
7
|
}
|