Skip to content

Commit 9df66ef

Browse files
committed
v0.1: fix: Prettier Configuration + Webview Splitting
1 parent 255af98 commit 9df66ef

23 files changed

Lines changed: 1302 additions & 1020 deletions

.prettierignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
dist
3+
out
4+
coverage
5+
*.log
6+
.vscode-test
7+
.DS_Store
8+
package-lock.json
9+
package.json
10+
tsconfig.json
11+
.vscode/*

.prettierrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"printWidth": 100,
4+
"tabWidth": 4,
5+
"useTabs": false,
6+
"semi": true,
7+
"singleQuote": true,
8+
"trailingComma": "all",
9+
"bracketSpacing": true,
10+
"arrowParens": "always",
11+
"endOfLine": "lf"
12+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
# Change Log
22

33
## [0.1.0] - 2025-09-16
4+
45
### Added
6+
57
- Webview preview with live validation and non-selectable line numbers gutter
68
- Replace/Skip/Cancel prompt when target items already exist (uses Trash for Replace)
79
- Support for JSON file leaves as string file types (e.g., "route": "ts")
810
- Safer, remote-ready filesystem via `vscode.workspace.fs`
911
- Tree symbol constants for consistent, readable Unicode output (├──, └──, │)
1012

1113
### Changed
14+
1215
- Plain Text parser is now strict: requires connectors, enforces single root directory, consistent indentation, and ignores the first line as header
1316
- Plain Text creation asks confirmation before proceeding if input is invalid
1417
- Formatter outputs readable tree; JSON output reflects new file-leaf format
1518
- Webview UI modernized (two-column layout, status badge, copy preview, clear input)
1619

1720
### Fixed
21+
1822
- Various encoding issues in tree drawing by using Unicode consistently
1923
- Type-safe configuration access and better error handling
2024

2125
### Previous Versions
26+
2227
- v0.2 Added Banner and Extension Icon
2328
- v0.3 Added Major Support `Create Folder Structure`
2429
- v0.4 Added Feature `Copy File Name`

README.md

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,108 +13,122 @@
1313
</p>
1414

1515
## Table of Contents
16+
1617
- [Features](#features)
1718
- [Quick Start](#quick-start)
1819
- [Detailed Usage](#detailed-usage)
19-
- [Copy Folder Structure](#copy-folder-structure)
20-
- [Create Folder Structure](#create-folder-structure)
21-
- [Copy File Name](#copy-file-name)
20+
- [Copy Folder Structure](#copy-folder-structure)
21+
- [Create Folder Structure](#create-folder-structure)
22+
- [Copy File Name](#copy-file-name)
2223
- [Settings](#settings)
2324
- [Preview](#preview)
24-
- [Setting](#settings-1)
25-
- [Context Menu](#context-menu)
26-
- [Copy File Name](#copy-file-name-2)
27-
- [Create Folder Structure](#create-folder-structure-2)
28-
- [Common Usage](#common-usage)
29-
- [With Git Ingest](#with-git-ingest)
25+
- [Setting](#settings-1)
26+
- [Context Menu](#context-menu)
27+
- [Copy File Name](#copy-file-name-2)
28+
- [Create Folder Structure](#create-folder-structure-2)
29+
- [Common Usage](#common-usage)
30+
- [With Git Ingest](#with-git-ingest)
3031
- [Copy Folder Structure Output](#copy-folder-structure-output)
3132
- [How It Works](#how-it-works)
3233
- [Troubleshooting](#troubleshooting)
3334
- [License](#license)
3435
- [Contact](#contact)
3536

3637
## Features
38+
3739
- Copy Folder Structure
38-
- Two output formats:
39-
- Plain Text (GitIngest-style tree)
40-
- JSON
41-
- Context menu integration
42-
- Respects .gitignore
40+
- Two output formats:
41+
- Plain Text (GitIngest-style tree)
42+
- JSON
43+
- Context menu integration
44+
- Respects .gitignore
4345

4446
- Create Folder Structure
45-
- JSON and Plain Text inputs
46-
- Modern UI with live preview, validation, and line numbers
47-
- Replace/Skip existing items prompt (Replace sends to Trash)
47+
- JSON and Plain Text inputs
48+
- Modern UI with live preview, validation, and line numbers
49+
- Replace/Skip existing items prompt (Replace sends to Trash)
4850

4951
- Copy File Name
50-
- Quick file name copying to clipboard
52+
- Quick file name copying to clipboard
5153

5254
## Quick Start
55+
5356
1. Install the extension
5457
2. Right-click any folder in Explorer
5558
3. Choose "Copy Folder Structure" or "Create Folder Structure"
5659

5760
## Detailed Usage
5861

5962
### Copy Folder Structure
63+
6064
1. Right-click a folder in Explorer
6165
2. Select Copy Folder Structure
6266
3. Structure is copied in your preferred format (JSON/Plain Text)
6367

6468
### Create Folder Structure
69+
6570
1. Right-click in Explorer or use Command Palette
6671
2. Choose Create Folder Structure
6772
3. Select the target directory
6873
4. Select format and paste structure
6974
5. Click Create
7075

7176
### Copy File Name
77+
7278
- Right-click any file → Copy File Name
7379

7480
## Settings
81+
7582
- outputFormat: JSON Format | Plain Text Format
7683
- ignorePatterns: patterns to ignore when copying
7784
- respectGitignore: whether to honor .gitignore
7885

7986
## Preview
8087

8188
### Settings
89+
8290
<img src="./assets/cfs_settings.webp" alt="Settings" style="height: 250px; border: 4px solid rgba(255, 255, 255, 0.9); border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
8391

8492
### Context Menu
93+
8594
<img src="./assets/cfs_explorer_context.webp" alt="Explorer Context" style="height: 300px; border: 4px solid rgba(255, 255, 255, 0.9); border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
8695

8796
### Copy File Name
97+
8898
<img src="./assets/copy_file_name.gif" alt="Copy File Name Example" style="height: 300px; border: 4px solid rgba(255, 255, 255, 0.9); border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
8999

90100
### Create Folder Structure
91101

92102
#### Common Usage
103+
93104
<img src="./assets/common_usage.gif" alt="Common Usage" style="width: 100%; border: 4px solid rgba(255, 255, 255, 0.9); border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
94105

95106
#### With Git Ingest
107+
96108
<img src="./assets/usage_with_gitIngest.gif" alt="Usage With Git Ingest" style="width: 100%; border: 4px solid rgba(255, 255, 255, 0.9); border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
97109

98110
## Copy Folder Structure Output
99111

100112
- JSON (files as type strings):
113+
101114
```json
102115
{
103-
"app": {
104-
"api": {
105-
"analyze-typography": {
106-
"route": "ts"
107-
}
108-
},
109-
"favicon": "ico",
110-
"globals": "css",
111-
"layout": "tsx",
112-
"page": "tsx"
113-
}
116+
"app": {
117+
"api": {
118+
"analyze-typography": {
119+
"route": "ts"
120+
}
121+
},
122+
"favicon": "ico",
123+
"globals": "css",
124+
"layout": "tsx",
125+
"page": "tsx"
126+
}
114127
}
115128
```
116129

117130
- Plain Text (GitIngest-style, human-friendly):
131+
118132
```
119133
Directory structure:
120134
└── app/
@@ -128,39 +142,46 @@ Directory structure:
128142
```
129143

130144
Plain Text rules:
145+
131146
- First line is ignored as a header (may contain any text)
132147
- Every line must use connectors (├── or └──; ASCII |-- or `-- also supported)
133148
- Exactly one root directory (level 0) and it must end with `/`
134149
- Indentation must increase by exactly one level
135150
- The UI shows invalid line numbers; if invalid, Create asks for confirmation before proceeding
136151

137152
## How It Works
153+
138154
### Copy Folder Structure
155+
139156
1. Scans the folder while respecting .gitignore
140157
2. Excludes node_modules and hidden files by default
141158
3. Copies in the selected format:
142-
- JSON: hierarchical object; files are type strings (e.g., "index": "ts")
143-
- Plain Text: GitIngest-style tree
159+
- JSON: hierarchical object; files are type strings (e.g., "index": "ts")
160+
- Plain Text: GitIngest-style tree
144161

145162
### Create Folder Structure
163+
146164
1. Reads input from the webview
147165
2. Validates and parses (JSON or Plain Text)
148166
3. Prompts to Replace/Skip if target items exist; Replace sends to Trash
149167
4. Generates folders and files (no overwrite by default)
150168

151169
### Copy File Name
170+
152171
1. Right-click a file in Explorer
153172
2. Copies the file name to clipboard
154173

155174
## Troubleshooting
175+
156176
- No Option in Context Menu: Reload VS Code (Ctrl+Shift+P → Reload Window)
157177
- Clipboard Not Working: Check system permissions
158178
- Input Error (Create): Ensure input follows JSON or Plain Text format
159179
- Copy File Name Not Working: Ensure a valid local file is selected
160180

161181
## License
182+
162183
MIT — see [LICENSE](./LICENSE)
163184

164185
## Contact
165-
Open an issue on the [GitHub repository](https://github.com/ShreyPurohit/folder-structure-pro-vscode/issues)
166186

187+
Open an issue on the [GitHub repository](https://github.com/ShreyPurohit/folder-structure-pro-vscode/issues)

esbuild.js

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const esbuild = require("esbuild");
1+
const esbuild = require('esbuild');
22

33
const production = process.argv.includes('--production');
44
const watch = process.argv.includes('--watch');
@@ -7,50 +7,48 @@ const watch = process.argv.includes('--watch');
77
* @type {import('esbuild').Plugin}
88
*/
99
const esbuildProblemMatcherPlugin = {
10-
name: 'esbuild-problem-matcher',
10+
name: 'esbuild-problem-matcher',
1111

12-
setup(build) {
13-
build.onStart(() => {
14-
console.log('[watch] build started');
15-
});
16-
build.onEnd((result) => {
17-
result.errors.forEach(({ text, location }) => {
18-
console.error(`✘ [ERROR] ${text}`);
19-
console.error(` ${location.file}:${location.line}:${location.column}:`);
20-
});
21-
console.log('[watch] build finished');
22-
});
23-
},
12+
setup(build) {
13+
build.onStart(() => {
14+
console.log('[watch] build started');
15+
});
16+
build.onEnd((result) => {
17+
result.errors.forEach(({ text, location }) => {
18+
console.error(`✘ [ERROR] ${text}`);
19+
console.error(` ${location.file}:${location.line}:${location.column}:`);
20+
});
21+
console.log('[watch] build finished');
22+
});
23+
},
2424
};
2525

