@design-edito/cli 0.1.6 → 0.1.9

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.
@@ -4,6 +4,7 @@ commit
4
4
  make-template
5
5
  pull
6
6
  push
7
+ record
7
8
  reset
8
9
  serve
9
10
  status
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.9
@@ -16,7 +16,7 @@
16
16
  "cookie-parser": "^1.4.7",
17
17
  "cors": "^2.8.5",
18
18
  "debug": "^4.4.0",
19
- "esbuild": "^0.25.0",
19
+ "esbuild": "^0.27.2",
20
20
  "express": "^5.1.0",
21
21
  "morgan": "^1.10.0",
22
22
  "typescript": "^5.7.3"
@@ -27,7 +27,7 @@
27
27
  "@types/debug": "^4.1.12",
28
28
  "@types/express": "^5.0.0",
29
29
  "@types/morgan": "^1.9.9",
30
- "@types/node": "^24.7.1",
30
+ "@types/node": "^25.0.10",
31
31
  "chokidar-cli": "^3.0.0",
32
32
  "concurrently": "^9.1.2"
33
33
  }
@@ -25,18 +25,18 @@
25
25
  "docker:clean:dev": "docker rm <<@design-edito/cli----replace-with-name>>-dev && docker rmi <<@design-edito/cli----replace-with-name>>-dev"
26
26
  },
