diff --git a/package.json b/package.json index e714cce2..7fcb1ee6 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,11 @@ "dev:nuxt": "cross-env NODE_ENV=development nuxt dev", "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server", "build": "nuxt build", - "start": "cross-env NODE_ENV=production node server/cli.js", - "start:nuxt": "cross-env NODE_ENV=development nuxt start", + "start": "cross-env sequelize db:migrate && NODE_ENV=production node server/cli.js", "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", "doc": "cd docs && bundle exec jekyll b", - "precommit": "npm run lint", "migrate:dev": "sequelize db:migrate", - "migrate": "NODE_ENV=production sequelize db:migrate", - "prepublish": "nuxt build" + "migrate": "NODE_ENV=production sequelize db:migrate" }, "license": "AGPL-3.0", "bugs": { diff --git a/server/cli.js b/server/cli.js index 6fd7d7a0..f73812ee 100755 --- a/server/cli.js +++ b/server/cli.js @@ -160,11 +160,10 @@ async function setupQuestionnaire() { async function start (options) { // is first run? if (firstrun.check(options.config)) { - consola.error(`Configuration file "${options.config}" not found! -This is your first run? Run 'gancio setup'`) + consola.error(`Configuration file "${options.config}" not found! Use "--config " to specify another path. +If this is your first run use 'gancio setup --config ' `) process.exit(-1) } - await upgrade(options) require('./index') } @@ -173,32 +172,10 @@ async function setup (options) { const config = await setupQuestionnaire() await firstrun.setup(config, options.config) consola.info(`You can edit '${options.config}' to modify your configuration. `) - consola.info(`Run "gancio --config ${options.config}"`) + consola.info(`Start the server with "gancio --config ${options.config}"`) process.exit(0) } -async function upgrade (options) { - const Umzug = require('umzug') - const Sequelize = require('sequelize') - const config = require('config') - const db = new Sequelize(config.db) - const umzug = new Umzug({ - storage: 'sequelize', - storageOptions: { sequelize: db }, - migrations: { - wrap: fun => { - return () => fun(db.queryInterface, Sequelize) - }, - path: path.resolve(__dirname, 'migrations') - } - }) - const migrations = await umzug.up() - if (migrations.length) { - consola.info('Migrations executed: ', migrations.map(m => m.file)) - } - db.close() -} - consola.info(`${package.name} - v${package.version} - ${package.description}`) require('yargs') @@ -215,8 +192,7 @@ require('yargs') }) .command(['start', 'run', '$0'], 'Start gancio', {}, start) .command('setup', 'Setup a new instance', {}, setup) -.command('upgrade', 'Upgrade gancio to a new release (interactive)', {}, upgrade) .help('h') .alias('h', 'help') -.epilog('Made with ❤ by underscore hacklab - https://autistici.org/underscore') +.epilog('Made with ❤ by underscore hacklab - https://gancio.org') .argv diff --git a/server/dbconfig.js b/server/dbconfig.js index bb477ea6..e307ec3c 100644 --- a/server/dbconfig.js +++ b/server/dbconfig.js @@ -1,3 +1,3 @@ const config = require('config') -modules.exports = config.db +module.exports = config.db