diff --git a/bin/gitlab-radiator b/bin/gitlab-radiator deleted file mode 100755 index 9142955..0000000 --- a/bin/gitlab-radiator +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node - -process.env.NODE_ENV = 'production' - -const path = require('path') -require(path.join(__dirname, '..', 'src', 'app')) diff --git a/bin/gitlab-radiator.js b/bin/gitlab-radiator.js new file mode 100755 index 0000000..9543815 --- /dev/null +++ b/bin/gitlab-radiator.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node + +process.env.NODE_ENV = 'production' + +const {runUpdate} = await import('../src/app.js') +await runUpdate() diff --git a/package.json b/package.json index 0a969ab..d12cad6 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "version": "4.1.1", "license": "MIT", "bin": { - "gitlab-radiator": "bin/gitlab-radiator" + "gitlab-radiator": "bin/gitlab-radiator.js" }, "scripts": { "build": "./build-npm", diff --git a/src/app.js b/src/app.js index 2f0c4cc..549b189 100644 --- a/src/app.js +++ b/src/app.js @@ -43,7 +43,7 @@ socketIoServer.on('connection', (socket) => { socket.emit('state', withDate(globalState)) }) -async function runUpdate() { +export async function runUpdate() { try { globalState.projects = await update(config) globalState.error = await errorIfRunnerOffline() @@ -74,8 +74,6 @@ async function errorIfRunnerOffline() { return null } -runUpdate() - function withDate(state) { return { ...state,