mirror of https://github.com/tycrek/ass.git
Added purge script `npm run purge`
This commit is contained in:
parent
09fe844d45
commit
1e2332918b
|
@ -412,6 +412,7 @@ ass has a number of pre-made npm scripts for you to use. **All** of these script
|
|||
| `dev` | Chains the `build` and `compile` scripts together. |
|
||||
| `setup` | Starts the easy setup process. Should be run after any updates that introduce new config options. |
|
||||
| `metrics` | Runs the metrics script. This is a simple script that outputs basic resource statistics. |
|
||||
| `purge` | Purges all uploads and data associated with them. This does **not** delete any users, however. |
|
||||
| `new-token` | Generates a new API token. Accepts one parameter for specifying a username, like `npm run new-token <username>`. ass automatically detects the new token & reloads it, so there's no need to restart the server. |
|
||||
| `engine-check` | Ensures your environment meets the minimum Node & npm version requirements. |
|
||||
| `docker-logs` | Alias for `docker-compose logs -f --tail=50 --no-log-prefix ass` |
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"engine-check": "node dist/checkEngine.js",
|
||||
"prestart": "npm run engine-check",
|
||||
"presetup": "npm run engine-check",
|
||||
"purge": "node dist/purge.js",
|
||||
"docker-logs": "docker-compose logs -f --tail=50 --no-log-prefix ass",
|
||||
"docker-update": "git pull && npm run docker-uplite",
|
||||
"docker-uplite": "docker-compose up --force-recreate --build -d && docker image prune -f",
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import { TLog } from '@tycrek/log';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
const log = new TLog();
|
||||
const uploadsPath = path.join(process.cwd(), 'uploads/');
|
||||
const dataPath = path.join(process.cwd(), 'data.json');
|
||||
|
||||
if (fs.existsSync(uploadsPath)) {
|
||||
fs.removeSync(uploadsPath);
|
||||
log.success('Deleted', uploadsPath);
|
||||
}
|
||||
if (fs.existsSync(dataPath)) {
|
||||
fs.removeSync(dataPath);
|
||||
log.success('Deleted', dataPath);
|
||||
}
|
Loading…
Reference in New Issue