Skip to content

Commit 39c6e81

Browse files
committed
Lots of changes
1 parent 8b584f2 commit 39c6e81

22 files changed

+1027
-271
lines changed

.dockerignore

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
node_modules/
2-
lib/
3-
tests/
1+
.github/
2+
*.pem
43
config.yml
4+
lib/
5+
node_modules/
56
public/
6-
.github/
7-
logging.txt
7+
registration.yml
8+
tests/
89
tsconfig.tsbuildinfo
9-
*.pem
10-
registration.yml
10+
11+
# Added by cargo
12+
/target

.gitignore

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
node_modules/
2-
lib/
3-
4-
config.yml
51
*.pem
2+
config.yml
3+
lib/
4+
node_modules/
5+
public/
66
registration.yml
77
tsconfig.tsbuildinfo
88

9-
public/
9+
# Added by cargo
10+
/target

Cargo.lock

+223
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "matrix-github"
3+
version = "0.0.1"
4+
edition = "2018"
5+
6+
[lib]
7+
crate-type = ["cdylib"]
8+
9+
[dependencies]
10+
napi = {version="1", features=["serde-json"]}
11+
napi-derive = "1"
12+
url = "2"
13+
serde_json = "1"
14+
serde = "1"
15+
serde_derive = "*"
16+
17+
[build-dependencies]
18+
napi-build = "1"

Dockerfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Stage 0: Build the thing
2-
FROM node:16-alpine AS builder
2+
# Need debian based image to make node happy
3+
FROM node:16 AS builder
34

45
COPY . /src
56
WORKDIR /src
67

8+
RUN apk add rustup
9+
RUN rustup-init -y --target x86_64-unknown-linux-gnu
10+
ENV PATH="/root/.cargo/bin:${PATH}"
11+
12+
713
# will also build
8-
RUN yarn
14+
RUN yarn
915

1016
# Stage 1: The actual container
1117
FROM node:16-alpine

build.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extern crate napi_build;
2+
3+
fn main() {
4+
napi_build::setup();
5+
}

package.json

+10-4
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@
77
"author": "Half-Shot",
88
"license": "MIT",
99
"private": false,
10+
"napi": {
11+
"name": "matrix-github-rs"
12+
},
1013
"scripts": {
1114
"build:web": "snowpack build",
1215
"build:app": "tsc --project tsconfig.json",
16+
"build:app:rs": "napi build --release ./lib",
1317
"dev:web": "snowpack dev",
14-
"build": "yarn run build:web && yarn run build:app",
18+
"build": "yarn run build:web && yarn run build:app:rs && yarn run build:app",
1519
"prepare": "yarn build",
1620
"start": "node --require source-map-support/register lib/App/BridgeApp.js",
1721
"start:app": "node --require source-map-support/register lib/App/BridgeApp.js",
1822
"start:webhooks": "node --require source-map-support/register lib/App/GithubWebhookApp.js",
1923
"start:matrixsender": "node --require source-map-support/register lib/App/MatrixSenderApp.js",
20-
"test": "mocha -r ts-node/register tests/*.ts",
24+
"test": "mocha -r ts-node/register tests/*.ts tests/**/*.ts",
2125
"lint": "eslint -c .eslintrc.js src/**/*.ts",
2226
"generate-default-config": "node lib/Config/Defaults.js --config > config.sample.yml"
2327
},
2428
"dependencies": {
29+
"@node-rs/helper": "^1.2.1",
2530
"@octokit/auth-app": "^3.3.0",
2631
"@octokit/auth-token": "^2.4.5",
2732
"@octokit/rest": "^18.10.0",
@@ -47,6 +52,7 @@
4752
},
4853
"devDependencies": {
4954
"@fontsource/open-sans": "^4.2.2",
55+
"@napi-rs/cli": "^1.3.5",
5056
"@prefresh/snowpack": "^3.1.2",
5157
"@snowpack/plugin-typescript": "^1.2.1",
5258
"@types/chai": "^4.2.16",
@@ -57,14 +63,14 @@
5763
"@types/micromatch": "^4.0.1",
5864
"@types/mime": "^2.0.3",
5965
"@types/mocha": "^8.2.2",
60-
"@types/node": "^12",
6166
"@types/node-emoji": "^1.8.1",
67+
"@types/node": "^12",
6268
"@types/uuid": "^8.3.0",
6369
"@typescript-eslint/eslint-plugin": "^4.21.0",
6470
"@typescript-eslint/parser": "^4.21.0",
6571
"chai": "^4.3.4",
66-
"eslint": "^7.24.0",
6772
"eslint-plugin-mocha": "^8.1.0",
73+
"eslint": "^7.24.0",
6874
"mini.css": "^3.0.1",
6975
"preact": "^10.5.13",
7076
"snowpack": "^3.2.2",

0 commit comments

Comments
 (0)