Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: build ts into js
on:
push:
branches:
- main
jobs:
deploy:
permissions:
contents: write
name: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_CONTENT_W }}
- name: install node v18
uses: actions/setup-node@v1
with:
node-version: 18
- name: yarn install
run: yarn install
- name: ts compile
run: yarn build
- name: useful files copy
run: |
cp -r .github/ build/
mkdir build/root/
cp package.json build/
cp yarn.lock build/
- name: Push
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: deploy
FOLDER: build
GITHUB_TOKEN: ${{ secrets.PAT_CONTENT_W }}
MESSAGE: "Build: ({sha}) {msg}"
35 changes: 35 additions & 0 deletions .github/workflows/check-ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: check-ts
on:
pull_request:
jobs:
ts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get diff lines
id: diff
uses: Equip-Collaboration/diff-line-numbers@v1.0.0
with:
include: '["\\.ts$"]'
- name: Detecting files changed
id: files
uses: umani/changed-files@v4.0.0
with:
repo-token: ${{ github.token }}
pattern: '^.*\.ts$'
- name: List files changed
run: |
echo 'Files modified: ${{steps.files.outputs.files_updated}}'
echo 'Files added: ${{steps.files.outputs.files_created}}'
echo 'Files removed: ${{steps.files.outputs.files_deleted}}'
- uses: snapshift/action-check-typescript@v1.1.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
use-check: true
check-fail-mode: added
files-changed: ${{steps.files.outputs.files_updated}}
files-added: ${{steps.files.outputs.files_created}}
files-deleted: ${{steps.files.outputs.files_deleted}}
line-numbers: ${{steps.diff.outputs.lineNumbers}}
output-behaviour: both
comment-behaviour: new
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Upload to Pi
on:
push:
branches:
- deploy
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
BITWISE_CORE_PATH: /var/www/bitwise-core/
steps:
- uses: actions/checkout@v4
- name: stop discord bot
uses: garygrossgarten/github-action-ssh@release
with:
command: /home/git/custom_scripts/discord-bot.stop
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
port: ${{ secrets.SSH_PORT }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
privateKey: ${{ secrets.SSH_KEY}}
- name: Deploy with SCP
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
source: "./*"
target: "$BITWISE_CORE_PATH/build"
- name: move root files to project's root and start discord bot
uses: garygrossgarten/github-action-ssh@release
with:
command: mv $BITWISE_CORE_PATH/build/root/* $BITWISE_CORE_PATH ; rm -r $BITWISE_CORE_PATH/build/root/ ; /home/git/custom_scripts/discord-bot.run
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
port: ${{ secrets.SSH_PORT }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
privateKey: ${{ secrets.SSH_KEY}}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git/
.vscode/
node_modules/
test/*
dist/*
!*/.gitkeep
.token
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# BitwiseCore
The discord bot of the bitwise corporation
*Bitwise Core is the discord bot of the [bitwise corporation](https://github.com/Bitwise-re).*

[![License](https://img.shields.io/badge/License-BSD_3--Clause-orange.svg)](https://opensource.org/licenses/BSD-3-Clause)
<!-- ![deploy](https://github.com/Bitwise-re/BitwiseCore/actions/workflows/deploy.yml/badge.svg) -->
Empty file added build/.gitkeep
Empty file.
Empty file added global.todo
Empty file.
36 changes: 36 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "bitwise-core",
"version": "1.0.0",
"description": "Bitwise Corporation's discord bot",
"main": "build/index.js",
"scripts": {
"getDependencies": "yarn install",
"testJs": "node test/test.js",
"testTs": "yarn tsx test/test.ts",
"build": "yarn getDependencies && yarn check && tsc -p .",
"tsStart": "yarn getDependencies && yarn tsx src/index.ts",
"jsStart": "yarn getDependencies && node build/index.js",
"checkCode": "tsc --noEmit --skipLibCheck"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Bitwise-re/BitwiseCore"
},
"type": "module",
"author": "Bitwise Corporation",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/Bitwise-re/BitwiseCore/issues"
},
"homepage": "https://github.com/Bitwise-re/BitwiseCore#readme",
"dependencies": {
"discord.js": "^14.14.1",
"prompt": "^1.3.0"
},
"devDependencies": {
"@types/node": "^20.11.20",
"@types/request": "^2.48.12",
"tsx": "^4.19.2",
"typescript": "^5.3.3"
}
}
13 changes: 13 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as readline from "readline/promises";

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

console.log("Hello World");

while (true) {
const answer = await rl.question("");
console.log(answer);
}
Empty file added test/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"rootDir": "./src/",
"outDir": "./build/",
"strict": true,
"moduleResolution": "node10",
"importHelpers": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"removeComments": true,
"typeRoots": [
"node_modules/@types"
],
"sourceMap": false,
"baseUrl": "./"
},
"files": [
"src/index.ts"
],
"include": [
"./**/*.ts"
],
"exclude": [
"node_modules",
"build",
"test"
],
}
Loading
Loading