Skip to content

Gh app connector v2 from main #708

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions apps/zipper.dev/src/components/context/editor-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
} from '~/utils/playground.utils';
import { runZipperLinter } from '~/utils/zipper-editor-linter';
import { rewriteSpecifier } from '~/utils/rewrite-imports';
import { getFileExtension } from '~/utils/file-extension';

type OnValidate = AddParameters<
Required<EditorProps>['onValidate'],
Expand All @@ -56,6 +57,7 @@ export type EditorContextType = {
setModelIsDirty: (path: string, isDirty: boolean) => void;
isEditorDirty: () => boolean;
modelHasErrors: (path: string) => boolean;
getModelByFilename: (filename: string) => monaco.editor.ITextModel | null;
setModelHasErrors: (path: string, isErroring: boolean) => void;
editorHasErrors: () => boolean;
getErrorFiles: () => string[];
Expand Down Expand Up @@ -107,6 +109,7 @@ export const EditorContext = createContext<EditorContextType>({
setModelIsDirty: noop,
isEditorDirty: () => false,
modelHasErrors: () => false,
getModelByFilename: () => null,
setModelHasErrors: () => false,
editorHasErrors: () => false,
getErrorFiles: () => [],
Expand Down Expand Up @@ -698,6 +701,16 @@ const EditorContextProvider = ({
.filter(([, value]) => value)
.map(([filename]) => filename);

const getModelByFilename = (filename: string) => {
if (!monacoRef?.current || !editor) return null;
const uri = getUriFromPath(
`file:///${filename}`,
monacoRef.current.Uri.parse,
getFileExtension(filename) || 'tsx',
);
return editor.getModel(uri);
};

return (
<EditorContext.Provider
value={{
Expand All @@ -713,6 +726,7 @@ const EditorContextProvider = ({
setModelIsDirty,
isEditorDirty,
modelHasErrors,
getModelByFilename,
setModelHasErrors,
editorHasErrors,
getErrorFiles,
Expand Down
1 change: 1 addition & 0 deletions apps/zipper.dev/src/connectors/github-app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const code = `import { create, getNumericDate } from "https://deno.land/x
* to query GitHub's API.
**/

export const githubAppConnectorConfig: any = {};

/* Get the JWT for the app. This JWT is used to get an installation token. */
export function appJwt(): Promise<string> {
Expand Down
Loading