Browse Source

Starting conversion to typescript

develop
Drew Short 5 years ago
parent
commit
900cab5e59
  1. 3
      .dockerignore
  2. 3
      .gitignore
  3. 16
      Dockerfile
  4. 6
      index.js
  5. 6
      package-lock.json
  6. 6
      package.json
  7. 0
      src/bot.js
  8. 0
      src/config.js
  9. 0
      src/engine.js
  10. 0
      src/logging.js
  11. 0
      src/message.js
  12. 0
      src/module/abstract.js
  13. 0
      src/module/admin.js
  14. 0
      src/module/example.js
  15. 0
      src/module/giphy.js
  16. 0
      src/module/help.js
  17. 0
      src/module/index.js
  18. 0
      src/module/szurubooru/client.js
  19. 0
      src/module/szurubooru/index.js
  20. 0
      src/utility.js
  21. 13
      tsconfig.json

3
.dockerignore

@ -1,6 +1,9 @@
# Installed node files # Installed node files
node_modules/ node_modules/
# Compiled Files
dist/
# Logging files # Logging files
log/ log/

3
.gitignore

@ -1,6 +1,9 @@
# Node Files # Node Files
node_modules/ node_modules/
# Compiled Files
dist/
# Config files # Config files
data/*config.json data/*config.json

16
Dockerfile

@ -1,16 +1,26 @@
FROM node:12.14-stretch
FROM node:12.14-stretch AS builder
WORKDIR /opt/baphomet
COPY . /opt/baphomet
RUN cd /opt/baphomet \
&& npm install \
&& npm run build
FROM node:12.14-stretch
WORKDIR /opt/baphomet
COPY . /opt/baphomet COPY . /opt/baphomet
ENV NODE_ENV=production ENV NODE_ENV=production
ENV LOG_LEVEL=warn ENV LOG_LEVEL=warn
RUN mkdir /opt/baphomet/log
RUN rm -rf /opt/baphomet/src \
&& mkdir /opt/baphomet/log
COPY --from=builder /opt/baphomet/dist /opt/baphomet/dist
RUN cd /opt/baphomet \ RUN cd /opt/baphomet \
&& npm install --only=prod \ && npm install --only=prod \
&& chmod +x entrypoint.sh && chmod +x entrypoint.sh
WORKDIR /opt/baphomet
ENTRYPOINT [ "./entrypoint.sh" ] ENTRYPOINT [ "./entrypoint.sh" ]
CMD [ "run" ] CMD [ "run" ]

6
index.js

@ -1,6 +1,6 @@
let bot = require('./bot/bot');
let { getConfig } = require('./bot/config');
let engine = require('./bot/engine');
let bot = require('./dist/bot');
let { getConfig } = require('./dist/config');
let engine = require('./dist/engine');
let config = getConfig(process.env.NODE_PATH + "/data/config.json", ['accessToken']) let config = getConfig(process.env.NODE_PATH + "/data/config.json", ['accessToken'])

6
package-lock.json

@ -1272,6 +1272,12 @@
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
}, },
"typescript": {
"version": "3.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz",
"integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==",
"dev": true
},
"unhomoglyph": { "unhomoglyph": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/unhomoglyph/-/unhomoglyph-1.0.3.tgz", "resolved": "https://registry.npmjs.org/unhomoglyph/-/unhomoglyph-1.0.3.tgz",

6
package.json

@ -7,7 +7,8 @@
"description": "A Matrix bot written on top of the matrix-js-sdk", "description": "A Matrix bot written on top of the matrix-js-sdk",
"repository": "https://git.nulloctet.com/warricksothr/baphomet-js", "repository": "https://git.nulloctet.com/warricksothr/baphomet-js",
"scripts": { "scripts": {
"test": "mocha"
"test": "mocha",
"build": "tsc"
}, },
"dependencies": { "dependencies": {
"axios": "^0.19.0", "axios": "^0.19.0",
@ -17,6 +18,7 @@
"winston": "^3.2.1" "winston": "^3.2.1"
}, },
"devDependencies": { "devDependencies": {
"mocha": "^6.2.2"
"mocha": "^6.2.2",
"typescript": "^3.7.4"
} }
} }

0
bot/bot.js → src/bot.js

0
bot/config.js → src/config.js

0
bot/engine.js → src/engine.js

0
bot/logging.js → src/logging.js

0
bot/message.js → src/message.js

0
bot/module/abstract.js → src/module/abstract.js

0
bot/module/admin.js → src/module/admin.js

0
bot/module/example.js → src/module/example.js

0
bot/module/giphy.js → src/module/giphy.js

0
bot/module/help.js → src/module/help.js

0
bot/module/index.js → src/module/index.js

0
bot/module/szurubooru/client.js → src/module/szurubooru/client.js

0
bot/module/szurubooru/index.js → src/module/szurubooru/index.js

0
bot/utility.js → src/utility.js

13
tsconfig.json

@ -0,0 +1,13 @@
{
"compilerOptions": {
"outDir": "./dist",
"allowJs": true,
"target": "ES2015",
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"./src/**/*"
]
}
Loading…
Cancel
Save