Skip to content

Commit

Permalink
dolt/integration: Try to get CI working
Browse files Browse the repository at this point in the history
  • Loading branch information
tbantle22 committed Apr 24, 2024
1 parent d593c0f commit 642b78b
Show file tree
Hide file tree
Showing 4 changed files with 1,646 additions and 517 deletions.
10 changes: 7 additions & 3 deletions packages/dolt/integration/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
{
"name": "embedDoltHubSQL",
"name": "embed-dolthub-sql",
"private": true,
"scripts": {
"ci": "yarn typecheck && yarn lint",
"lint": "eslint ./**/*.ts*",
"typecheck": "tsc --noEmit",
"publish-integrations": "gitbook publish .",
"publish-integrations-staging": "gitbook publish ."
},
"devDependencies": {
"@cloudflare/workers-types": "latest",
"@gitbook/api": "*",
"@gitbook/cli": "^0.9.0",
"@gitbook/eslint-config": "^0.1.0",
"@gitbook/runtime": "latest",
"@cloudflare/workers-types": "latest",
"@gitbook/tsconfig": "latest",
"@gitbook/api": "*"
"eslint": "^8",
"typescript": "^5.4.5"
}
}
102 changes: 51 additions & 51 deletions packages/dolt/integration/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
import {
FetchEventCallback,
RuntimeContext,
RuntimeEnvironment,
createComponent,
createIntegration,
} from "@gitbook/runtime";
FetchEventCallback,
RuntimeContext,
RuntimeEnvironment,
createComponent,
createIntegration,
} from '@gitbook/runtime';

interface EmbedDoltHubSQLConfiguration {}

type EmbedDoltHubSQLRuntimeEnvironment =
RuntimeEnvironment<EmbedDoltHubSQLConfiguration>;
type EmbedDoltHubSQLRuntimeContext =
RuntimeContext<EmbedDoltHubSQLRuntimeEnvironment>;
type EmbedDoltHubSQLRuntimeEnvironment = RuntimeEnvironment<EmbedDoltHubSQLConfiguration>;
type EmbedDoltHubSQLRuntimeContext = RuntimeContext<EmbedDoltHubSQLRuntimeEnvironment>;

const handleFetchEvent: FetchEventCallback<
EmbedDoltHubSQLRuntimeContext
> = async (request, context) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { api } = context;
const user = api.user.getAuthenticatedUser();
const handleFetchEvent: FetchEventCallback<EmbedDoltHubSQLRuntimeContext> = async (_, context) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { api } = context;
const user = api.user.getAuthenticatedUser();

return new Response(JSON.stringify(user));
return new Response(JSON.stringify(user));
};

/**
* Component to render the block when embeding an DoltHub URL.
* Component to render the block when embedding an DoltHub URL.
*/
const embedBlock = createComponent<{
url?: string;
}>({
componentId: "embed",
type Props = {
url: string;
};

const embedBlock = createComponent<Props>({
componentId: 'embed',

async action(element, action) {
switch (action.action) {
case "@link.unfurl": {
const { url } = action;
async action(element, action) {
// @ts-ignore
switch (action.action) {
case '@link.unfurl': {
// @ts-ignore
const { url } = action;

return {
props: {
url,
},
};
}
}
return {
props: {
url,
},
};
}
}

return element;
},
return element;
},

async render(element, context) {
const { url } = element.props;
const aspectRatio = 16 / 9;
return (
<block>
<webframe
source={{
url: url,
}}
aspectRatio={aspectRatio}
/>
</block>
);
},
async render(element) {
const { url } = element.props;
const aspectRatio = 16 / 9;
return (
<block>
<webframe
source={{
url,
}}
aspectRatio={aspectRatio}
/>
</block>
);
},
});

export default createIntegration<EmbedDoltHubSQLRuntimeContext>({
fetch: handleFetchEvent,
components: [embedBlock],
fetch: handleFetchEvent,
components: [embedBlock],
});
7 changes: 5 additions & 2 deletions packages/dolt/integration/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "@gitbook/tsconfig/integration.json",
"compilerOptions": {
"lib": ["ES6", "DOM"]
}
"lib": ["ES6", "DOM"],
"skipLibCheck": true
},
"include": ["src/*"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit 642b78b

Please sign in to comment.