27
27
  "dependencies": {
28
- "@design-edito/tools": "^0.2.10",
29
- "agenda": "^5.0.0",
28
+ "@design-edito/tools": "^0.3.2",
29
+ "agenda": "^6.0.0",
30
30
  "bcrypt": "^6.0.0",
31
31
  "cookie-parser": "^1.4.7",
32
32
  "cors": "^2.8.5",
33
33
  "debug": "^4.4.0",
34
34
  "dotenv": "^17.2.3",
35
- "esbuild": "^0.25.0",
35
+ "esbuild": "^0.27.2",
36
36
  "express": "^5.1.0",
37
37
  "jsonwebtoken": "^9.0.2",
38
38
  "mailersend": "^2.3.0",
39
- "mongoose": "^8.10.1",
39
+ "mongoose": "^9.1.5",
40
40
  "morgan": "^1.10.0",
41
41
  "typescript": "^5.7.3",
42
42
  "validator": "^13.12.0",
@@ -51,7 +51,7 @@
51
51
  "@types/jsonwebtoken": "^9.0.8",
52
52
  "@types/mongoose": "^5.11.96",
53
53
  "@types/morgan": "^1.9.9",
54
- "@types/node": "^24.7.1",
54
+ "@types/node": "^25.0.10",
55
55
  "@types/validator": "^13.12.2",
56
56
  "chokidar-cli": "^3.0.0",
57
57
  "concurrently": "^9.1.2",
@@ -0,0 +1,13 @@
1
+ import esbuild from 'esbuild'
2
+
3
+ esbuild.build({
4
+ entryPoints: ['src/index.ts'],
5
+ outdir: 'dist',
6
+ bundle: true,
7
+ sourcemap: true,
8
+ platform: 'node',
9
+ target: 'node16',
10
+ format: 'esm',
11
+ logLevel: 'info',
12
+ external: []
13
+ }).catch(() => process.exit(1))
@@ -0,0 +1,214 @@
1
+ # Created by https://www.toptal.com/developers/gitignore/api/node,osx,linux,windows
2
+ # Edit at https://www.toptal.com/developers/gitignore?templates=node,osx,linux,windows
3
+
4
+ ### Linux ###
5
+ *~
6
+
7
+ # temporary files which can be created if a process still has a handle open of a deleted file
8
+ .fuse_hidden*
9
+
10
+ # KDE directory preferences
11
+ .directory
12
+
13
+ # Linux trash folder which might appear on any partition or disk
14
+ .Trash-*
15
+
16
+ # .nfs files are created when an open file is removed but is still being accessed
17
+ .nfs*
18
+
19
+ ### Node ###
20
+ # Logs
21
+ logs
22
+ *.log
23
+ npm-debug.log*
24
+ yarn-debug.log*
25
+ yarn-error.log*
26
+ lerna-debug.log*
27
+ .pnpm-debug.log*
28
+
29
+ # Diagnostic reports (https://nodejs.org/api/report.html)
30
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
31
+
32
+ # Runtime data
33
+ pids
34
+ *.pid
35
+ *.seed
36
+ *.pid.lock
37
+
38
+ # Directory for instrumented libs generated by jscoverage/JSCover
39
+ lib-cov
40
+
41
+ # Coverage directory used by tools like istanbul
42
+ coverage
43
+ *.lcov
44
+
45
+ # nyc test coverage
46
+ .nyc_output
47
+
48
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
49
+ .grunt
50
+
51
+ # Bower dependency directory (https://bower.io/)
52
+ bower_components
53
+
54
+ # node-waf configuration
55
+ .lock-wscript
56
+
57
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
58
+ build/Release
59
+
60
+ # Dependency directories
61
+ node_modules/
62
+ jspm_packages/
63
+
64
+ # Snowpack dependency directory (https://snowpack.dev/)
65
+ web_modules/
66
+
67
+ # TypeScript cache
68
+ *.tsbuildinfo
69
+
70
+ # Optional npm cache directory
71
+ .npm
72
+
73
+ # Optional eslint cache
74
+ .eslintcache
75
+
76
+ # Optional stylelint cache
77
+ .stylelintcache
78
+
79
+ # Microbundle cache
80
+ .rpt2_cache/
81
+ .rts2_cache_cjs/
82
+ .rts2_cache_es/
83
+ .rts2_cache_umd/
84
+
85
+ # Optional REPL history
86
+ .node_repl_history
87
+
88
+ # Output of 'npm pack'
89
+ *.tgz
90
+
91
+ # Yarn Integrity file
92
+ .yarn-integrity
93
+
94
+ # dotenv environment variable files
95
+ .env
96
+ .env.development.local
97
+ .env.test.local
98
+ .env.production.local
99
+ .env.local
100
+
101
+ # parcel-bundler cache (https://parceljs.org/)
102
+ .cache
103
+ .parcel-cache
104
+
105
+ # Next.js build output
106
+ .next
107
+ out
108
+
109
+ # Nuxt.js build / generate output
110
+ .nuxt
111
+ dist
112
+
113
+ # Gatsby files
114
+ .cache/
115
+ # Comment in the public line in if your project uses Gatsby and not Next.js
116
+ # https://nextjs.org/blog/next-9-1#public-directory-support
117
+ # public
118
+
119
+ # vuepress build output
120
+ .vuepress/dist
121
+
122
+ # vuepress v2.x temp and cache directory
123
+ .temp
124
+
125
+ # Docusaurus cache and generated files
126
+ .docusaurus
127
+
128
+ # Serverless directories
129
+ .serverless/
130
+
131
+ # FuseBox cache
132
+ .fusebox/
133
+
134
+ # DynamoDB Local files
135
+ .dynamodb/
136
+
137
+ # TernJS port file
138
+ .tern-port
139
+
140
+ # Stores VSCode versions used for testing VSCode extensions
141
+ .vscode-test
142
+
143
+ # yarn v2
144
+ .yarn/cache
145
+ .yarn/unplugged
146
+ .yarn/build-state.yml
147
+ .yarn/install-state.gz
148
+ .pnp.*
149
+
150
+ ### Node Patch ###
151
+ # Serverless Webpack directories
152
+ .webpack/
153
+
154
+ # Optional stylelint cache
155
+
156
+ # SvelteKit build / generate output
157
+ .svelte-kit
158
+
159
+ ### OSX ###
160
+ # General
161
+ .DS_Store
162
+ .AppleDouble
163
+ .LSOverride
164
+
165
+ # Icon must end with two \r
166
+ Icon
167
+
168
+
169
+ # Thumbnails
170
+ ._*
171
+
172
+ # Files that might appear in the root of a volume
173
+ .DocumentRevisions-V100
174
+ .fseventsd
175
+ .Spotlight-V100
176
+ .TemporaryItems
177
+ .Trashes
178
+ .VolumeIcon.icns
179
+ .com.apple.timemachine.donotpresent
180
+
181
+ # Directories potentially created on remote AFP share
182
+ .AppleDB
183
+ .AppleDesktop
184
+ Network Trash Folder
185
+ Temporary Items
186
+ .apdisk
187
+
188
+ ### Windows ###
189
+ # Windows thumbnail cache files
190
+ Thumbs.db
191
+ Thumbs.db:encryptable
192
+ ehthumbs.db
193
+ ehthumbs_vista.db
194
+
195
+ # Dump file
196
+ *.stackdump
197
+
198
+ # Folder config file
199
+ [Dd]esktop.ini
200
+
201
+ # Recycle Bin used on file shares
202
+ $RECYCLE.BIN/
203
+
204
+ # Windows Installer files
205
+ *.cab
206
+ *.msi
207
+ *.msix
208
+ *.msm
209
+ *.msp
210
+
211
+ # Windows shortcuts
212
+ *.lnk
213
+
214
+ # End of https://www.toptal.com/developers/gitignore/api/node,osx,linux,windows
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "<<@design-edito/cli----replace-with-name>>",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "check:src": "npx tsc -p src/tsconfig.json --noEmit",
8
+ "build:src": "node esbuild.config.js",
9
+ "start": "npm run build:src && node ./dist/index.js"
10
+ },
11
+ "dependencies": {
12
+ "esbuild": "^0.27.2",
13
+ "typescript": "^5.7.3"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^25.0.10"
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ console.log('Hello world!')
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node",
6
+ "esModuleInterop": true,
7
+ "declaration": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "noUncheckedIndexedAccess": true,
12
+ "strictNullChecks": true,
13
+ "noEmit": true
14
+ },
15
+ "include": ["./**/*"]
16
+ }
@@ -20,11 +20,11 @@
20
20
  "author": "",