2626
async function main() {
27-
const ctx = await esbuild.context({
28-
entryPoints: [
29-
'src/extension.ts'
30-
],
31-
bundle: true,
32-
format: 'cjs',
33-
minify: production,
34-
sourcemap: !production,
35-
sourcesContent: false,
36-
platform: 'node',
37-
outfile: 'dist/extension.js',
38-
external: ['vscode'],
39-
logLevel: 'silent',
40-
plugins: [
41-
/* add to the end of plugins array */
42-
esbuildProblemMatcherPlugin,
43-
],
44-
});
45-
if (watch) {
46-
await ctx.watch();
47-
} else {
48-
await ctx.rebuild();
49-
await ctx.dispose();
50-
}
27+
const ctx = await esbuild.context({
28+
entryPoints: ['src/extension.ts'],
29+
bundle: true,
30+
format: 'cjs',
31+
minify: production,
32+
sourcemap: !production,
33+
sourcesContent: false,
34+
platform: 'node',
35+
outfile: 'dist/extension.js',
36+
external: ['vscode'],
37+
logLevel: 'silent',
38+
plugins: [
39+
/* add to the end of plugins array */
40+
esbuildProblemMatcherPlugin,
41+
],
42+
});
43+
if (watch) {
44+
await ctx.watch();
45+
} else {
46+
await ctx.rebuild();
47+
await ctx.dispose();
48+
}
5149
}
5250

53-
main().catch(e => {
54-
console.error(e);
55-
process.exit(1);
51+
main().catch((e) => {
52+
console.error(e);
53+
process.exit(1);
5654
});

0 commit comments

Comments
 (0)