@design-edito/cli 0.1.0 → 0.1.2

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.
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import l from"node:process";import{promises as a,existsSync as j}from"node:fs";import y from"node:url";import e from"node:path";import{spawn as h}from"node:child_process";import{program as g}from"commander";import w from"prompts";import{Files as d}from"@design-edito/tools/node/files/index.js";var P=y.fileURLToPath(import.meta.url),f=e.dirname(P),p=l.cwd();g.name("@design-edito/make-template").description("Generate in cwd a project template");g.command("express").description("make express.js + typescript project structure").action(T);g.command("express-api").description("make express.js + typescript + docker project structure for a quick API setup").action(N);g.command("html").description("make simple html project structure").action(k);g.command("react").description("make react + typescript project structure").action(S);g.parse(l.argv);async function k(){let o=e.join(f,"assets/html");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"html-template");await a.cp(o,n,{recursive:!0})}async function S(){let o=e.join(f,"assets/react");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"react-template");await a.cp(o,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),u=e.join(n,"package.json");await d.readWrite(u,r=>{let t=typeof r=="string"?r:r.toString(),s=JSON.parse(t);delete s.name;let x={name:i,...s};return`${JSON.stringify(x,null,2)}
3
- `},{encoding:"utf-8"});let m=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((r,t)=>{m.on("exit",()=>r(!0)),m.on("error",()=>t(!1))});let c=e.join(p,i);await a.rename(n,c),await a.rename(e.join(c,"gitignore"),e.join(c,".gitignore"))}async function T(){let o=e.join(f,"assets/express");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"express-template");await a.cp(o,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (lower case a-z, hyphens or underscores only)",type:"text"}),u=e.join(n,"package.json");await d.readWrite(u,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let m=e.join(n,"src/www/index.ts");await d.readWrite(m,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let c=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((t,s)=>{c.on("exit",()=>t(!0)),c.on("error",()=>s(!1))});let r=e.join(p,i);await a.rename(n,r),await a.rename(e.join(r,"gitignore"),e.join(r,".gitignore"))}async function N(){let o=e.join(f,"assets/express-api");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"express-api-template");await a.cp(o,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (lower case a-z, hyphens or underscores only)",type:"text"}),u=e.join(n,"package.json");await d.readWrite(u,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let m=e.join(n,"src//www/index.ts");await d.readWrite(m,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let c=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((t,s)=>{c.on("exit",()=>t(!0)),c.on("error",()=>s(!1))});let r=e.join(p,i);await a.rename(n,r),await a.rename(e.join(r,"gitignore"),e.join(r,".gitignore")),await a.rename(e.join(r,"env"),e.join(r,".env")),console.log("You're all set! Now configure .env file!")}
2
+ import l from"node:process";import{promises as a,existsSync as j}from"node:fs";import y from"node:url";import e from"node:path";import{spawn as h}from"node:child_process";import{program as g}from"commander";import w from"prompts";import{readWrite as d}from"@design-edito/tools/node/files/index.js";var P=y.fileURLToPath(import.meta.url),f=e.dirname(P),p=l.cwd();g.name("@design-edito/make-template").description("Generate in cwd a project template");g.command("express").description("make express.js + typescript project structure").action(T);g.command("express-api").description("make express.js + typescript + docker project structure for a quick API setup").action(N);g.command("html").description("make simple html project structure").action(k);g.command("react").description("make react + typescript project structure").action(S);g.parse(l.argv);async function k(){let o=e.join(f,"assets/html");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"html-template");await a.cp(o,n,{recursive:!0})}async function S(){let o=e.join(f,"assets/react");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"react-template");await a.cp(o,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),u=e.join(n,"package.json");await d(u,r=>{let t=typeof r=="string"?r:r.toString(),s=JSON.parse(t);delete s.name;let x={name:i,...s};return`${JSON.stringify(x,null,2)}
3
+ `},{encoding:"utf-8"});let m=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((r,t)=>{m.on("exit",()=>r(!0)),m.on("error",()=>t(!1))});let c=e.join(p,i);await a.rename(n,c),await a.rename(e.join(c,"gitignore"),e.join(c,".gitignore"))}async function T(){let o=e.join(f,"assets/express");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"express-template");await a.cp(o,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (lower case a-z, hyphens or underscores only)",type:"text"}),u=e.join(n,"package.json");await d(u,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let m=e.join(n,"src/www/index.ts");await d(m,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let c=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((t,s)=>{c.on("exit",()=>t(!0)),c.on("error",()=>s(!1))});let r=e.join(p,i);await a.rename(n,r),await a.rename(e.join(r,"gitignore"),e.join(r,".gitignore"))}async function N(){let o=e.join(f,"assets/express-api");if(!j(o))return console.error(`Could not find the template to copy at ${o}`),l.exit(1);let n=e.join(p,"express-api-template");await a.cp(o,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (lower case a-z, hyphens or underscores only)",type:"text"}),u=e.join(n,"package.json");await d(u,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let m=e.join(n,"src//www/index.ts");await d(m,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{encoding:"utf-8"});let c=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((t,s)=>{c.on("exit",()=>t(!0)),c.on("error",()=>s(!1))});let r=e.join(p,i);await a.rename(n,r),await a.rename(e.join(r,"gitignore"),e.join(r,".gitignore")),await a.rename(e.join(r,"env"),e.join(r,".env")),console.log("You're all set! Now configure .env file!")}
4
4
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 '@design-edito/tools/node/files/index.js'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\nconst CWD = process.cwd()\n\nprogram\n .name('@design-edito/make-template')\n .description('Generate in cwd a project template')\n\nprogram\n .command('express')\n .description('make express.js + typescript project structure')\n .action(makeExpress)\n\nprogram\n .command('express-api')\n .description('make express.js + typescript + docker project structure for a quick API setup')\n .action(makeExpressApi)\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\n/* * * * * * * * * * * * * * * * * * *\n *\n * HTML\n *\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\n/* * * * * * * * * * * * * * * * * * *\n *\n * REACT\n *\n * * * * * * * * * * * * * * * * * * */\nasync function makeReact () {\n const reactTemplatePath = path.join(__dirname, 'assets/react')\n if (!existsSync(reactTemplatePath)) {\n console.error(`Could not find the template to copy at ${reactTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'react-template')\n\n // Copy\n await fs.cp(reactTemplatePath, 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 project 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\n/* * * * * * * * * * * * * * * * * * *\n *\n * EXPRESS\n *\n * * * * * * * * * * * * * * * * * * */\nasync function makeExpress () {\n const expressTemplatePath = path.join(__dirname, 'assets/express')\n if (!existsSync(expressTemplatePath)) {\n console.error(`Could not find the template to copy at ${expressTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'express-template')\n\n // Copy\n await fs.cp(expressTemplatePath, defaultTargetPath, { recursive: true })\n const { projectName } = await prompts({\n name: 'projectName',\n message: 'Project name ? (lower case a-z, hyphens or underscores only)',\n type: 'text'\n })\n\n // Custom project name in package.json\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 return content.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, { encoding: 'utf-8' })\n\n // Custom project name in src/www/index.ts\n const binStartTsPath = path.join(defaultTargetPath, 'src/www/index.ts')\n await Files.readWrite(binStartTsPath, rawContent => {\n const originalContent = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return originalContent.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\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(path.join(targetPath, 'gitignore'), path.join(targetPath, '.gitignore'))\n}\n\n/* * * * * * * * * * * * * * * * * * *\n *\n * EXPRESS API\n *\n * * * * * * * * * * * * * * * * * * */\nasync function makeExpressApi () {\n const expressTemplatePath = path.join(__dirname, 'assets/express-api')\n if (!existsSync(expressTemplatePath)) {\n console.error(`Could not find the template to copy at ${expressTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'express-api-template')\n\n // Copy\n await fs.cp(expressTemplatePath, defaultTargetPath, { recursive: true })\n const { projectName } = await prompts({\n name: 'projectName',\n message: 'Project name ? (lower case a-z, hyphens or underscores only)',\n type: 'text'\n })\n\n // Custom project name in package.json\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 return content.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, { encoding: 'utf-8' })\n\n // Custom project name in src/www/index.ts\n const binStartTsPath = path.join(defaultTargetPath, 'src//www/index.ts')\n await Files.readWrite(binStartTsPath, rawContent => {\n const originalContent = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return originalContent.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\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(path.join(targetPath, 'gitignore'), path.join(targetPath, '.gitignore'))\n await fs.rename(path.join(targetPath, 'env'), path.join(targetPath, '.env'))\n\n console.log('You\\'re all set! Now configure .env file!')\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,0CAEtB,IAAMC,EAAaN,EAAI,cAAc,YAAY,GAAG,EAC9CO,EAAYN,EAAK,QAAQK,CAAU,EACnCE,EAAMX,EAAQ,IAAI,EAExBM,EACG,KAAK,6BAA6B,EAClC,YAAY,oCAAoC,EAEnDA,EACG,QAAQ,SAAS,EACjB,YAAY,gDAAgD,EAC5D,OAAOM,CAAW,EAErBN,EACG,QAAQ,aAAa,EACrB,YA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AO,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,IAAMX,EAAab,EAAK,KAAKO,EAAKS,CAAW,EAC7C,MAAMnB,EAAG,OAAOkB,EAAmBF,CAAU,EAG7C,MAAMhB,EAAG,OAAOG,EAAK,KAAKa,EAAY,WAAW,EAAGb,EAAK,KAAKa,EAAY,YAAY,CAAC,EACvF,MAAMhB,EAAG,OAAOG,EAAK,KAAKa,EAAY,KAAK,EAAGb,EAAK,KAAKa,EAAY,MAAM,CAAC,EAE3E,QAAQ,IAAI,0CAA2C,CACzD",
6
- "names": ["process", "fs", "existsSync", "url", "path", "spawn", "program", "prompts", "Files", "__filename", "__dirname", "CWD", "makeExpress", "makeExpressApi", "makeHtml", "makeReact", "htmlTemplatePath", "targetPath", "reactTemplatePath", "defaultTargetPath", "projectName", "packageJsonPath", "rawContent", "content", "contentObj", "newContentObj", "npmISubprocess", "resolve", "reject", "expressTemplatePath", "binStartTsPath"]
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 { readWrite as readWriteFile } from '@design-edito/tools/node/files/index.js'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\nconst CWD = process.cwd()\n\nprogram\n .name('@design-edito/make-template')\n .description('Generate in cwd a project template')\n\nprogram\n .command('express')\n .description('make express.js + typescript project structure')\n .action(makeExpress)\n\nprogram\n .command('express-api')\n .description('make express.js + typescript + docker project structure for a quick API setup')\n .action(makeExpressApi)\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\n/* * * * * * * * * * * * * * * * * * *\n *\n * HTML\n *\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\n/* * * * * * * * * * * * * * * * * * *\n *\n * REACT\n *\n * * * * * * * * * * * * * * * * * * */\nasync function makeReact () {\n const reactTemplatePath = path.join(__dirname, 'assets/react')\n if (!existsSync(reactTemplatePath)) {\n console.error(`Could not find the template to copy at ${reactTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'react-template')\n\n // Copy\n await fs.cp(reactTemplatePath, 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 project name\n const packageJsonPath = path.join(defaultTargetPath, 'package.json')\n await readWriteFile(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\n/* * * * * * * * * * * * * * * * * * *\n *\n * EXPRESS\n *\n * * * * * * * * * * * * * * * * * * */\nasync function makeExpress () {\n const expressTemplatePath = path.join(__dirname, 'assets/express')\n if (!existsSync(expressTemplatePath)) {\n console.error(`Could not find the template to copy at ${expressTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'express-template')\n\n // Copy\n await fs.cp(expressTemplatePath, defaultTargetPath, { recursive: true })\n const { projectName } = await prompts({\n name: 'projectName',\n message: 'Project name ? (lower case a-z, hyphens or underscores only)',\n type: 'text'\n })\n\n // Custom project name in package.json\n const packageJsonPath = path.join(defaultTargetPath, 'package.json')\n await readWriteFile(packageJsonPath, rawContent => {\n const content = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return content.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, { encoding: 'utf-8' })\n\n // Custom project name in src/www/index.ts\n const binStartTsPath = path.join(defaultTargetPath, 'src/www/index.ts')\n await readWriteFile(binStartTsPath, rawContent => {\n const originalContent = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return originalContent.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\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(path.join(targetPath, 'gitignore'), path.join(targetPath, '.gitignore'))\n}\n\n/* * * * * * * * * * * * * * * * * * *\n *\n * EXPRESS API\n *\n * * * * * * * * * * * * * * * * * * */\nasync function makeExpressApi () {\n const expressTemplatePath = path.join(__dirname, 'assets/express-api')\n if (!existsSync(expressTemplatePath)) {\n console.error(`Could not find the template to copy at ${expressTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'express-api-template')\n\n // Copy\n await fs.cp(expressTemplatePath, defaultTargetPath, { recursive: true })\n const { projectName } = await prompts({\n name: 'projectName',\n message: 'Project name ? (lower case a-z, hyphens or underscores only)',\n type: 'text'\n })\n\n // Custom project name in package.json\n const packageJsonPath = path.join(defaultTargetPath, 'package.json')\n await readWriteFile(packageJsonPath, rawContent => {\n const content = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return content.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, { encoding: 'utf-8' })\n\n // Custom project name in src/www/index.ts\n const binStartTsPath = path.join(defaultTargetPath, 'src//www/index.ts')\n await readWriteFile(binStartTsPath, rawContent => {\n const originalContent = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return originalContent.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\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(path.join(targetPath, 'gitignore'), path.join(targetPath, '.gitignore'))\n await fs.rename(path.join(targetPath, 'env'), path.join(targetPath, '.env'))\n\n console.log('You\\'re all set! Now configure .env file!')\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,aAAaC,MAAqB,0CAE3C,IAAMC,EAAaN,EAAI,cAAc,YAAY,GAAG,EAC9CO,EAAYN,EAAK,QAAQK,CAAU,EACnCE,EAAMX,EAAQ,IAAI,EAExBM,EACG,KAAK,6BAA6B,EAClC,YAAY,oCAAoC,EAE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AMM,EAAiBrB,EAAM,MAAMc,CAAiB,YAAa,CAAE,MAAO,UAAW,MAAO,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,IAAMX,EAAab,EAAK,KAAKO,EAAKS,CAAW,EAC7C,MAAMnB,EAAG,OAAOkB,EAAmBF,CAAU,EAG7C,MAAMhB,EAAG,OAAOG,EAAK,KAAKa,EAAY,WAAW,EAAGb,EAAK,KAAKa,EAAY,YAAY,CAAC,EACvF,MAAMhB,EAAG,OAAOG,EAAK,KAAKa,EAAY,KAAK,EAAGb,EAAK,KAAKa,EAAY,MAAM,CAAC,EAE3E,QAAQ,IAAI,0CAA2C,CACzD",
6
+ "names": ["process", "fs", "existsSync", "url", "path", "spawn", "program", "prompts", "readWriteFile", "__filename", "__dirname", "CWD", "makeExpress", "makeExpressApi", "makeHtml", "makeReact", "htmlTemplatePath", "targetPath", "reactTemplatePath", "defaultTargetPath", "projectName", "packageJsonPath", "rawContent", "content", "contentObj", "newContentObj", "npmISubprocess", "resolve", "reject", "expressTemplatePath", "binStartTsPath"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -13,28 +13,28 @@
13
13
  "module": "index.js",
14
14
  "bin": {
15
15
  "add": "./add/index.js",
16
+ "cli": "./cli/index.js",
16
17
  "commit": "./commit/index.js",
17
18
  "make-template": "./make-template/index.js",
18
- "cli": "./cli/index.js",
19
+ "pull": "./pull/index.js",
19
20
  "push": "./push/index.js",
20
21
  "reset": "./reset/index.js",
21
- "pull": "./pull/index.js",
22
22
  "serve": "./serve/index.js",
23
23
  "status": "./status/index.js",
24
24
  "tree": "./tree/index.js"
25
25
  },
26
26
  "dependencies": {
27
- "@design-edito/tools": "^0.2.0",
28
- "commander": "^14.0.0",
27
+ "@design-edito/tools": "^0.2.10",
28
+ "commander": "^14.0.1",
29
29
  "prompts": "^2.4.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^24.2.1",
32
+ "@types/node": "^24.7.1",
33
33
  "@types/prompts": "^2.4.9",
34
- "@types/semver": "^7.7.0",
35
- "esbuild": "^0.25.8",
36
- "semver": "^7.7.2",
34
+ "@types/semver": "^7.7.1",
35
+ "esbuild": "^0.25.10",
36
+ "semver": "^7.7.3",
37
37
  "simple-git": "^3.28.0",
38
- "typescript": "^5.9.2"
38
+ "typescript": "^5.9.3"
39
39
  }
40
40
  }