Skip to content

Commit

Permalink
Merge pull request #2 from ubiquity/miniflare
Browse files Browse the repository at this point in the history
Miniflare
  • Loading branch information
0x4007 authored Jan 15, 2024
2 parents c673016 + 6eb27ec commit 516c1e4
Show file tree
Hide file tree
Showing 23 changed files with 635,114 additions and 877 deletions.
2 changes: 2 additions & 0 deletions .dev.vars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WEBHOOK_PROXY_URL=https://smee.io/new
WEBHOOK_SECRET=xxxxxx
1 change: 0 additions & 1 deletion .env.example

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"rules": {
"prefer-arrow-callback": ["warn", { "allowNamedFunctions": true }], // Disallow arrow functions as expressions
"func-style": ["warn", "declaration", { "allowArrowFunctions": false }], // Disallow the use of function expressions
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/naming-convention": [
"error",
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.yarn/
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"singleQuote": false,
"htmlWhitespaceSensitivity": "strict",
"plugins": [],
"printWidth": 140
}
"printWidth": 140,
"useTabs": false
}
6 changes: 1 addition & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
"recommendations": ["arcanis.vscode-zipfs", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"cSpell.words": ["smee"]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# @ubiquity/ubiquibot-kernel

This is a research project to set up the bot without Probot as a dependency. This way we can deploy to Cloudflare Workers, and have it handle instant tasks/responses.
This is a research project to set up the bot without Probot as a dependency. This way we can deploy to Cloudflare Workers, and have it handle instant tasks/responses.

The kernel is designed to interface with plugins (GitHub Actions) for longer running processes.
The kernel is designed to interface with plugins (GitHub Actions) for longer running processes.
2 changes: 1 addition & 1 deletion build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import esbuild from "esbuild";
const typescriptEntries = ["static/main.ts"];
const typescriptEntries = ["src/worker.ts"];
// const cssEntries = ["static/style.css"];
const entries = [
...typescriptEntries,
Expand Down
15 changes: 15 additions & 0 deletions generate-ajv-validation-function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const fs = require("fs");
const path = require("path");
const Ajv = require("ajv");
const standaloneCode = require("ajv/dist/standalone").default;
const SCHEMA = require("@octokit/webhooks-schemas");
const addFormats = require("ajv-formats");

const ajv = new Ajv({ code: { source: true, esm: true } });
addFormats(ajv);
ajv.addKeyword("tsAdditionalProperties");
const validate = ajv.compile(SCHEMA);
let moduleCode = standaloneCode(ajv, validate);

// Now you can write the module code to file
fs.writeFileSync(path.join(__dirname, "./src/github-event-validator.mjs"), moduleCode);
136 changes: 71 additions & 65 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,73 @@
{
"name": "ubiquibot-worker",
"version": "0.0.0",
"private": true,
"description": "Template repository with TypeScript support.",
"main": "build/index.ts",
"author": "Ubiquity DAO",
"license": "MIT",
"engines": {
"node": ">=20.10.0"
},
"scripts": {
"start": "tsx build/esbuild-server.ts",
"build": "tsx build/esbuild-build.ts",
"format": "run-s format:prettier format:lint",
"format:lint": "eslint --fix .",
"format:prettier": "prettier --write .",
"prepare": "husky install",
"deploy": "wrangler deploy",
"dev": "wrangler dev"
},
"keywords": [
"typescript",
"template",
"dao",
"ubiquity",
"open-source"
],
"dependencies": {
"@octokit/webhooks": "^12.0.10",
"create-cloudflare": "^2.8.3",
"dotenv": "^16.3.1",
"smee-client": "^2.0.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20231121.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"esbuild": "^0.19.10",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.3",
"knip": "^3.3.0",
"lint-staged": "^15.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"tsx": "^4.6.2",
"typescript": "^5.0.4",
"wrangler": "^3.0.0"
},
"lint-staged": {
"*.ts": [
"prettier --write",
"eslint --fix"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"packageManager": "yarn@4.0.2"
"name": "ubiquibot-worker",
"version": "0.0.0",
"private": true,
"description": "Template repository with TypeScript support.",
"main": "build/index.ts",
"author": "Ubiquity DAO",
"license": "MIT",
"engines": {
"node": ">=20.10.0"
},
"scripts": {
"format": "run-s format:prettier format:lint",
"format:lint": "eslint --fix .",
"format:prettier": "prettier --write .",
"prepare": "husky install",
"deploy": "wrangler deploy",
"dev": "wrangler dev --port 8787",
"proxy": "tsx src/proxy.ts",
"generate": "node ./generate-ajv-validation-function.js"
},
"keywords": [
"typescript",
"template",
"dao",
"ubiquity",
"open-source"
],
"dependencies": {
"@octokit/webhooks": "^12.0.10",
"@octokit/webhooks-schemas": "^7.3.1",
"@octokit/webhooks-types": "^7.3.1",
"@sinclair/typebox": "^0.32.5",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"create-cloudflare": "^2.8.3",
"octokit": "^3.1.2",
"smee-client": "^2.0.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20231121.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@types/node": "^20.11.1",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"dotenv": "^16.3.1",
"esbuild": "^0.19.10",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.3",
"knip": "^3.3.0",
"lint-staged": "^15.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"tsx": "^4.6.2",
"typescript": "^5.0.4",
"wrangler": "^3.22.3"
},
"lint-staged": {
"*.ts": [
"prettier --write",
"eslint --fix"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"packageManager": "yarn@4.0.2"
}
32 changes: 0 additions & 32 deletions src/cloudflare-worker/index.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/cloudflare-worker/work-in-progress-worker.ts

This file was deleted.

Loading

0 comments on commit 516c1e4

Please sign in to comment.