@evanp/activitypub-bot 0.11.0 → 0.12.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/Dockerfile +7 -8
- package/{activitypub-bot.js → bin/activitypub-bot.js} +2 -2
- package/lib/index.js +3 -0
- package/package.json +3 -3
- package/tests/index.test.js +10 -0
package/Dockerfile
CHANGED
|
@@ -6,13 +6,12 @@ RUN apk add --no-cache libstdc++ sqlite sqlite-libs
|
|
|
6
6
|
|
|
7
7
|
ARG PACKAGE_VERSION
|
|
8
8
|
|
|
9
|
-
ENV DATABASE_URL
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
ENV DATABASE_URL=
|
|
10
|
+
ENV ORIGIN=
|
|
11
|
+
ENV PORT=
|
|
12
|
+
ENV BOTS_CONFIG_FILE=
|
|
13
|
+
ENV LOG_LEVEL=
|
|
14
14
|
|
|
15
|
-
RUN npm
|
|
16
|
-
&& npm install --omit=dev @evanp/activitypub-bot@${PACKAGE_VERSION:-latest}
|
|
15
|
+
RUN npm install -g @evanp/activitypub-bot@${PACKAGE_VERSION:-latest}
|
|
17
16
|
|
|
18
|
-
CMD ["
|
|
17
|
+
CMD ["activitypub-bot"]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { parseArgs } from 'node:util'
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
5
|
import { dirname, resolve } from 'node:path'
|
|
6
|
-
import { makeApp } from '
|
|
6
|
+
import { makeApp } from '../lib/app.js'
|
|
7
7
|
|
|
8
8
|
const { values } = parseArgs({
|
|
9
9
|
options: {
|
|
@@ -39,7 +39,7 @@ const parsePort = (value) => {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const baseDir = dirname(fileURLToPath(import.meta.url))
|
|
42
|
-
const DEFAULT_BOTS_CONFIG_FILE = resolve(baseDir, 'bots', 'index.js')
|
|
42
|
+
const DEFAULT_BOTS_CONFIG_FILE = resolve(baseDir, '..', 'bots', 'index.js')
|
|
43
43
|
|
|
44
44
|
const DATABASE_URL = normalize(values['database-url']) || process.env.DATABASE_URL || 'sqlite::memory:'
|
|
45
45
|
const ORIGIN = normalize(values.origin) || process.env.ORIGIN || 'https://activitypubbot.test'
|
package/lib/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evanp/activitypub-bot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "server-side ActivityPub bot framework",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "lib/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"activitypub-bot": "./activitypub-bot.js"
|
|
8
|
+
"activitypub-bot": "./bin/activitypub-bot.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "NODE_ENV=test node --test",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { describe, it } from 'node:test'
|
|
3
|
+
describe('package exports', () => {
|
|
4
|
+
it('exposes Bot, BotFactory, and makeApp', async () => {
|
|
5
|
+
const { Bot, BotFactory, makeApp } = await import('../lib/index.js')
|
|
6
|
+
assert.equal(typeof Bot, 'function')
|
|
7
|
+
assert.equal(typeof BotFactory, 'function')
|
|
8
|
+
assert.equal(typeof makeApp, 'function')
|
|
9
|
+
})
|
|
10
|
+
})
|