torch-it 2.5.4 โ 2.6.1
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 +127 -184
- package/dist/torch-it.js +19 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,160 +3,67 @@
|
|
|
3
3
|
[](https://github.com/piyook/torch-it/releases)
|
|
4
4
|
[](https://github.com/piyook/torch-it/actions/workflows/tests.yaml)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.npmjs.com/package/torch-it)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
> **One command to nuke caches, dependencies, and Docker environments โ then rebuild from scratch.**
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Project stopped working for no obvious reason ๐ ?
|
|
12
|
-
|
|
13
|
-
You'd like to kick it ๐ฅพ?
|
|
14
|
-
Hit it with a hammer ๐จ?
|
|
15
|
-
Turn it off and on again ๐บ?
|
|
16
|
-
|
|
17
|
-
Well better still - try torching it ๐ฅ๐ฅ๐ฅ๐ฅ๐ฅ๐ฅ
|
|
18
|
-
|
|
19
|
-
## What does `torch-it` do?
|
|
20
|
-
|
|
21
|
-
Intelligently nukes your local caches, dependencies, and Docker environment depending on your framework and package manager โ then rebuilds everything from a clean slate, **with a single command**.
|
|
22
|
-
|
|
23
|
-
It's surprising how often this just fixes things. ๐ค
|
|
24
|
-
|
|
25
|
-
## Features
|
|
26
|
-
|
|
27
|
-
- **One command** to clean up 50+ build artifacts, cache directories, log files, and reinstall dependencies
|
|
28
|
-
- **Comprehensive framework support** โ handles React, Next.js, Vue, Vite, SvelteKit, Remix, Qwik, Nuxt, Astro, Angular, Solid, and 40+ more
|
|
29
|
-
- **Smart file pattern matching** โ removes `*.log`, `*.tgz`, `*.tar.gz`, and other temporary files automatically
|
|
30
|
-
- **Fully customizable** โ specify any directories or files to delete via `torchrc.json`
|
|
31
|
-
- **Docker support** โ removes containers, images, and volumes and rebuilds from scratch ๐ณ
|
|
32
|
-
- **Cross-platform** โ works on Windows, Linux, and macOS
|
|
33
|
-
- **Zero-dependency** โ lightweight and no additional packages required
|
|
10
|
+
Project stopped working for no obvious reason? `torch-it` cleans up 50+ build artifacts, cache directories, and temporary files, then reinstalls your dependencies fresh. It's surprising how often this just fixes things. ๐ค
|
|
34
11
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
React, Next.js, Vue, Vite, SvelteKit, React Native, Expo, Remix, Qwik, Nuxt, Astro, Angular, Solid, Docusaurus, and 40+ more frameworks and tools.
|
|
38
|
-
|
|
39
|
-
## Comprehensive Cleanup Targets
|
|
40
|
-
|
|
41
|
-
`torch-it` cleans up 50+ common build artifacts, cache directories, and temporary files:
|
|
42
|
-
|
|
43
|
-
### Framework Build Outputs
|
|
44
|
-
- `dist`, `build`, `out`, `.output` - Standard build directories
|
|
45
|
-
- `.next` - Next.js build cache
|
|
46
|
-
- `.nuxt` - Nuxt.js build output
|
|
47
|
-
- `.svelte-kit`, `.svelte` - Svelte/SvelteKit builds
|
|
48
|
-
- `.remix` - Remix framework build output
|
|
49
|
-
- `.qwik` - Qwik framework build output
|
|
50
|
-
- `.astro` - Astro framework build output
|
|
51
|
-
- `.angular`, `.angular/cache` - Angular build artifacts
|
|
52
|
-
- `.solid` - Solid.js build output
|
|
53
|
-
- `.docusaurus` - Docusaurus static site output
|
|
54
|
-
- `.nitro` - Nuxt Nitro server output
|
|
55
|
-
|
|
56
|
-
### Development Tool Caches
|
|
57
|
-
- `.cache`, `.parcel-cache`, `.webpack`, `.rollup.cache` - Build tool caches
|
|
58
|
-
- `.vite` - Vite build tool cache
|
|
59
|
-
- `.swc`, `.rpt2_cache` - JavaScript transpiler caches
|
|
60
|
-
- `.eslintcache`, `.stylelintcache`, `.sass-cache` - Linter/preprocessor caches
|
|
61
|
-
- `.babel-cache`, `.cache-loader` - Babel and webpack loader caches
|
|
62
|
-
|
|
63
|
-
### Package Manager Caches
|
|
64
|
-
- `node_modules/.cache` - npm package cache
|
|
65
|
-
- `.npm` - npm global cache
|
|
66
|
-
- `.pnpm-store`, `.pnpm-debug.log` - pnpm caches
|
|
67
|
-
- `.yarn/cache`, `.yarn/unplugged`, `.yarn/install-state.gz` - Yarn caches
|
|
12
|
+
---
|
|
68
13
|
|
|
69
|
-
|
|
70
|
-
- `.turbo` - Turborepo cache
|
|
71
|
-
- `.nx/cache` - Nx build system cache
|
|
72
|
-
- `.lerna` - Lerna monorepo cache
|
|
73
|
-
- `.rush` - Rush monorepo cache
|
|
74
|
-
- `.yalc` - Yalc local package manager
|
|
14
|
+
## Quick Start
|
|
75
15
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
-
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g torch-it # install globally (recommended)
|
|
18
|
+
cd your-project
|
|
19
|
+
torch-it # clean and rebuild
|
|
20
|
+
```
|
|
80
21
|
|
|
81
|
-
|
|
82
|
-
- `.vercel` - Vercel deployment cache
|
|
83
|
-
- `.netlify` - Netlify build cache
|
|
84
|
-
- `.wrangler` - Cloudflare Workers
|
|
85
|
-
- `.amplify` - AWS Amplify
|
|
86
|
-
- `.sst` - SST framework
|
|
87
|
-
- `.firebase` - Firebase hosting files
|
|
88
|
-
- `.serverless` - Serverless framework
|
|
22
|
+
`torch-it` will show you a preview of what it's about to delete and ask for confirmation before doing anything destructive.
|
|
89
23
|
|
|
90
|
-
|
|
91
|
-
- `android/.gradle`, `android/build`, `android/app/build` - Android builds
|
|
92
|
-
- `ios/Pods`, `ios/build` - iOS builds
|
|
93
|
-
- `.expo`, `.expo-shared` - Expo React Native
|
|
24
|
+
---
|
|
94
25
|
|
|
95
|
-
|
|
96
|
-
- `*.log` - All log files
|
|
97
|
-
- `*.tgz`, `*.tar.gz` - Compressed archives
|
|
98
|
-
- `tsconfig.tsbuildinfo` - TypeScript incremental build info
|
|
99
|
-
- `coverage`, `.nyc_output` - Test coverage reports
|
|
100
|
-
- `storybook-static`, `.storybook-out` - Storybook builds
|
|
26
|
+
## What It Does
|
|
101
27
|
|
|
102
|
-
###
|
|
103
|
-
- `.tmp`, `tmp`, `temp` - Temporary directories
|
|
104
|
-
- `lib`, `es`, `cjs`, `umd` - Compiled JavaScript outputs
|
|
105
|
-
- `jspm_packages`, `.typings` - Package manager files
|
|
28
|
+
### Always runs
|
|
106
29
|
|
|
107
|
-
|
|
30
|
+
1. Removes build artifacts and cache directories (50+ targets โ `node_modules`, `dist`, `.next`, `.cache`, `.vite`, etc.)
|
|
31
|
+
2. Removes log files and temporary files (`*.log`, `*.tgz`, `*.tar.gz`, etc.)
|
|
32
|
+
3. Removes any custom paths you define in `torchrc.json`
|
|
33
|
+
4. Cleans your package manager's cache (npm, yarn, or pnpm)
|
|
34
|
+
5. Reinstalls all dependencies
|
|
108
35
|
|
|
109
|
-
|
|
36
|
+
### Optionally runs (Docker mode)
|
|
110
37
|
|
|
111
|
-
|
|
38
|
+
When `dockerMode: true` and a `docker-compose.yml` or `Dockerfile` is present:
|
|
112
39
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
40
|
+
| Step | When | Command |
|
|
41
|
+
|------|------|---------|
|
|
42
|
+
| Teardown | Before cleanup | `docker compose down --rmi all --volumes` |
|
|
43
|
+
| Rebuild | After dependency install | `docker compose build --pull --no-cache` |
|
|
44
|
+
| Start | After successful rebuild | `docker compose up -d` |
|
|
118
45
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
If your project includes either a `Dockerfile`, `docker-compose.yml`, or `docker-compose.yaml`, `torch-it` will also:
|
|
122
|
-
|
|
123
|
-
- **Stop and clean up Docker resources** (containers, images, volumes) if Docker is running.
|
|
124
|
-
- **Rebuild Docker images** from scratch.
|
|
125
|
-
- **Restart Docker services** in detached mode.
|
|
126
|
-
|
|
127
|
-
`torch-it` intelligently detects your project's configuration and only performs Docker operations when appropriate.
|
|
46
|
+
> **Note:** All Docker operations use `docker compose` (plugin). Ensure Docker Compose plugin is installed and on your PATH.
|
|
128
47
|
|
|
129
48
|
---
|
|
130
49
|
|
|
131
|
-
##
|
|
50
|
+
## Installation
|
|
132
51
|
|
|
133
|
-
### Global
|
|
52
|
+
### Global (recommended)
|
|
134
53
|
|
|
135
|
-
Install
|
|
54
|
+
Install once, use in any project:
|
|
136
55
|
|
|
137
56
|
```bash
|
|
138
57
|
npm install -g torch-it
|
|
139
58
|
```
|
|
140
59
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
torch-it
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
For per-project customisation, create a `torchrc.json` file in your project root (see Customization section below) or use command line flags (see Command Line Options section below).
|
|
148
|
-
|
|
149
|
-
### Per-Project Installation (Alternative)
|
|
150
|
-
|
|
151
|
-
If you prefer to install torch-it per project:
|
|
60
|
+
### Per-project
|
|
152
61
|
|
|
153
62
|
```bash
|
|
154
63
|
npm install torch-it --save-dev
|
|
155
64
|
```
|
|
156
65
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
Add to package.json scripts:
|
|
66
|
+
Add a script to `package.json`:
|
|
160
67
|
|
|
161
68
|
```json
|
|
162
69
|
{
|
|
@@ -166,116 +73,152 @@ Add to package.json scripts:
|
|
|
166
73
|
}
|
|
167
74
|
```
|
|
168
75
|
|
|
76
|
+
Then run with `npm run torch` or `npx torch-it`.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
### Basic run
|
|
83
|
+
|
|
169
84
|
```bash
|
|
170
|
-
|
|
85
|
+
torch-it
|
|
171
86
|
```
|
|
172
87
|
|
|
173
|
-
|
|
88
|
+
Shows a preview of what will be deleted, then prompts: **Continue? Type Yes or No (y/n)**.
|
|
89
|
+
|
|
90
|
+
### Skip confirmation (CI / automation)
|
|
174
91
|
|
|
175
92
|
```bash
|
|
176
|
-
|
|
93
|
+
torch-it --yes # or -y
|
|
177
94
|
```
|
|
178
95
|
|
|
179
|
-
### Dry
|
|
180
|
-
|
|
181
|
-
Use `--test` to preview what `torch-it` would do without deleting directories, cleaning caches, installing dependencies, or changing Docker resources. Results are saved to the `torch-it.log` file.
|
|
96
|
+
### Dry run (preview only, no changes)
|
|
182
97
|
|
|
183
98
|
```bash
|
|
184
99
|
torch-it --test
|
|
185
100
|
```
|
|
186
101
|
|
|
187
|
-
###
|
|
188
|
-
|
|
189
|
-
Use `--config` to display the current torch-it configuration, including all files and directories that will be targeted for deletion during a torch-it run. This is useful for verifying your setup before performing actual cleanup operations.
|
|
102
|
+
### Show current configuration
|
|
190
103
|
|
|
191
104
|
```bash
|
|
192
105
|
torch-it --config
|
|
193
106
|
```
|
|
194
107
|
|
|
195
|
-
|
|
196
|
-
- Current settings from `torchrc.json` (if present) or defaults
|
|
197
|
-
- All built-in cleanup targets
|
|
198
|
-
- Custom paths that will be removed
|
|
199
|
-
- Protected paths that will be preserved
|
|
200
|
-
- Docker and rebuild operation settings
|
|
201
|
-
|
|
202
|
-
This helps you understand exactly what will be affected before running torch-it, making it easier to verify your configuration is correct.
|
|
108
|
+
Displays all active settings, every cleanup target, custom paths, protected paths, and Docker settings. Useful for verifying your setup before running.
|
|
203
109
|
|
|
204
110
|
---
|
|
205
|
-
## Customization
|
|
206
111
|
|
|
207
|
-
|
|
112
|
+
## Configuration
|
|
113
|
+
|
|
114
|
+
Create a `torchrc.json` file in your project root to customise behaviour. Everything is optional โ `torch-it` works with sensible defaults out of the box.
|
|
208
115
|
|
|
209
116
|
```json
|
|
210
117
|
{
|
|
211
|
-
"customPaths": ["apps/web/.next", "services/api/tmp", "
|
|
118
|
+
"customPaths": ["apps/web/.next", "services/api/tmp", "coverage-final.json"],
|
|
212
119
|
"protectedPaths": ["important-data/", "config/production.json"],
|
|
213
|
-
"dockerMode":
|
|
120
|
+
"dockerMode": false,
|
|
214
121
|
"rebuild": true,
|
|
215
|
-
"logfile":
|
|
122
|
+
"logfile": false
|
|
216
123
|
}
|
|
217
124
|
```
|
|
218
125
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
126
|
+
| Option | Type | Default | Description |
|
|
127
|
+
|--------|------|---------|-------------|
|
|
128
|
+
| `customPaths` | `string[]` | `[]` | Extra directories or files to delete during cleanup |
|
|
129
|
+
| `protectedPaths` | `string[]` | `[]` | Paths to skip โ preserved even if they match built-in targets |
|
|
130
|
+
| `dockerMode` | `boolean` | `false` | Enable Docker teardown, rebuild, and launch |
|
|
131
|
+
| `rebuild` | `boolean` | `true` | Set to `false` to skip dependency reinstall and Docker rebuild (cleanup still runs) |
|
|
132
|
+
| `logfile` | `boolean` | `false` | Write runtime output to `torch-it.log` in the project root |
|
|
226
133
|
|
|
227
|
-
|
|
134
|
+
### Command line overrides
|
|
228
135
|
|
|
229
|
-
|
|
136
|
+
Any config option can be overridden with a flag. Flags take precedence over `torchrc.json`.
|
|
230
137
|
|
|
231
138
|
```bash
|
|
232
|
-
torch-it --
|
|
139
|
+
torch-it --yes --rebuild=false --customPaths=["temp/","logs/"]
|
|
140
|
+
torch-it --dockerMode=true --logfile=true
|
|
233
141
|
```
|
|
234
142
|
|
|
235
|
-
All
|
|
143
|
+
**All flags:**
|
|
144
|
+
|
|
145
|
+
| Flag | Description |
|
|
146
|
+
|------|-------------|
|
|
147
|
+
| `--help` | Show help and available options |
|
|
148
|
+
| `--version`, `-v` | Show version and exit |
|
|
149
|
+
| `--config` | Show current configuration and exit |
|
|
150
|
+
| `--test` | Dry run โ preview changes without executing |
|
|
151
|
+
| `--yes`, `-y` | Skip confirmation prompt |
|
|
152
|
+
| `--customPaths=[...]` | Extra paths to delete |
|
|
153
|
+
| `--protectedPaths=[...]` | Paths to preserve |
|
|
154
|
+
| `--dockerMode=true\|false` | Enable/disable Docker steps |
|
|
155
|
+
| `--rebuild=true\|false` | Enable/disable dependency reinstall and Docker rebuild |
|
|
156
|
+
| `--logfile=true\|false` | Enable/disable log file output |
|
|
236
157
|
|
|
237
|
-
|
|
238
|
-
- `--version, -v` - Show version information and exit
|
|
239
|
-
- `--config` - Show current configuration and exit
|
|
240
|
-
- `--test` - Run in dry-run mode (preview changes without executing)
|
|
241
|
-
- `--customPaths=["path1","path2"]`
|
|
242
|
-
- `--dockerMode=false`
|
|
243
|
-
- `--rebuild=false`
|
|
244
|
-
- `--logfile=true`
|
|
158
|
+
---
|
|
245
159
|
|
|
246
|
-
|
|
160
|
+
## Supported Frameworks & Tools
|
|
247
161
|
|
|
248
|
-
|
|
162
|
+
React, Next.js, Vue, Vite, SvelteKit, React Native, Expo, Remix, Qwik, Nuxt, Astro, Angular, Solid, Docusaurus, and 40+ more.
|
|
249
163
|
|
|
164
|
+
**Package managers:** npm ยท yarn ยท pnpm
|
|
250
165
|
|
|
166
|
+
<details>
|
|
167
|
+
<summary>Full list of cleanup targets</summary>
|
|
251
168
|
|
|
252
|
-
|
|
169
|
+
### Framework build outputs
|
|
170
|
+
`dist`, `build`, `out`, `.output`, `.next`, `.nuxt`, `.svelte-kit`, `.svelte`, `.remix`, `.qwik`, `.astro`, `.angular`, `.angular/cache`, `.solid`, `.docusaurus`, `.nitro`
|
|
253
171
|
|
|
254
|
-
|
|
172
|
+
### Build tool caches
|
|
173
|
+
`.cache`, `.parcel-cache`, `.webpack`, `.rollup.cache`, `.vite`, `.swc`, `.rpt2_cache`, `.eslintcache`, `.stylelintcache`, `.sass-cache`, `.babel-cache`, `.cache-loader`
|
|
255
174
|
|
|
256
|
-
|
|
175
|
+
### Package manager caches
|
|
176
|
+
`node_modules/.cache`, `.npm`, `.pnpm-store`, `.pnpm-debug.log`, `.yarn/cache`, `.yarn/unplugged`, `.yarn/install-state.gz`
|
|
257
177
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
```
|
|
178
|
+
### Monorepo & build tools
|
|
179
|
+
`.turbo`, `.nx/cache`, `.lerna`, `.rush`, `.yalc`
|
|
261
180
|
|
|
181
|
+
### Blockchain & Web3
|
|
182
|
+
`.hardhat`, `.foundry`, `.anchor`
|
|
262
183
|
|
|
263
|
-
|
|
184
|
+
### Deployment & platform
|
|
185
|
+
`.vercel`, `.netlify`, `.wrangler`, `.amplify`, `.sst`, `.firebase`, `.serverless`
|
|
186
|
+
|
|
187
|
+
### Mobile development
|
|
188
|
+
`android/.gradle`, `android/build`, `android/app/build`, `ios/Pods`, `ios/build`, `.expo`, `.expo-shared`
|
|
264
189
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
2. Does your project have Docker configuration files?
|
|
268
|
-
3. Are your Docker configuration files valid?
|
|
269
|
-
- If you see errors about missing `package.json`, initialize your project with `npm init -y` or add your project files.
|
|
270
|
-
- For detailed information about any failures, check the `torch-it.log` file.
|
|
190
|
+
### File patterns
|
|
191
|
+
`*.log`, `*.tgz`, `*.tar.gz`, `tsconfig.tsbuildinfo`, `coverage`, `.nyc_output`, `storybook-static`, `.storybook-out`
|
|
271
192
|
|
|
193
|
+
### Temporary files
|
|
194
|
+
`.tmp`, `tmp`, `temp`, `lib`, `es`, `cjs`, `umd`, `jspm_packages`, `.typings`
|
|
195
|
+
|
|
196
|
+
</details>
|
|
272
197
|
|
|
273
198
|
---
|
|
274
199
|
|
|
275
|
-
##
|
|
200
|
+
## Logging
|
|
201
|
+
|
|
202
|
+
By default, output goes to the console only. To save a log file for troubleshooting, set `logfile: true` in `torchrc.json` or pass `--logfile=true`.
|
|
203
|
+
|
|
204
|
+
The log is written to `torch-it.log` in your project root. Add it to `.gitignore`:
|
|
205
|
+
|
|
206
|
+
```gitignore
|
|
207
|
+
torch-it.log
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Troubleshooting
|
|
213
|
+
|
|
214
|
+
**Docker issues:** Run `docker compose ps` from the project root to check if Compose is working. For rebuilds, confirm `docker compose` is on your PATH. Check that the Docker daemon is running with `docker info`.
|
|
276
215
|
|
|
277
|
-
|
|
216
|
+
**Missing `package.json`:** Run `npm init -y` to initialise a project, or make sure you're in the right directory.
|
|
217
|
+
|
|
218
|
+
**Not sure what will be deleted?** Run `torch-it --config` to see the full list of targets, or `torch-it --test` for a dry run.
|
|
278
219
|
|
|
279
220
|
---
|
|
280
221
|
|
|
281
|
-
|
|
222
|
+
## License
|
|
223
|
+
|
|
224
|
+
MIT โ **Happy torching!** ๐ฅโจ
|
package/dist/torch-it.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`)};function o(e,t){let n;switch(t){case"info":n=`${
|
|
4
|
-
${
|
|
2
|
+
"use strict";var Se=Object.create;var q=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var $e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ae=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of xe(t))!Pe.call(e,s)&&s!==n&&q(e,s,{get:()=>t[s],enumerable:!(r=Oe(t,s))||r.enumerable});return e};var m=(e,t,n)=>(n=e!=null?Se(ve(e)):{},Ae(t||!e||!e.__esModule?q(n,"default",{value:e,enumerable:!0}):n,e));var pe=$e((ho,Me)=>{Me.exports={name:"torch-it",version:"2.6.1",description:"CLI to reset, clean, and rebuild Node.js project environments.",keywords:["cleanup","cli","docker","node"],homepage:"https://github.com/piyook/torch-it#readme",bugs:{url:"https://github.com/piyook/torch-it/issues"},license:"ISC",author:"",repository:{type:"git",url:"git+https://github.com/piyook/torch-it.git"},bin:{"torch-it":"dist/torch-it.js"},files:["dist","README.md"],type:"commonjs",main:"dist/torch-it.js",scripts:{build:'esbuild src/torch.ts --bundle --outfile=dist/torch-it.js --platform=node --format=cjs --minify --banner:js="#!/usr/bin/env node"',"torch-it":"npm run build && node dist/torch-it.js","torch-it:ts":"ts-node src/torch.ts",lint:"oxlint .","lint:fix":"oxlint . --fix",format:"prettier --check src/**/*.{ts,js,json} tests/**/*.{ts,js,json} package.json package-lock.json .commitlintrc.json","format:write":"prettier --write src/**/*.{ts,js,json} tests/**/*.{ts,js,json} package.json package-lock.json .commitlintrc.json",quality:"npm run lint && npm run format && npm test","validate-branch-name":"validate-branch-name",prepare:"husky",prepublishOnly:"npm run build",test:"tsc --noEmit && vitest run","test:watch":"vitest"},dependencies:{},devDependencies:{"@commitlint/cli":"^20.5.0","@commitlint/config-conventional":"^20.5.0","@types/node":"^25.6.0",esbuild:"^0.28.0",husky:"^9.1.7","lint-staged":"^16.4.0",oxlint:"^1.61.0",prettier:"^3.8.3","ts-node":"^10.9.2",typescript:"^6.0.3","validate-branch-name":"^1.3.2",vitest:"^4.1.5"},"lint-staged":{"*.{ts,tsx,js,jsx,mjs,cjs,json}":["oxlint --fix","prettier --write"]},"validate-branch-name":{pattern:"^(main|dev){1}$|^(feat|fix|hotfix|release|chore)/.+$",errorMsg:"INVALID BRANCH NAME: use format 'feat|fix|hotfix|release|core/your-branch-name'"}}});var T=(e,t)=>n=>`\x1B[${e}m${n}\x1B[${t}m`,f={BOLD:T("1","22"),CYAN:T("36","39"),GREEN:T("32","39"),RED:T("31","39"),YELLOW:T("33","39"),PURPLE:T("35","39"),RESET:e=>`\x1B[0m${e}`},a={INFO:"\u{1F525}",SUCCESS:"\u2705",FAIL:"\u274C",EXCLAMATION:"\u2757",WARN:"\u26A0\uFE0F",ROCKET:"\u{1F525}",CLEAN:"\u{1F525}",PHOENIX:"\u{1F525}",BUILD:"\u{1F528}",TARGET:"\u{1F525}",CELEBRATE:"\u{1F525}",STARS:"\u2728",BOX:"\u{1F4E6}",CLIPBOARD:"\u{1F4CB}",DOCKER:"\u{1F433}"};var H=m(require("fs")),B=!0;function Ie(e){let t=new RegExp("\x1B\\[[0-9;]*m","g");return e.replace(t,"")}var E=e=>{B=e},X=()=>{B&&H.default.writeFileSync("torch-it.log","")},P=e=>{if(!B)return;let t=Ie(e).replace(/^\n/,""),n=new Date().toISOString();H.default.appendFileSync("torch-it.log",`[${n}] ${t}
|
|
3
|
+
`)};function o(e,t){let n;switch(t){case"info":n=`${f.CYAN(a.INFO)} ${f.BOLD(e)}${f.RESET("")}`;break;case"success":n=`${f.GREEN(a.SUCCESS)} ${e}${f.RESET("")}`;break;case"warn":n=`${f.YELLOW(a.WARN)} ${e}${f.RESET("")}`;break;case"fail":n=`${f.RED(a.FAIL)} ${e}${f.RESET("")}`;break;case"step":n=`
|
|
4
|
+
${f.PURPLE("\u25B6")} ${f.BOLD(e)}${f.RESET("")}`;break;default:n=e}console.log(n),P(n)}function J(){$([` ${a.TARGET} TORCH LIT ${a.ROCKET}`],f.PURPLE);let e=`
|
|
5
5
|
) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
|
|
6
6
|
(( (( (( (( (( (( (( (( (( (( (( (( (( ((
|
|
7
7
|
) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
|
|
@@ -12,7 +12,7 @@ ${l.PURPLE("\u25B6")} ${l.BOLD(e)}${l.RESET("")}`;break;default:n=e}console.log(
|
|
|
12
12
|
| _ \\| | | | |_) | \\| || || \\| | | _
|
|
13
13
|
| |_) | |_| | _ <| |\\ || || |\\ | |_| |
|
|
14
14
|
|____/ \\___/|_| \\_\\_| \\_|___|_| \\_|\\____|
|
|
15
|
-
`;console.log(e)
|
|
15
|
+
`;console.log(e),P(e)}function z(){console.log(""),$([` ${a.PHOENIX} RISING FROM THE ASHES ${a.PHOENIX}`],f.PURPLE)}function V(e){let t=new RegExp("\x1B\\[[0-9;]*m","g");return e.replace(t,"").length}function $(e,t=f.GREEN){let n=Math.max(56,...e.map(s=>V(s))),r=t("\u2550".repeat(n));console.log(t("\u2554"+r+"\u2557")),e.forEach(s=>{if(P(s),s.trim()==="")console.log(t("\u2551"+" ".repeat(n)+"\u2551"));else{let c=n-V(s);console.log(t("\u2551"+s+" ".repeat(c)+"\u2551"))}}),console.log(t("\u255A"+r+"\u255D"))}var M=m(require("fs"));var A=["node_modules","dist","build",".svelte-kit",".svelte",".next",".nuxt","out",".output",".vercel",".netlify",".astro",".angular",".angular/cache",".solid",".docusaurus",".vite",".cache",".parcel-cache",".webpack",".rollup.cache",".rpt2_cache",".swc",".eslintcache",".stylelintcache",".sass-cache",".tmp","tmp","temp","coverage",".nyc_output","storybook-static",".storybook-out",".turbo",".rush",".firebase",".serverless","android/.gradle","android/build","android/app/build","ios/Pods","ios/build",".expo",".expo-shared","lib","es","cjs","umd",".remix",".qwik",".nitro",".wrangler",".amplify",".sst",".babel-cache",".cache-loader","jspm_packages",".typings"],I=["*.log","*.tgz","*.tar.gz","tsconfig.tsbuildinfo"],N=[".pnpm-store",".pnpm-debug.log",".yarn/cache",".yarn/unplugged",".yarn/install-state.gz",".yarn/build-state.yml",".npm","node_modules/.cache",".yalc",".lerna",".nx/cache",".vite/deps",".turbo","tsconfig.tsbuildinfo",".hardhat",".foundry",".anchor"],L=[];var Z=m(require("fs"));var w=require("child_process"),Q=m(require("os"));function h(e,t={}){try{return(0,w.execSync)(e,{stdio:t.silent?"pipe":"inherit"}),!0}catch{return t.silent||o(`Command failed: ${e}`,"fail"),!1}}function u(e){try{return Q.platform()==="win32"?(0,w.execSync)(`where ${e}`,{stdio:"ignore"}):(0,w.execSync)(`command -v ${e}`,{stdio:"ignore"}),!0}catch{return!1}}var F={npm:{name:"npm",lockFile:"package-lock.json",installCommand:"npm install",cacheCleanCommand:"npm cache clean --force"},yarn:{name:"yarn",lockFile:"yarn.lock",installCommand:"yarn install",cacheCleanCommand:"yarn cache clean"},pnpm:{name:"pnpm",lockFile:"pnpm-lock.yaml",installCommand:"pnpm install",cacheCleanCommand:"pnpm store prune"}};function K(){for(let e of["pnpm","yarn","npm"])if(Z.existsSync(F[e].lockFile)&&u(e))return e;for(let e of["npm","yarn","pnpm"])if(u(e))return e;return null}function ee(e){let t=process.env.TORCH_DRY_RUN==="1",n=F[e],r=e===K()?`Using ${e} (detected ${n.lockFile})...`:`Using ${e} (fallback)...`;return o(r,"step"),t||h(n.installCommand)?(o(`Dependencies ${t?"would be installed":"installed successfully"} with ${e}`,"success"),!0):(o(`${e} install failed`,"fail"),!1)}function oe(e){let t=process.env.TORCH_DRY_RUN==="1",n=F[e];return t||h(n.cacheCleanCommand)?(o(t?`Dry-run: would clean ${e} cache`:`${e} cache cleaned`,"success"),!0):!1}function te(){return Object.keys(F).filter(u)}var y={customPaths:[],customDirs:[],customFiles:[],protectedPaths:[],dockerMode:!1,logfile:!1,rebuild:!0};var g=m(require("fs")),ne=m(require("path"));function re(e){let{isDryRun:t,protectedPaths:n}=e,r=0;return{removedCount:()=>r,cleanupTarget:s=>{if(g.existsSync(s)){o(`${t?"Would remove":"Removing"} ${s}...`,"step");try{t||g.rmSync(s,{recursive:!0,force:!0}),o(`${s} ${t?"marked for removal (dry-run)":"removed"}`,"success"),r++}catch{o(`Failed to remove ${s}`,"fail")}}},cleanupFile:s=>{if(g.existsSync(s)&&g.statSync(s).isFile()&&!n.some(R=>s===R||s.startsWith(R+"/"))){o(`${t?"Would remove":"Removing"} ${s}...`,"step");try{t||g.unlinkSync(s),o(`${s} ${t?"marked for removal (dry-run)":"removed"}`,"success"),r++}catch{o(`Failed to remove ${s}`,"fail")}}},isPathProtected:s=>n.some(c=>s===c||s.startsWith(c+"/"))}}function Y(e,t){return e.filter(n=>!t.some(r=>n===r||n.startsWith(r+"/")))}function se(e,t){try{let n=g.readdirSync(".",{withFileTypes:!0}).filter(r=>r.name.match(e.replace("*",".*"))).map(r=>r.name);for(let r of n){let s=ne.join(".",r);t.cleanupFile(s)}}catch(n){o(`Failed to process pattern ${e}: ${n}`,"warn")}}var Ne=e=>{let t={};for(let n of e){if(!n.startsWith("--"))continue;let[r,s]=n.slice(2).split("=",2);if(!(!r||!s))try{let c=JSON.parse(s);t[r]=c}catch{s==="true"?t[r]=!0:s==="false"?t[r]=!1:t[r]=s}}return t},Le=()=>{let e="torchrc.json";if(!M.existsSync(e))return{};try{return JSON.parse(M.readFileSync(e,"utf8"))}catch{return o("Invalid torchrc.json (must be valid JSON) - skipping custom config","warn"),{}}},_=()=>{let e=Le();return{customPaths:e.customPaths??y.customPaths,customDirs:e.customDirs??y.customDirs,customFiles:e.customFiles??y.customFiles,protectedPaths:e.protectedPaths??y.protectedPaths,dockerMode:e.dockerMode??y.dockerMode,logfile:e.logfile??y.logfile,rebuild:e.rebuild??y.rebuild}};var ie=(e=[])=>{let t=_(),n=Ne(e);return{...t,...n}},we=()=>{let e=_();return[...e.customPaths,...e.customDirs,...e.customFiles].filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0)},ae=()=>{let e=process.env.TORCH_DRY_RUN==="1",t=_(),n=we(),r=t.protectedPaths,s=[...new Set([...A,...N,...L])],c=[...new Set(n)],R=[...I],d=Y(s,r),S=Y(c,r),k=re({isDryRun:e,protectedPaths:r});o("Scanning for build artifacts and cache directories...","step"),d.forEach(k.cleanupTarget),o("Scanning for log files and temporary files...","step");for(let b of R)b.includes("*")?se(b,k):k.cleanupTarget(b);S.length>0&&(o("Deleting user defined custom directories and files","step"),S.forEach(k.cleanupTarget));let O=s.length-d.length+(c.length-S.length);O>0&&o(`Skipped ${O} protected path(s) from torchrc.json`,"info");let D=k.removedCount();return D===0?(o("No build artifacts or cache directories found (project already clean)","info"),!1):(o(`Removed ${D} build/cache directories`,"success"),!0)},ce=()=>{let e=te(),t=!1;for(let n of e)oe(n)&&(t=!0);return t||o("No package manager caches cleaned (tools not available)","info"),t};var le=()=>{o(`
|
|
16
16
|
\u{1F525} Torch It - Project Environment Reset Tool
|
|
17
17
|
|
|
18
18
|
USAGE:
|
|
@@ -23,7 +23,8 @@ OPTIONS:
|
|
|
23
23
|
--version, -v Show version information and exit
|
|
24
24
|
--config Show current configuration and exit
|
|
25
25
|
--test Run in dry-run mode (preview changes without executing)
|
|
26
|
-
--
|
|
26
|
+
--yes, -y Skip the confirmation prompt (same as answering yes)
|
|
27
|
+
--dockerMode=<bool> Enable/disable Docker operations (default: false)
|
|
27
28
|
--rebuild=<bool> Enable/disable rebuild operations (default: true)
|
|
28
29
|
--logfile=<bool> Enable/disable file logging (default: false)
|
|
29
30
|
--customPaths=<array> Additional paths to remove during cleanup
|
|
@@ -34,8 +35,9 @@ EXAMPLES:
|
|
|
34
35
|
torch-it --version # Show version information
|
|
35
36
|
torch-it --config # Show current configuration
|
|
36
37
|
torch-it --test # Preview what would be done
|
|
38
|
+
torch-it --yes # No confirmation prompt (same as -y)
|
|
37
39
|
torch-it --rebuild=false # Clean only, don't rebuild
|
|
38
|
-
torch-it --dockerMode=
|
|
40
|
+
torch-it --dockerMode=true # Enable Docker cleanup/rebuild when configured
|
|
39
41
|
torch-it --logfile=true # Enable file logging
|
|
40
42
|
torch-it --customPaths=["temp/","logs/"] # Clean additional paths
|
|
41
43
|
|
|
@@ -45,18 +47,20 @@ CONFIGURATION:
|
|
|
45
47
|
{
|
|
46
48
|
"customPaths": ["apps/web/.next", "coverage-final.json"],
|
|
47
49
|
"protectedPaths": ["important-data/"],
|
|
48
|
-
"dockerMode":
|
|
50
|
+
"dockerMode": false,
|
|
49
51
|
"rebuild": true,
|
|
50
52
|
"logfile": false
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
For more information, visit: https://github.com/piyook/torch-it
|
|
54
|
-
`.trim(),"info")};var p=
|
|
56
|
+
`.trim(),"info")};var p=m(require("fs"));function Fe(e){return[...e.customPaths,...e.customDirs,...e.customFiles].filter(t=>typeof t=="string").map(t=>t.trim()).filter(t=>t.length>0)}function G(e,t){let n=t?.includeHelpFooter!==!1,r=Fe(e),s=e.protectedPaths;o("=".repeat(60),"info"),o("TORCH-IT CONFIGURATION","info"),o("=".repeat(60),"info"),o(`
|
|
55
57
|
BASIC SETTINGS:`,"info"),o(` Docker Mode: ${e.dockerMode}`,"info"),o(` Rebuild: ${e.rebuild}`,"info"),o(` Logfile: ${e.logfile}`,"info"),o(`
|
|
56
|
-
PACKAGE MANAGER DETECTION:`,"info");let
|
|
57
|
-
DOCKER DETECTION:`,"info");let
|
|
58
|
-
FILES/DIRECTORIES THAT WILL BE DELETED:`,"info");let
|
|
59
|
-
PROTECTED PATHS (will NOT be deleted):`,"info"),
|
|
60
|
-
PROTECTED PATHS: None`,"info"),
|
|
61
|
-
CUSTOM PATHS
|
|
62
|
-
`+"=".repeat(60),"info"),o("Use 'torch-it --help' for available options","info"),o("=".repeat(60),"info")};function
|
|
58
|
+
PACKAGE MANAGER DETECTION:`,"info");let c=[];p.existsSync("package-lock.json")&&u("npm")?c.push("npm (package-lock.json)"):u("npm")&&c.push("npm (fallback)"),p.existsSync("yarn.lock")&&u("yarn")?c.push("yarn (yarn.lock)"):u("yarn")&&c.push("yarn (fallback)"),p.existsSync("pnpm-lock.yaml")&&u("pnpm")?c.push("pnpm (pnpm-lock.yaml)"):u("pnpm")&&c.push("pnpm (fallback)"),c.length>0?c.forEach(i=>o(` ${i}`,"info")):o(" No package manager detected","warn"),o(`
|
|
59
|
+
DOCKER DETECTION:`,"info");let d=["Dockerfile","docker-compose.yml","docker-compose.yaml"].filter(i=>p.existsSync(i));d.length>0?d.forEach(i=>o(` ${i}`,"info")):o(" No Docker configuration found","info"),o(`
|
|
60
|
+
FILES/DIRECTORIES THAT WILL BE DELETED:`,"info");let k=[...new Set([...A,...N,...L,...I])].filter(i=>!s.some(l=>i===l||i.startsWith(l+"/"))),O=r.filter(i=>!s.some(l=>i===l||i.startsWith(l+"/"))),D=k.filter(i=>!i.includes("*")&&p.existsSync(i)),b=k.filter(i=>i.includes("*")),x=O.filter(i=>p.existsSync(i));D.length>0&&(o(" Default targets:","info"),D.forEach(i=>{let l=p.statSync(i).isDirectory()?"DIR":"FILE";o(` ${i} (${l})`,"info")})),b.length>0&&(o(" Glob patterns:","info"),b.forEach(i=>{try{let l=p.readdirSync(".",{withFileTypes:!0}).filter(C=>C.name.match(i.replace("*",".*"))).map(C=>C.name);l.length>0?(o(` ${i} (matches ${l.length} file${l.length===1?"":"s"}):`,"info"),l.forEach(C=>{o(` ${C} (FILE)`,"info")})):o(` ${i} (no matches)`,"info")}catch(l){o(` ${i} (error: ${l})`,"warn")}})),x.length>0&&(o(" Custom targets:","info"),x.forEach(i=>{let l=p.statSync(i).isDirectory()?"DIR":"FILE";o(` ${i} (${l})`,"info")})),D.length===0&&b.length===0&&x.length===0&&o(" No targets found (nothing to delete)","info"),s.length>0?(o(`
|
|
61
|
+
PROTECTED PATHS (will NOT be deleted):`,"info"),s.forEach(i=>{let l=p.existsSync(i),C=l&&p.statSync(i).isDirectory()?"DIR":"FILE",v=l?`(${C})`:"(not found)";o(` ${i} ${v}`,"info")})):o(`
|
|
62
|
+
PROTECTED PATHS: None`,"info"),r.length>0&&(o(`
|
|
63
|
+
CUSTOM PATHS:`,"info"),r.forEach(i=>{let l=p.existsSync(i),C=l&&p.statSync(i).isDirectory()?"DIR":"FILE",v=l?`(${C})`:"(not found)";o(` ${i} ${v}`,"info")})),o(`
|
|
64
|
+
`+"=".repeat(60),"info"),n&&(o("Use 'torch-it --help' for available options","info"),o("=".repeat(60),"info"))}var fe=()=>{G(_())};function ue(e){let t=e.includes("--help"),n=e.includes("--version")||e.includes("-v"),r=e.includes("--config"),s=e.includes("--test"),c=e.includes("--yes")||e.includes("-y"),R=e.filter(d=>d!=="--test"&&d!=="--help"&&d!=="--version"&&d!=="-v"&&d!=="--config"&&d!=="--yes"&&d!=="-y");return{isHelp:t,isVersion:n,isConfig:r,isDryRun:s,assumeYes:c,filteredArgs:R}}function de(e){if(e.isHelp&&(E(!1),le(),process.exit(0)),e.isVersion){E(!1);let t=pe();o(`torch-it v${t.version}`,"info"),process.exit(0)}e.isConfig&&(E(!1),fe(),process.exit(0)),e.isDryRun&&(process.env.TORCH_DRY_RUN="1")}var j=m(require("fs"));function me(){return j.existsSync("Dockerfile")||j.existsSync("docker-compose.yml")||j.existsSync("docker-compose.yaml")}function ge(e){if(e.dockerMode===!1)return o("Docker mode disabled - skipping Docker operations","info"),"NO_DOCKER";let t=process.env.TORCH_DRY_RUN==="1";return me()?(o("Stopping Docker services and removing all resources...","info"),u("docker")?h("docker info",{silent:!0})?h("docker compose ps",{silent:!0})?t?(o("Dry-run: would run 'docker compose down --rmi all --volumes'","info"),"OK"):h("docker compose down --rmi all --volumes")?(o("Docker services stopped and resources cleaned","success"),"OK"):(o("Docker cleanup encountered issues","warn"),o("Continuing with the rest of the script...","info"),"DOCKER_FAIL"):(o("No Docker Compose services found - skipping Docker cleanup","warn"),o("This is normal if no services were previously running","info"),"DOCKER_FAIL"):(o("Docker daemon is not running - skipping Docker cleanup","warn"),o("You may need to start Docker manually and run cleanup later","info"),"NO_DOCKER"):(o("Docker is not installed - skipping Docker cleanup","warn"),"NO_DOCKER")):(o("No Docker configuration found - skipping Docker operations","info"),"NO_DOCKER")}function he(e){if(e.dockerMode===!1)return!1;if(e.rebuild===!1)return o("Rebuild disabled - skipping Docker rebuild","info"),!1;let t=process.env.TORCH_DRY_RUN==="1";return me()?u("docker")?h("docker info",{silent:!0})?(o("Building Docker resources (this may take a while...)...","step"),console.log(` ${f.YELLOW("\u23F3 Please be patient - pulling fresh images and building...")}`),t?(o("Dry-run: would run 'docker compose build --pull --no-cache'","info"),!0):h("docker compose build --pull --no-cache")?!0:(o("Docker build encountered issues - check torch-it.log for details","fail"),!1)):(o("Docker daemon is not running - skipping Docker rebuild","warn"),o("Start Docker manually and run 'docker compose build --pull --no-cache' later","info"),!1):(o("Docker is not installed - skipping Docker rebuild","warn"),!1):!1}function Ce(e){if(e.dockerMode===!1)return!1;let t=process.env.TORCH_DRY_RUN==="1";return o("Starting Docker services in detached mode...","step"),t?(o("Dry-run: would run 'docker compose up -d'","info"),!0):h("docker compose up -d")?!0:(o("Failed to start Docker services - check torch-it.log for details","fail"),!1)}var ke=()=>{o("Detecting package manager and installing dependencies...","step");let e=K();return e?ee(e):(o("No package manager found (npm/yarn/pnpm). Please install dependencies manually.","fail"),!1)};var ye=e=>{let t="",n="",r="";e.dockerClean==="NO_DOCKER"?t=`${a.DOCKER} No Docker containers found`:e.dockerClean==="DOCKER_FAIL"&&(t=`${a.FAIL} Failed to remove Docker containers`),e.dockerClean==="OK"&&(e.dockerRebuild?n=`${a.DOCKER} Docker containers rebuilt from scratch`:n=`${a.FAIL} Failed to rebuild Docker containers`,e.dockerLaunch&&e.dockerRebuild?r=`${a.ROCKET} Services running in detached mode`:r=`${a.FAIL} Failed to start Docker containers`);let s=e.buildAndCacheClean&&e.packageManagerClean?`${a.CLEAN} All build artifacts & caches removed`:`${a.FAIL} Build artifacts or cache directories not found`,c=e.dependencyInstall?`${a.BOX} Dependencies freshly installed`:`${a.FAIL} Failed to install dependencies`;console.log(""),$(["\u{1F525} PROJECT SUCCESSFULLY TORCHED! \u{1F525}","",`${s}`,`${c}`,`${t}`,`${n}`,`${r}`,"",e.logfile===!1?`${a.CLIPBOARD} Logging to torch-it.log is disabled; set "logfile": true in torchrc.json to enable it`:`${a.CLIPBOARD} Check torch-it.log for detailed logs`])};var Re=m(require("readline"));function be(e){let t=Re.createInterface({input:process.stdin,output:process.stdout});return new Promise(n=>{t.question(e,r=>{t.close();let s=r.trim().toLowerCase();n(s==="y"||s==="yes")})})}async function De(e,t={}){t.assumeYes===!0||process.env.TORCH_DRY_RUN==="1"||process.stdin.isTTY!==!0||(o(`
|
|
65
|
+
Review the cleanup below. Matching paths and Docker actions (if enabled) will run next.`,"warn"),G(e,{includeHelpFooter:!1}),o(`
|
|
66
|
+
These targets will be removed where they exist. Package caches may be cleared and dependencies reinstalled per your settings.`,"warn"),await be("Continue? Type Yes or No (y/n): ")||(o("Aborted.","info"),process.exit(0)));let r={dockerClean:"NO_DOCKER",buildAndCacheClean:!1,packageManagerClean:!1,dependencyInstall:!1,dockerRebuild:!1,dockerLaunch:!1,logfile:e.logfile};return o(`${a.CLEAN} DOCKER CLEANUP`,"step"),r.dockerClean=ge(e),o(`${a.CLEAN} BUILD ARTIFACTS & CACHE CLEANUP`,"step"),r.buildAndCacheClean=ae(),o("Cleaning package manager caches...","step"),r.packageManagerClean=ce(),e.rebuild!==!1?(z(),o(`${a.BUILD} DEPENDENCY INSTALLATION`,"step"),r.dependencyInstall=ke()):(o("Rebuild disabled - skipping dependency installation","info"),r.dependencyInstall=!1),r.dockerClean!=="NO_DOCKER"&&e.rebuild!==!1?(o(`${a.BUILD} DOCKER REBUILD`,"step"),r.dockerRebuild=he(e)):r.dockerClean!=="NO_DOCKER"&&e.rebuild===!1&&(o("Rebuild disabled - skipping Docker rebuild","info"),r.dockerRebuild=!1),r.dockerRebuild&&(r.dockerLaunch=Ce(e),o(`${a.ROCKET} LAUNCH`,"step")),ye(r),r}var Te=m(require("fs")),Ee=m(require("path"));function je(){return["package.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json"].some(t=>Te.existsSync(Ee.join(process.cwd(),t)))}function _e(){je()||(o("This directory does not contain a Node.js project.","fail"),o("Please create a Node.js project (with package.json) before using torch-it.","info"),process.exit(1))}var Ue=process.argv.slice(2),U=ue(Ue);de(U);var W=ie(U.filteredArgs);E(W.logfile);W.logfile&&X();J();_e();U.isDryRun&&o("Running in --test dry-run mode (no files or services will be changed)","warn");(async()=>{await De(W,{assumeYes:U.assumeYes})})().catch(e=>{console.error(e),process.exit(1)});
|