Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miniflare #2

Merged
merged 8 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
54 changes: 27 additions & 27 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"ignorePatterns": ["**/*.js"],
"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-floating-promises": "error",
"@typescript-eslint/naming-convention": [
"error",
{ "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "variableLike", "format": ["camelCase"] },
{ "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" },
{ "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "should", "has", "can", "did", "will"] },
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "typeParameter", "format": ["PascalCase"], "prefix": ["T"] },
{ "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } },
{ "selector": ["function", "variable"], "format": ["camelCase"] },
{ "selector": "variable", "modifiers": ["destructured"], "format": null },
{ "selector": "variable", "format": ["camelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "has", "should", "can", "did", "will"] }
]
}
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"ignorePatterns": ["**/*.js"],
"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-floating-promises": "error",
"@typescript-eslint/naming-convention": [
"error",
{ "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "variableLike", "format": ["camelCase"] },
{ "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" },
{ "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "should", "has", "can", "did", "will"] },
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "typeParameter", "format": ["PascalCase"], "prefix": ["T"] },
{ "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } },
{ "selector": ["function", "variable"], "format": ["camelCase"] },
{ "selector": "variable", "modifiers": ["destructured"], "format": null },
{ "selector": "variable", "format": ["camelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "has", "should", "can", "did", "will"] }
]
}
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.yarn/
16 changes: 8 additions & 8 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"htmlWhitespaceSensitivity": "strict",
"plugins": [],
"printWidth": 140
}
"trailingComma": "es5",
"tabWidth": 2,
0x4007 marked this conversation as resolved.
Show resolved Hide resolved
"semi": true,
"singleQuote": false,
"htmlWhitespaceSensitivity": "strict",
"plugins": [],
"printWidth": 140
}
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"]
}
16 changes: 8 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
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.
18 changes: 9 additions & 9 deletions build/esbuild-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import esbuild from "esbuild";
import { esBuildContext } from "./esbuild-build";

(async () => {
await server();
await server();
})().catch((error) => {
console.error("Unhandled error:", error);
process.exit(1);
console.error("Unhandled error:", error);
process.exit(1);
});

export async function server() {
const _context = await esbuild.context(esBuildContext);
const { port } = await _context.serve({
servedir: "dist",
port: 8080,
});
console.log(`http://localhost:${port}`);
const _context = await esbuild.context(esBuildContext);
const { port } = await _context.serve({
servedir: "dist",
port: 8080,
});
console.log(`http://localhost:${port}`);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@cloudflare/workers-types": "^4.20231121.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@types/node": "^20.10.6",
"@types/node": "^20.11.1",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"dotenv": "^16.3.1",
Expand Down
633,904 changes: 633,903 additions & 1 deletion src/github-event-validator.mjs

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/research/examples/GitHubComment.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { PlaceHolder } from "./IssueCommentEventExample";

export interface GitHubComment {
url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/comments/1858754659";
html_url: "https://github.com/pavlovcik/ubiquibot-sandbox/issues/10#issuecomment-1858754659";
issue_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10";
id: 1858754659;
node_id: "IC_kwDOK2eNBc5uylhj";
user: PlaceHolder[];
created_at: "2023-12-16T07:59:54Z";
updated_at: "2023-12-16T07:59:54Z";
author_association: "OWNER";
body: "test";
reactions: PlaceHolder[];
performed_via_github_app: null;
url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/comments/1858754659";
html_url: "https://github.com/pavlovcik/ubiquibot-sandbox/issues/10#issuecomment-1858754659";
issue_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10";
id: 1858754659;
node_id: "IC_kwDOK2eNBc5uylhj";
user: PlaceHolder[];
created_at: "2023-12-16T07:59:54Z";
updated_at: "2023-12-16T07:59:54Z";
author_association: "OWNER";
body: "test";
reactions: PlaceHolder[];
performed_via_github_app: null;
}
4 changes: 2 additions & 2 deletions src/research/examples/GitHubInstallation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface GitHubInstallation {
id: 42230030;
node_id: "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNDIyMzAwMzA=";
id: 42230030;
node_id: "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNDIyMzAwMzA=";
}
56 changes: 28 additions & 28 deletions src/research/examples/GitHubIssue.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { PlaceHolder } from "./IssueCommentEventExample";

export interface GitHubIssue {
url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10";
repository_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox";
labels_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/labels{/name}";
comments_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/comments";
events_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/events";
html_url: "https://github.com/pavlovcik/ubiquibot-sandbox/issues/10";
id: 2044648858;
node_id: "I_kwDOK2eNBc553t2a";
number: 10;
title: "test";
user: PlaceHolder[];
labels: PlaceHolder[][];
state: "open";
locked: false;
assignee: null;
assignees: [];
milestone: null;
comments: 9;
created_at: "2023-12-16T07:37:46Z";
updated_at: "2023-12-16T07:59:55Z";
closed_at: null;
author_association: "OWNER";
active_lock_reason: null;
body: "test";
reactions: PlaceHolder[];
timeline_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/timeline";
performed_via_github_app: null;
state_reason: null;
url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10";
repository_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox";
labels_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/labels{/name}";
comments_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/comments";
events_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/events";
html_url: "https://github.com/pavlovcik/ubiquibot-sandbox/issues/10";
id: 2044648858;
node_id: "I_kwDOK2eNBc553t2a";
number: 10;
title: "test";
user: PlaceHolder[];
labels: PlaceHolder[][];
state: "open";
locked: false;
assignee: null;
assignees: [];
milestone: null;
comments: 9;
created_at: "2023-12-16T07:37:46Z";
updated_at: "2023-12-16T07:59:55Z";
closed_at: null;
author_association: "OWNER";
active_lock_reason: null;
body: "test";
reactions: PlaceHolder[];
timeline_url: "https://api.github.com/repos/pavlovcik/ubiquibot-sandbox/issues/10/timeline";
performed_via_github_app: null;
state_reason: null;
}
Loading