minor improvements

pull/29/head
tycrek 3 years ago
parent 2d3433c389
commit 03d5cb450b
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -277,7 +277,7 @@ ass has a number of pre-made npm scripts for you to use. **All** of these script
| `setup` | Starts the easy setup process. Should be run once after installing ass, & also after any updates that introduce new configuration options. |
| `metrics` | Runs the metrics script. This is a simple script that outputs basic resource statistics. |
| `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. |
| `update` | Runs update tasks. These will update ass to the latest version by first restoring `package-lock.json` (which tends to overrite on `git pull`), pulling changes with `git pull`, then running `npm i` to install any new dependencies. This is the recommended way to update ass. After updating, you will need to restart ass. |
| `update` | Runs update tasks. These will update ass to the latest version by first pulling changes with `git pull`, then running `npm i` to install any new dependencies. This is the recommended way to update ass. After updating, you will need to restart ass. |
| `update-full` | Runs the previous update script, followed by `npm run setup` to ensure that all the latest configuration options are set. The setup script uses your **existing** config for setting defaults to make updates much quicker. If any ass Release Notes say to use `update-full` instead of `update`, then use `update-full`. |
| `restart` | Restarts the ass server using `systemctl`. More info soon (should work fine if you have an existing `ass.service` file) |
| `engine-check` | Ensures your environment meets the minimum Node & npm version requirements. |

@ -12,7 +12,7 @@
"setup": "node setup.js",
"metrics": "node metrics.js",
"new-token": "node generators/token.js",
"update": "git restore package-lock.json && git pull && npm i",
"update": "git pull && npm i",
"update-full": "npm run update && npm run setup",
"restart": "systemctl restart ass.service",
"engine-check": "node checkEngine.js",

@ -22,9 +22,9 @@ const config = {
};
// If directly called on the command line, run setup script
if (require.main === module) {
const TLog = require('@tycrek/log');
function doSetup() {
const path = (...paths) => require('path').join(__dirname, ...paths);
const TLog = require('@tycrek/log');
const fs = require('fs-extra');
const prompt = require('prompt');
@ -185,23 +185,31 @@ if (require.main === module) {
let results = {};
prompt.get(setupSchema)
.then((r) => results = r) // skipcq: JS-0086
/* .then(() => log.blank().warn('Please verify your information', ''))
.then(() => Object.entries(results).forEach(([setting, value]) => log.info(`--> ${setting}`, `${value}`)))
.then(() => log.blank()) */
// Verify information is correct
.then(() => log
.blank()
.warn('Please verify your information', '')
.callback(() => Object.entries(results).forEach(([setting, value]) => log.info(`--> ${setting}`, `${value}`)))
.blank())
// Confirm
.then(() => prompt.get(confirmSchema))
.then(({ confirm }) => (confirm ? fs.writeJson(path('config.json'), results, { spaces: 4 }) : process.exit(1)))
.then(() => log.blank().success('Config has been saved!'))
.catch((err) => log.blank().error(err));
}
module.exports = config;
module.exports = {
doSetup,
config
};
// If called on the command line, run the setup.
// Using this makes sure setup is not run when imported by another file
if (require.main === module) {
doSetup();
}
/*{
description: 'Enter your password', // Prompt displayed to the user. If not supplied name will be used.

Loading…
Cancel
Save