@design-edito/cli 0.1.3 → 0.1.7
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/list.txt +1 -0
- package/cli/assets/version.txt +1 -1
- package/make-template/assets/express/package.json +2 -2
- package/make-template/assets/express-api/package.json +5 -5
- package/make-template/assets/node-ts/esbuild.config.js +13 -0
- package/make-template/assets/node-ts/gitignore +214 -0
- package/make-template/assets/node-ts/package.json +18 -0
- package/make-template/assets/node-ts/src/index.ts +1 -0
- package/make-template/assets/node-ts/src/tsconfig.json +16 -0
- package/make-template/assets/react/package.json +3 -3
- package/make-template/index.js +3 -2
- package/make-template/index.js.map +3 -3
- package/package.json +10 -9
- package/record/assets/main.sh +3 -0
- package/record/index.js +3 -0
- package/record/index.js.map +7 -0
- package/tree/index.js +1 -1
- package/tree/index.js.map +2 -2
package/cli/assets/list.txt
CHANGED
package/cli/assets/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.7
|
|
@@ -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.
|
|
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": "^
|
|
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
|
|
29
|
-
"agenda": "^
|
|
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.
|
|
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": "^
|
|
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": "^
|
|
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
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"build:public": "cp -r public/* dist",
|
|
10
10
|
"build:src": "npm run build:scripts && node .scripts/build/index.js",
|
|
11
11
|
"build:src:preact": "PREACT=true npm run build:src",
|
|
12
|
-
"watch:public": "npx chokidar-cli 'public/**/*' -c 'npm run build:public'",
|
|
12
|
+
"watch:public": "npm run build:public && npx chokidar-cli 'public/**/*' -c 'npm run build:public'",
|
|
13
13
|
"watch:src": "WATCH=true npm run build:src",
|
|
14
14
|
"watch:src:preact": "PREACT=true npm run watch:src",
|
|
15
15
|
"make:dist": "mkdir -p dist",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "ISC",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@types/node": "^
|
|
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.
|
|
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",
|
package/make-template/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
`},{encoding:"utf-8"});let
|
|
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\
|
|
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,
|
|
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,EACC,QAAQ,OAAO,EACf,YAAY,2CAA2C,EACvD,OAAOU,CAAS,EAEnBV,EAAQ,MAAMN,EAAQ,IAAI,EAO1B,eAAee,GAAY,CACzB,IAAME,EAAmBb,EAAK,KAAKM,EAAW,aAAa,EAC3D,GAAI,CAACR,EAAWe,CAAgB,EAC9B,eAAQ,MAAM,0CAA0CA,CAAgB,EAAE,EACnEjB,EAAQ,KAAK,CAAC,EAEvB,IAAMkB,EAAad,EAAK,KAAKO,EAAK,eAAe,EACjD,MAAMV,EAAG,GAAGgB,EAAkBC,EAAY,CAAE,UAAW,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,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.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -15,26 +15,27 @@
|
|
|
15
15
|
"add": "./add/index.js",
|
|
16
16
|
"commit": "./commit/index.js",
|
|
17
17
|
"cli": "./cli/index.js",
|
|
18
|
-
"make-template": "./make-template/index.js",
|
|
19
18
|
"pull": "./pull/index.js",
|
|
19
|
+
"make-template": "./make-template/index.js",
|
|
20
20
|
"push": "./push/index.js",
|
|
21
|
+
"record": "./record/index.js",
|
|
21
22
|
"reset": "./reset/index.js",
|
|
22
|
-
"status": "./status/index.js",
|
|
23
23
|
"serve": "./serve/index.js",
|
|
24
|
-
"tree": "./tree/index.js"
|
|
24
|
+
"tree": "./tree/index.js",
|
|
25
|
+
"status": "./status/index.js"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@design-edito/tools": "^0.2
|
|
28
|
-
"commander": "^14.0.
|
|
28
|
+
"@design-edito/tools": "^0.3.2",
|
|
29
|
+
"commander": "^14.0.2",
|
|
29
30
|
"prompts": "^2.4.2"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^
|
|
33
|
+
"@types/node": "^25.0.10",
|
|
33
34
|
"@types/prompts": "^2.4.9",
|
|
34
35
|
"@types/semver": "^7.7.1",
|
|
35
|
-
"esbuild": "^0.
|
|
36
|
+
"esbuild": "^0.27.2",
|
|
36
37
|
"semver": "^7.7.3",
|
|
37
|
-
"simple-git": "^3.
|
|
38
|
+
"simple-git": "^3.30.0",
|
|
38
39
|
"typescript": "^5.9.3"
|
|
39
40
|
}
|
|
40
41
|
}
|
package/record/index.js
ADDED
|
@@ -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
|
|
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
|
|
5
|
-
"mappings": "AAAA,OAAS,WAAAA,MAAe,YACxB,OAAS,iBAAAC,MAAqB,0DAC9B,
|
|
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,0CAA0C,EAC5E,OAAO,MAAOC,EAAQC,IAAY,CACjC,IAAMC,EAAQF,IAAW,OAAY,SAASA,CAAM,EAAI,EACxD,GAAI,OAAO,MAAME,CAAK,EACpB,eAAQ,MAAM,0BAA0B,EACjC,QAAQ,KAAK,CAAC,EAcvB,IAAMC,GAZW,MAAe,OAAKL,EAAK,CACxC,SAAUI,EACV,MAAOD,EAAQ,MACf,OAAQA,EAAQ,OAChB,YAAaA,EAAQ,YACrB,SAAUA,EAAQ,SAClB,eAAgBA,EAAQ,OACxB,uBAAwBA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,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
|
}
|