21
21
  "license": "ISC",
22
22
  "devDependencies": {
23
- "@types/node": "^24.7.1",
23
+ "@types/node": "^25.0.10",
24
24
  "@types/react": "^19.2.2",
25
25
  "@types/react-dom": "^19.2.1",
26
26
  "concurrently": "^9.2.1",
27
- "esbuild": "^0.25.10",
27
+ "esbuild": "^0.27.2",
28
28
  "esbuild-plugin-inline-image": "^0.0.9",
29
29
  "esbuild-sass-plugin": "^3.2.0",
30
30
  "http-server": "^14.1.1",
@@ -1,4 +1,5 @@
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{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!")}
2
+ import g from"node:process";import{promises as a,existsSync as f}from"node:fs";import P from"node:url";import e from"node:path";import{spawn as h}from"node:child_process";import{program as u}from"commander";import w from"prompts";import{readWrite as d}from"@design-edito/tools/node/files/read-write/index.js";var x=P.fileURLToPath(import.meta.url),j=e.dirname(x),m=g.cwd();u.name("@design-edito/make-template").description("Generate in cwd a project template");u.command("express").description("make express.js + typescript project structure").action(O);u.command("express-api").description("make express.js + typescript + docker project structure for a quick API setup").action(T);u.command("node-ts").description("make node + typescript project structure").action(N);u.command("html").description("make simple html project structure").action(k);u.command("react").description("make react + typescript project structure").action(S);u.parse(g.argv);async function k(){let r=e.join(j,"assets/html");if(!f(r))return console.error(`Could not find the template to copy at ${r}`),g.exit(1);let n=e.join(m,"html-template");await a.cp(r,n,{recursive:!0})}async function S(){let r=e.join(j,"assets/react");if(!f(r))return console.error(`Could not find the template to copy at ${r}`),g.exit(1);let n=e.join(m,"react-template");await a.cp(r,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),l=e.join(n,"package.json");await d(l,o=>{let t=typeof o=="string"?o:o.toString(),c=JSON.parse(t);delete c.name;let y={name:i,...c};return`${JSON.stringify(y,null,2)}
3
+ `},{readOptions:{encoding:"utf-8"}});let p=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((o,t)=>{p.on("exit",()=>o(!0)),p.on("error",()=>t(!1))});let s=e.join(m,i);await a.rename(n,s),await a.rename(e.join(s,"gitignore"),e.join(s,".gitignore"))}async function N(){let r=e.join(j,"assets/node-ts");if(!f(r))return console.error(`Could not find the template to copy at ${r}`),g.exit(1);let n=e.join(m,"node-template");await a.cp(r,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),l=e.join(n,"package.json");await d(l,o=>{let t=typeof o=="string"?o:o.toString(),c=JSON.parse(t);delete c.name;let y={name:i,...c};return`${JSON.stringify(y,null,2)}
4
+ `},{readOptions:{encoding:"utf-8"}});let p=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((o,t)=>{p.on("exit",()=>o(!0)),p.on("error",()=>t(!1))});let s=e.join(m,i);await a.rename(n,s),await a.rename(e.join(s,"gitignore"),e.join(s,".gitignore"))}async function O(){let r=e.join(j,"assets/express");if(!f(r))return console.error(`Could not find the template to copy at ${r}`),g.exit(1);let n=e.join(m,"express-template");await a.cp(r,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (lower case a-z, hyphens or underscores only)",type:"text"}),l=e.join(n,"package.json");await d(l,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{readOptions:{encoding:"utf-8"}});let p=e.join(n,"src/www/index.ts");await d(p,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{readOptions:{encoding:"utf-8"}});let s=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((t,c)=>{s.on("exit",()=>t(!0)),s.on("error",()=>c(!1))});let o=e.join(m,i);await a.rename(n,o),await a.rename(e.join(o,"gitignore"),e.join(o,".gitignore"))}async function T(){let r=e.join(j,"assets/express-api");if(!f(r))return console.error(`Could not find the template to copy at ${r}`),g.exit(1);let n=e.join(m,"express-api-template");await a.cp(r,n,{recursive:!0});let{projectName:i}=await w({name:"projectName",message:"Project name ? (lower case a-z, hyphens or underscores only)",type:"text"}),l=e.join(n,"package.json");await d(l,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{readOptions:{encoding:"utf-8"}});let p=e.join(n,"src//www/index.ts");await d(p,t=>(typeof t=="string"?t:t.toString()).replaceAll("<<@design-edito/cli----replace-with-name>>",i),{readOptions:{encoding:"utf-8"}});let s=h(`cd ${n} && npm i`,{stdio:"inherit",shell:!0});await new Promise((t,c)=>{s.on("exit",()=>t(!0)),s.on("error",()=>c(!1))});let o=e.join(m,i);await a.rename(n,o),await a.rename(e.join(o,"gitignore"),e.join(o,".gitignore")),await a.rename(e.join(o,"env"),e.join(o,".env")),console.log("You're all set! Now configure .env file!")}
4
5
  //# 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 { 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,EAEnDA,EACG,QAAQ,SAAS,EACjB,YAAY,gDAAgD,EAC5D,OAAOM,CAAW,EAErBN,EACG,QAAQ,aAAa,EACrB,YAAY,+EAA+E,EAC3F,OAAOO,CAAc,EAExBP,EACG,QAAQ,MAAM,EACd,YAAY,oCAAoC,EAChD,OAAOQ,CAAQ,EAElBR,EACG,QAAQ,OAAO,EACf,YAAY,2CAA2C,EACvD,OAAOS,C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,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"]
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/read-write/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('node-ts')\n .description('make node + typescript project structure')\n .action(makeNodeTs)\n\nprogram\n .command('html')\n .description('make simple html project structure')\n .action(makeHtml)\n\n program\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<string>(packageJsonPath, (rawContent: string | Buffer) => {\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 }, {\n readOptions: {\n encoding: 'utf-8'\n }\n })\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 * NODE TS\n *\n * * * * * * * * * * * * * * * * * * */\nasync function makeNodeTs () {\n const nodeTemplatePath = path.join(__dirname, 'assets/node-ts')\n if (!existsSync(nodeTemplatePath)) {\n console.error(`Could not find the template to copy at ${nodeTemplatePath}`)\n return process.exit(1)\n }\n const defaultTargetPath = path.join(CWD, 'node-template')\n\n // Copy\n await fs.cp(nodeTemplatePath, 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<string>(packageJsonPath, (rawContent: string | Buffer) => {\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 }, {\n readOptions: {\n encoding: 'utf-8'\n }\n })\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<string>(packageJsonPath, (rawContent: string | Buffer) => {\n const content = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return content.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, {\n readOptions: {\n encoding: 'utf-8'\n }\n })\n\n // Custom project name in src/www/index.ts\n const binStartTsPath = path.join(defaultTargetPath, 'src/www/index.ts')\n await readWriteFile<string>(binStartTsPath, (rawContent: string | Buffer) => {\n const originalContent = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return originalContent.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, {\n readOptions: {\n encoding: 'utf-8'\n }\n })\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<string>(packageJsonPath, (rawContent: string | Buffer) => {\n const content = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return content.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, {\n readOptions: {\n encoding: 'utf-8'\n }\n })\n\n // Custom project name in src/www/index.ts\n const binStartTsPath = path.join(defaultTargetPath, 'src//www/index.ts')\n await readWriteFile<string>(binStartTsPath, (rawContent: string | Buffer) => {\n const originalContent = typeof rawContent === 'string'\n ? rawContent\n : rawContent.toString()\n return originalContent.replaceAll('<<@design-edito/cli----replace-with-name>>', projectName)\n }, {\n readOptions: {\n encoding: 'utf-8'\n }\n })\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,qDAE3C,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,YAAY,+EAA+E,EAC3F,OAAOO,CAAc,EAExBP,EACG,QAAQ,SAAS,EACjB,YAAY,0CAA0C,EACtD,OAAOQ,CAAU,EAEpBR,EACG,QAAQ,MAAM,EACd,YAAY,oCAAoC,EAChD,OAAOS,CAAQ,EAEhBT,EAC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AAI,CAAC,EAC7CD,EAAe,GAAG,QAAS,IAAME,EAAO,EAAK,CAAC,CAChD,CAAC,EAGD,IAAMX,EAAad,EAAK,KAAKO,EAAKU,CAAW,EAC7C,MAAMpB,EAAG,OAAOmB,EAAmBF,CAAU,EAG7C,MAAMjB,EAAG,OAAOG,EAAK,KAAKc,EAAY,WAAW,EAAGd,EAAK,KAAKc,EAAY,YAAY,CAAC,EACvF,MAAMjB,EAAG,OAAOG,EAAK,KAAKc,EAAY,KAAK,EAAGd,EAAK,KAAKc,EAAY,MAAM,CAAC,EAE3E,QAAQ,IAAI,0CAA2C,CACzD",
6
+ "names": ["process", "fs", "existsSync", "url", "path", "spawn", "program", "prompts", "readWriteFile", "__filename", "__dirname", "CWD", "makeExpress", "makeExpressApi", "makeNodeTs", "makeHtml", "makeReact", "htmlTemplatePath", "targetPath", "reactTemplatePath", "defaultTargetPath", "projectName", "packageJsonPath", "rawContent", "content", "contentObj", "newContentObj", "npmISubprocess", "resolve", "reject", "nodeTemplatePath", "expressTemplatePath", "binStartTsPath"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -15,26 +15,27 @@
15
15
  "add": "./add/index.js",
16
16
  "cli": "./cli/index.js",
17
17
  "commit": "./commit/index.js",
18
- "pull": "./pull/index.js",
19
18
  "make-template": "./make-template/index.js",
19
+ "pull": "./pull/index.js",
20
20
  "push": "./push/index.js",
21
+ "record": "./record/index.js",
21
22
  "reset": "./reset/index.js",
22
- "serve": "./serve/index.js",
23
23
  "status": "./status/index.js",
24
- "tree": "./tree/index.js"
24
+ "tree": "./tree/index.js",
25
+ "serve": "./serve/index.js"
25
26
  },
26
27
  "dependencies": {
27
- "@design-edito/tools": "^0.2.17",
28
- "commander": "^14.0.1",
28
+ "@design-edito/tools": "^0.3.9",
29
+ "commander": "^14.0.3",
29
30
  "prompts": "^2.4.2"
30
31
  },
31
32
  "devDependencies": {
32
- "@types/node": "^24.7.1",
33
+ "@types/node": "^25.2.1",
33
34
  "@types/prompts": "^2.4.9",
34
35
  "@types/semver": "^7.7.1",
35
- "esbuild": "^0.25.10",
36
- "semver": "^7.7.3",
37
- "simple-git": "^3.28.0",
36
+ "esbuild": "^0.27.3",
37
+ "semver": "^7.7.4",
38
+ "simple-git": "^3.30.0",
38
39
  "typescript": "^5.9.3"
39
40
  }
40
41
  }
package/push/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{spawn as t}from"child_process";import{program as r}from"commander";r.name("@design-edito/push").description("Shorthand for git push with arguments forwarding").allowUnknownOption(!0).arguments("[args...]").action(o=>{t("git",["-c","color.ui=always","push",...o],{stdio:"inherit"}).on("exit",i=>process.exit(i??0))});r.parse(process.argv);
2
+ import{program as r}from"commander";import{spawner as s}from"@design-edito/tools/node/process/spawner/index.js";import{promptContinue as m}from"@design-edito/tools/node/process/prompt-continue/index.js";r.name("@design-edito/push").description("Shorthand for git push with arguments forwarding").allowUnknownOption(!0).argument("<remote>","name of the remote source").argument("<branch>","name of the branch").argument("[message]","message of the commit").argument("[files]","files to add").argument("[rest...]","rest of the arguments").option("-p, --pull","pull before pushing").action(async(t,e,i,o,u,a)=>{if(a.pull&&!(await s(`Pulling from ${t}/${e}...`,"git",["pull",t,e])).success||o!==void 0&&!(await s("Adding to stage...","git",["add",o])).success||i!==void 0&&!(await s(`Commiting with message "${i}"...`,"git",["commit","-m",i])).success||(await m("Push now?",!0),!(await s(`Pushing to ${t}/${e}`,"git",["push",t,e,...u??[]])).success))throw process.exit(1)});r.parse(process.argv);
3
3
  //# sourceMappingURL=index.js.map
package/push/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/push/index.ts"],
4
- "sourcesContent": ["import { spawn } from 'child_process'\nimport { program } from 'commander'\n\nprogram\n .name('@design-edito/push')\n .description('Shorthand for git push with arguments forwarding')\n .allowUnknownOption(true)\n .arguments('[args...]')\n .action((args: string[]) => {\n spawn(\n 'git',\n ['-c', 'color.ui=always', 'push', ...args],\n { stdio: 'inherit' }\n ).on('exit', code => process.exit(code ?? 0))\n })\n\nprogram.parse(process.argv)\n"],
5
- "mappings": "AAAA,OAAS,SAAAA,MAAa,gBACtB,OAAS,WAAAC,MAAe,YAExBA,EACG,KAAK,oBAAoB,EACzB,YAAY,kDAAkD,EAC9D,mBAAmB,EAAI,EACvB,UAAU,WAAW,EACrB,OAAQC,GAAmB,CAC1BF,EACE,MACA,CAAC,KAAM,kBAAmB,OAAQ,GAAGE,CAAI,EACzC,CAAE,MAAO,SAAU,CACrB,EAAE,GAAG,OAAQC,GAAQ,QAAQ,KAAKA,GAAQ,CAAC,CAAC,CAC9C,CAAC,EAEHF,EAAQ,MAAM,QAAQ,IAAI",
6
- "names": ["spawn", "program", "args", "code"]
4
+ "sourcesContent": ["import { program } from 'commander'\nimport { spawner } from '@design-edito/tools/node/process/spawner/index.js'\nimport { promptContinue } from '@design-edito/tools/node/process/prompt-continue/index.js'\n\nprogram\n .name('@design-edito/push')\n .description('Shorthand for git push with arguments forwarding')\n .allowUnknownOption(true)\n .argument('<remote>', 'name of the remote source')\n .argument('<branch>', 'name of the branch')\n .argument('[message]', 'message of the commit')\n .argument('[files]', 'files to add')\n .argument('[rest...]', 'rest of the arguments')\n .option('-p, --pull', 'pull before pushing')\n .action(async (\n remote: string,\n branch: string,\n message: string | undefined,\n files: string | undefined,\n rest: string[] | undefined,\n options: { pull?: boolean },\n ) => {\n if (options.pull) {\n const pullRes = await spawner(\n `Pulling from ${remote}/${branch}...`,\n 'git',\n ['pull', remote, branch]\n )\n if (!pullRes.success) throw process.exit(1)\n }\n if (files !== undefined) {\n const addRes = await spawner(\n 'Adding to stage...',\n 'git',\n ['add', files]\n )\n if (!addRes.success) throw process.exit(1)\n }\n if (message !== undefined) {\n const commitRes = await spawner(\n `Commiting with message \"${message}\"...`,\n 'git',\n ['commit', '-m', message]\n )\n if (!commitRes.success) throw process.exit(1)\n }\n await promptContinue('Push now?', true)\n const pushRes = await spawner(\n `Pushing to ${remote}/${branch}`,\n 'git',\n ['push', remote, branch, ...rest ?? []]\n )\n if (!pushRes.success) throw process.exit(1)\n })\n\nprogram.parse(process.argv)\n"],
5
+ "mappings": "AAAA,OAAS,WAAAA,MAAe,YACxB,OAAS,WAAAC,MAAe,oDACxB,OAAS,kBAAAC,MAAsB,4DAE/BF,EACG,KAAK,oBAAoB,EACzB,YAAY,kDAAkD,EAC9D,mBAAmB,EAAI,EACvB,SAAS,WAAY,2BAA2B,EAChD,SAAS,WAAY,oBAAoB,EACzC,SAAS,YAAa,uBAAuB,EAC7C,SAAS,UAAW,cAAc,EAClC,SAAS,YAAa,uBAAuB,EAC7C,OAAO,aAAc,qBAAqB,EAC1C,OAAO,MACNG,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CA+BH,GA9BIA,EAAQ,MAMN,EALY,MAAMP,EACpB,gBAAgBE,CAAM,IAAIC,CAAM,MAChC,MACA,CAAC,OAAQD,EAAQC,CAAM,CACzB,GACa,SAEXE,IAAU,QAMR,EALW,MAAML,EACnB,qBACA,MACA,CAAC,MAAOK,CAAK,CACf,GACY,SAEVD,IAAY,QAMV,EALc,MAAMJ,EACtB,2BAA2BI,CAAO,OAClC,MACA,CAAC,SAAU,KAAMA,CAAO,CAC1B,GACe,UAEjB,MAAMH,EAAe,YAAa,EAAI,EAMlC,EALY,MAAMD,EACpB,cAAcE,CAAM,IAAIC,CAAM,GAC9B,MACA,CAAC,OAAQD,EAAQC,EAAQ,GAAGG,GAAQ,CAAC,CAAC,CACxC,GACa,SAAS,MAAM,QAAQ,KAAK,CAAC,CAC5C,CAAC,EAEHP,EAAQ,MAAM,QAAQ,IAAI",
6
+ "names": ["program", "spawner", "promptContinue", "remote", "branch", "message", "files", "rest", "options"]
7
7
  }
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ # write the program here
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{spawn as m}from"node:child_process";import r from"node:path";import t from"node:url";import{program as o}from"commander";var a=t.fileURLToPath(import.meta.url),n=r.dirname(a);o.name("@design-edito/record").description("simple command for recording audio").argument("<some-arg>","Some argument").action(i=>{m("sh",[r.join(n,"assets/main.sh"),i],{stdio:"inherit"}).on("exit",e=>process.exit(e??0))});o.parse(process.argv);
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/record/index.ts"],
4
+ "sourcesContent": ["import { spawn } from 'node:child_process'\nimport path from 'node:path'\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('@design-edito/record')\n .description('simple command for recording audio')\n .argument('<some-arg>', 'Some argument')\n .action((someArg: string) => {\n spawn(\n 'sh',\n [path.join(__dirname, 'assets/main.sh'), someArg],\n { stdio: 'inherit' }\n ).on('exit', code => process.exit(code ?? 0))\n })\n\nprogram.parse(process.argv)\n"],
5
+ "mappings": "AAAA,OAAS,SAAAA,MAAa,qBACtB,OAAOC,MAAU,YACjB,OAAOC,MAAS,WAChB,OAAS,WAAAC,MAAe,YAExB,IAAMC,EAAaF,EAAI,cAAc,YAAY,GAAG,EAC9CG,EAAYJ,EAAK,QAAQG,CAAU,EAEzCD,EACG,KAAK,sBAAsB,EAC3B,YAAY,oCAAoC,EAChD,SAAS,aAAc,eAAe,EACtC,OAAQG,GAAoB,CAC3BN,EACE,KACA,CAACC,EAAK,KAAKI,EAAW,gBAAgB,EAAGC,CAAO,EAChD,CAAE,MAAO,SAAU,CACrB,EAAE,GAAG,OAAQC,GAAQ,QAAQ,KAAKA,GAAQ,CAAC,CAAC,CAC9C,CAAC,EAEHJ,EAAQ,MAAM,QAAQ,IAAI",
6
+ "names": ["spawn", "path", "url", "program", "__filename", "__dirname", "someArg", "code"]
7
+ }
package/tree/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{program as b}from"commander";import{isInDirectory as f}from"@design-edito/tools/node/files/is-in-directory/index.js";import{Subpaths as w}from"@design-edito/tools/node/files/subpaths/index.js";var h=process.cwd();b.name("@design-edito/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=y(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 y(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((x,k)=>r[k]===!0?" ":"\u2502 ").join("");console.log(`${v}${a} ${t}`),g(p,d+1,[...r,l])})}
2
+ import{program as b}from"commander";import{isInDirectory as f}from"@design-edito/tools/node/files/is-in-directory/index.js";import*as g from"@design-edito/tools/node/files/subpaths/index.js";var h=process.cwd();b.name("@design-edito/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(t,e)=>{let r=t!==void 0?parseInt(t):0;if(Number.isNaN(r))return console.error("Depth should be a number"),process.exit(1);let s=(await g.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=y(l),c={value:l,level:a,children:[]};u.filter(n=>n.level===a-1&&f(l,n.value)).forEach(n=>n.children.push(c));let p=u.filter(n=>n.level===a+1&&f(n.value,l));return c.children.push(...p),[...u,c]},[]);console.log(h),v(s)});b.parse(process.argv);function i(t){let e=`${t}`.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}function m(t){if(typeof t!="string")return;let e=/^\/(.+)\/([a-z]*)$/,r=t.match(e);if(r===null)return;let[,o,s]=r;return new RegExp(o,s)}function y(t){return t.split("/").length-1}function v(t,e=0,r=[]){t.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,n=c.split("/").slice(d).join("/"),k=new Array(d).fill(null).map((x,w)=>r[w]===!0?" ":"\u2502 ").join("");console.log(`${k}${a} ${n}`),v(p,d+1,[...r,l])})}
3
3
  //# sourceMappingURL=index.js.map
package/tree/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tree/index.ts"],
4
- "sourcesContent": ["import { program } from 'commander'\nimport { isInDirectory } from '@design-edito/tools/node/files/is-in-directory/index.js'\nimport { Subpaths } from '@design-edito/tools/node/files/subpaths/index.js'\n\nconst CWD = process.cwd()\n\ntype SubpathData = {\n value: string\n level: number\n children: SubpathData[]\n}\n\nprogram\n .name('@design-edito/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,0DAC9B,OAAS,YAAAC,MAAgB,mDAEzB,IAAMC,EAAM,QAAQ,IAAI,EAQxBH,EACG,KAAK,oBAAoB,EACzB,YAAY,kDAAkD,EAC9D,SAAS,UAAW,iCAAiC,EACrD,OAAO,qBAAsB,gBAAiBI,EA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iBV,CAAY,CAC/B,CAAC,EAEHR,EAAQ,MAAM,QAAQ,IAAI,EAE1B,SAASI,EAAce,EAAc,CACnC,IAAMC,EAAS,GAAGD,CAAG,GAAG,KAAK,EAAE,YAAY,EAC3C,GAAIC,IAAW,OAAQ,MAAO,GAC9B,GAAIA,IAAW,QAAS,MAAO,EAEjC,CAEA,SAASX,EAAYY,EAAoB,CACvC,GAAI,OAAOA,GAAc,SAAU,OACnC,IAAMC,EAAoB,qBACpBC,EAAeF,EAAU,MAAMC,CAAiB,EACtD,GAAIC,IAAiB,KAAM,OAC3B,GAAM,CAAC,CAAEC,EAASC,CAAK,EAAIF,EAC3B,OAAO,IAAI,OAAOC,EAAUC,CAAM,CACpC,CAEA,SAASZ,EAAUa,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",
4
+ "sourcesContent": ["import { program } from 'commander'\nimport { isInDirectory } from '@design-edito/tools/node/files/is-in-directory/index.js'\nimport * as Subpaths from '@design-edito/tools/node/files/subpaths/index.js'\n\nconst CWD = process.cwd()\n\ntype SubpathData = {\n value: string\n level: number\n children: SubpathData[]\n}\n\nprogram\n .name('@design-edito/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,0DAC9B,UAAYC,MAAc,mDAE1B,IAAMC,EAAM,QAAQ,IAAI,EAQxBH,EACG,KAAK,oBAAoB,EACzB,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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AAMC,EAAoB,qBACpBC,EAAeF,EAAU,MAAMC,CAAiB,EACtD,GAAIC,IAAiB,KAAM,OAC3B,GAAM,CAAC,CAAEC,EAASC,CAAK,EAAIF,EAC3B,OAAO,IAAI,OAAOC,EAAUC,CAAM,CACpC,CAEA,SAASZ,EAAUa,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
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
7
  }