copy-no-nm 0.26.8 → 0.26.23

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/README.md CHANGED
@@ -1,9 +1,38 @@
1
1
  # copy-no-nm
2
2
 
3
- Recursively copy a directory to another location while skipping every `node_modules` folder. The copy preserves file creation times, modification times, access times, and attributes. Before copying, everything already in the destination folder is sent to the Windows Recycle Bin.
3
+ Recursively copy a directory to another location while skipping every `node_modules` folder. By default the tool **synchronizes** the destination with the source (copies only new or changed files and removes extras). Use `-f` / `--full` for a full copy that clears the destination via the Recycle Bin first. File metadata (creation time, modification time, access time, attributes) is preserved on copied items.
4
4
 
5
5
  Built with Go. Distributed on npm with a small Node.js launcher.
6
6
 
7
+ - **Repository:** [github.com/maxzz/to-copy-no-nm-cli](https://github.com/maxzz/to-copy-no-nm-cli)
8
+ - **npm package:** [npmjs.com/package/copy-no-nm](https://www.npmjs.com/package/copy-no-nm)
9
+
10
+ Install from npm:
11
+
12
+ ```bash
13
+ npm install -g copy-no-nm
14
+ # or
15
+ pnpm add -g copy-no-nm
16
+ ```
17
+
18
+ ## Contents
19
+
20
+ - [Requirements](#requirements)
21
+ - [Usage](#usage)
22
+ - [Paths](#paths)
23
+ - [Options](#options)
24
+ - [Process overview](#process-overview)
25
+ - [Sync mode (default)](#sync-mode-default)
26
+ - [Full copy mode (`-f`, `--full`)](#full-copy-mode-f---full)
27
+ - [Check mode (`-c`, `--check`)](#check-mode-c---check)
28
+ - [Console output](#console-output)
29
+ - [Development](#development)
30
+ - [Debugging](#debugging)
31
+ - [Windows shortcut](#windows-shortcut)
32
+ - [npm scripts](#npm-scripts)
33
+ - [Publishing to npm](#publishing-to-npm)
34
+ - [License](#license)
35
+
7
36
  ## Requirements
8
37
 
9
38
  - Windows (Recycle Bin integration and metadata preservation use Windows APIs)
@@ -13,7 +42,7 @@ Built with Go. Distributed on npm with a small Node.js launcher.
13
42
  ## Usage
14
43
 
15
44
  ```bash
16
- copy-no-nm <source> <destination>
45
+ copy-no-nm [options] <source> <destination>
17
46
  ```
18
47
 
19
48
  Example:
@@ -22,20 +51,107 @@ Example:
22
51
  copy-no-nm "C:\projects\my-app" "D:\backups\my-app"
23
52
  ```
24
53
 
25
- ### Behavior
54
+ On start the program prints its name, a short description, and the version (for example `copy-no-nm — Copy a folder… (version 0.26.2)`).
55
+
56
+ ## Paths
57
+
58
+ | Path | Rule |
59
+ |------|------|
60
+ | `<source>` | Must exist and be a directory (second argument when `-r` / `--reverse` is on) |
61
+ | `<destination>` | Created automatically if it does not exist (including parent folders); if it already exists, it must be a directory. With `-c` / `--check`, the destination must already exist. First argument when `-r` / `--reverse` is on. |
62
+
63
+ By default arguments are `<source> <destination>`. With `-r` / `--reverse`, pass `<destination> <source>` instead.
64
+
65
+ Source and destination must be different paths and cannot contain each other.
66
+
67
+ ## Options
68
+
69
+ | Flag | Default | Description |
70
+ |------|---------|-------------|
71
+ | `-f`, `--full` | **off** | Full copy: clear the destination via Recycle Bin, then copy every file |
72
+ | `-r`, `--reverse` | **off** | Treat the first argument as destination and the second as source |
73
+ | `-c`, `--check` | **off** | Verify source and destination match (file size and modification time); excludes `node_modules` and `.git`; does not clear or copy |
74
+ | `-g`, `--copy-git` | **off** | Copy the `.git` folder from the **source root** and clear the destination `.git` folder |
75
+
76
+ `node_modules` is never modified in the destination and is always skipped during the copy. This is intentional — `node_modules` should be recreated by your package manager (especially with pnpm, which uses links inside that folder).
77
+
78
+ Examples:
79
+
80
+ ```bash
81
+ # Default: keep destination node_modules and .git; skip copying source .git
82
+ copy-no-nm "C:\projects\my-app" "D:\backups\my-app"
83
+
84
+ # Destination folder does not exist yet — it will be created
85
+ copy-no-nm "C:\projects\my-app" "D:\backups\new-folder"
86
+
87
+ # Also sync the root .git folder
88
+ copy-no-nm -g "C:\projects\my-app" "D:\backups\my-app"
89
+
90
+ # Full copy: clear destination then copy everything
91
+ copy-no-nm -f "C:\projects\my-app" "D:\backups\my-app"
92
+
93
+ # Verify source and destination match (no changes made)
94
+ copy-no-nm -c "C:\projects\my-app" "D:\backups\my-app"
95
+
96
+ # Reverse argument order: destination first, source second
97
+ copy-no-nm -r "D:\backups\my-app" "C:\projects\my-app"
98
+ ```
99
+
100
+ Run without arguments (or with `-h`) to see in-program help: usage syntax, options with default values, and wrapped descriptions (~80 columns).
101
+
102
+ ## Process overview
26
103
 
27
- 1. Existing destination contents are cleared to the Recycle Bin using selective rules (`node_modules` folders are kept by default).
28
- 2. `<source>` is copied recursively into `<destination>`.
29
- 3. Any directory named `node_modules` is skipped during the copy.
30
- 4. File creation dates, timestamps, and attributes are preserved.
31
- 5. On error: Inspector Gadget is shown in red, then the app waits for a key press before closing.
32
- 6. On success: Inspector Gadget is shown in green for 1.5 seconds, then the app closes.
104
+ ### Sync mode (default)
33
105
 
34
- ### Clearing the destination
106
+ Synchronizes the destination with the source using **file size** and **modification time**:
35
107
 
36
- By default, `node_modules` folders in the destination are **not** deleted. Other subfolders are removed as a whole unless they contain a nested `node_modules` folder; in that case the same rules are applied inside that subfolder.
108
+ - Copies files that are new in the source or differ from the destination
109
+ - Removes files present in the destination but absent from the source (via Recycle Bin)
110
+ - Skips unchanged files
111
+ - Preserves `node_modules` folders in the destination (never scanned, deleted, or compared)
112
+ - Skips the root `.git` folder unless `-g` / `--copy-git` is on (same rules as copy)
37
113
 
38
- Use `--remove-node-modules` to also send `node_modules` folders (including nested ones) to the Recycle Bin.
114
+ ### Full copy mode (`-f`, `--full`)
115
+
116
+ Each run performs two steps: **clear destination**, then **copy from source**.
117
+
118
+ #### Step 1 — Clear destination
119
+
120
+ | Item in destination | Default (`-g` off) | With `-g` |
121
+ |---------------------|--------------------|-----------|
122
+ | Files at any level | Recycle Bin | Recycle Bin |
123
+ | `node_modules` folders | **Always kept** (contents not scanned) | **Always kept** (contents not scanned) |
124
+ | Root `.git` folder | **Kept** | Recycle Bin |
125
+ | Other subfolders without nested `node_modules` | Recycle Bin (whole folder) | Recycle Bin (whole folder) |
126
+ | Subfolders containing nested `node_modules` | Cleared recursively with same rules | Cleared recursively with same rules |
127
+
128
+ `node_modules` folders in the destination are never deleted or inspected.
129
+
130
+ #### Step 2 — Copy from source
131
+
132
+ | Item in source | Default (`-g` off) | With `-g` |
133
+ |----------------|--------------------|-----------|
134
+ | All files and folders | Copied | Copied |
135
+ | `node_modules` folders (anywhere) | **Skipped** | **Skipped** |
136
+ | Root `.git` folder | **Skipped** | Copied |
137
+
138
+ File creation dates, timestamps, and attributes are preserved on copied items (including read-only files such as git objects).
139
+
140
+ ### Check mode (`-c`, `--check`)
141
+
142
+ Compares every file under source and destination using **file size** and **modification time**. Folders named `node_modules` or `.git` are ignored at any depth. The destination must already exist. Nothing is cleared or copied.
143
+
144
+ Reports the first mismatch (missing, extra, or different file) or prints a green summary when all compared files match.
145
+
146
+ ### Console output
147
+
148
+ | Situation | Behaviour |
149
+ |-----------|-----------|
150
+ | Missing or invalid arguments | Yellow help text with syntax, options, and defaults; press any key to close |
151
+ | Check failed | Inspector Gadget in red, error message, press any key to close |
152
+ | Check passed | Green summary with file count, then the app closes |
153
+ | Runtime error | Inspector Gadget in red, error message, press any key to close |
154
+ | Copy or sync success | Inspector Gadget in green for 1.5 seconds, then the app closes |
39
155
 
40
156
  ## Development
41
157
 
@@ -45,7 +161,12 @@ Install dependencies (no runtime npm packages; pnpm is used for scripts only):
45
161
  pnpm install
46
162
  ```
47
163
 
48
- Build the Windows executable (generates `assets/icon.ico` from `assets/icon-source.png`, embeds it via `goversioninfo`, then compiles):
164
+ Build the Windows executable. The build script:
165
+
166
+ - Generates `assets/icon.ico` from `assets/icon-source.png` (only if the `.ico` file is not already present)
167
+ - Bumps the patch version in `package.json` and syncs `versioninfo.json`
168
+ - Embeds the icon and version metadata via `goversioninfo`
169
+ - Compiles `dist/copy-no-nm.exe`
49
170
 
50
171
  ```bash
51
172
  pnpm run build
@@ -64,16 +185,38 @@ pnpm link --global
64
185
  copy-no-nm <source> <destination>
65
186
  ```
66
187
 
188
+ ### Debugging
189
+
190
+ Install the [Go extension](https://marketplace.visualstudio.com/items?itemName=golang.go) and [Delve](https://github.com/go-delve/delve):
191
+
192
+ ```powershell
193
+ go install github.com/go-delve/delve/cmd/dlv@latest
194
+ ```
195
+
196
+ Use `.vscode/launch.json` for ready-made configurations (F5 in Cursor/VS Code). Debug builds use `version dev` unless you set `-ldflags` manually.
197
+
198
+ ### Windows shortcut
199
+
200
+ Create a shortcut and set **Target** to run the executable with preset arguments, for example:
201
+
202
+ ```
203
+ C:\y\w\2-web\0-dp\utils\to-copy-no-nm-cli\dist\copy-no-nm.exe "C:\y\w\2-web\0-dp\utils\pmac" "C:\Users\maxzz\Desktop\pmac"
204
+ ```
205
+
206
+ Double-clicking the shortcut runs the copy with those paths.
207
+
67
208
  ## npm scripts
68
209
 
69
210
  | Script | Description |
70
211
  |--------|-------------|
71
- | `pnpm run build` | Generate icon, embed Windows resources, build `dist/copy-no-nm.exe` |
212
+ | `pnpm run build` | Bump version, generate icon (if needed), embed Windows resources, build `dist/copy-no-nm.exe` |
72
213
  | `pnpm run prepublishOnly` | Build before publish (runs automatically on `npm publish`) |
73
214
  | `pnpm run publish:npm` | Publish to npm (`--access public`) |
74
215
 
75
216
  ## Publishing to npm
76
217
 
218
+ Published as [`copy-no-nm`](https://www.npmjs.com/package/copy-no-nm). Source code: [maxzz/to-copy-no-nm-cli](https://github.com/maxzz/to-copy-no-nm-cli).
219
+
77
220
  This package ships a prebuilt Windows binary in `dist/` plus a Node launcher in `bin/copy-no-nm.js`.
78
221
 
79
222
  ```bash
@@ -81,9 +224,7 @@ pnpm run build
81
224
  pnpm run publish:npm
82
225
  ```
83
226
 
84
- For cross-platform npm installs, consider splitting platform-specific binaries into separate packages listed under `optionalDependencies`.
85
-
86
- Replace the temporary icon by editing `assets/icon-source.png`, then run `pnpm run build` again.
227
+ Replace the icon by editing `assets/icon-source.png`, then run `pnpm run build` again.
87
228
 
88
229
  ## License
89
230
 
Binary file
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "copy-no-nm",
3
- "version": "0.26.8",
3
+ "version": "0.26.23",
4
4
  "description": "Copy from one folder to another without the nested node_modules folder",
5
5
  "author": "Max Zakharzhevskyi",
6
6
  "license": "MIT",
7
+ "homepage": "https://github.com/maxzz/to-copy-no-nm-cli#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/maxzz/to-copy-no-nm-cli.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/maxzz/to-copy-no-nm-cli/issues"
14
+ },
7
15
  "keywords": [
8
16
  "copy",
9
17
  "node_modules",