Skip to content

Commit 7e443f2

Browse files
authored
Merge pull request #2149 from dolthub/taylor/integration
Add dependabot and CI to integrations
2 parents d593c0f + da1e855 commit 7e443f2

File tree

7 files changed

+1682
-516
lines changed

7 files changed

+1682
-516
lines changed

.github/dependabot.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/packages/dolt/integrations"
5+
schedule:
6+
interval: monthly
7+
time: "06:30"
8+
timezone: America/Los_Angeles
9+
open-pull-requests-limit: 5
10+
reviewers:
11+
- liuliu-dev
12+
labels:
13+
- dependencies
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run CI on dolt/integration
2+
on:
3+
pull_request:
4+
paths:
5+
- "packages/dolt/integration/**"
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ci-integration-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
ci:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: "18"
21+
- name: Install and run CI
22+
working-directory: ./packages/dolt/integration
23+
run: |
24+
yarn
25+
yarn run ci
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
{
2-
"name": "embedDoltHubSQL",
2+
"name": "embed-dolthub-sql",
33
"private": true,
44
"scripts": {
5+
"ci": "yarn ignore-node-modules && yarn typecheck && yarn lint",
6+
"ignore-node-modules": "sh ./ts-ignore-node-modules.sh",
57
"lint": "eslint ./**/*.ts*",
68
"typecheck": "tsc --noEmit",
79
"publish-integrations": "gitbook publish .",
810
"publish-integrations-staging": "gitbook publish ."
911
},
1012
"devDependencies": {
13+
"@cloudflare/workers-types": "latest",
14+
"@gitbook/api": "*",
1115
"@gitbook/cli": "^0.9.0",
16+
"@gitbook/eslint-config": "^0.1.0",
1217
"@gitbook/runtime": "latest",
13-
"@cloudflare/workers-types": "latest",
1418
"@gitbook/tsconfig": "latest",
15-
"@gitbook/api": "*"
19+
"eslint": "^8",
20+
"typescript": "^5.4.5"
1621
}
1722
}
Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,68 @@
11
import {
2-
FetchEventCallback,
3-
RuntimeContext,
4-
RuntimeEnvironment,
5-
createComponent,
6-
createIntegration,
7-
} from "@gitbook/runtime";
2+
FetchEventCallback,
3+
RuntimeContext,
4+
RuntimeEnvironment,
5+
createComponent,
6+
createIntegration,
7+
} from '@gitbook/runtime';
88

99
interface EmbedDoltHubSQLConfiguration {}
1010

11-
type EmbedDoltHubSQLRuntimeEnvironment =
12-
RuntimeEnvironment<EmbedDoltHubSQLConfiguration>;
13-
type EmbedDoltHubSQLRuntimeContext =
14-
RuntimeContext<EmbedDoltHubSQLRuntimeEnvironment>;
11+
type EmbedDoltHubSQLRuntimeEnvironment = RuntimeEnvironment<EmbedDoltHubSQLConfiguration>;
12+
type EmbedDoltHubSQLRuntimeContext = RuntimeContext<EmbedDoltHubSQLRuntimeEnvironment>;
1513

16-
const handleFetchEvent: FetchEventCallback<
17-
EmbedDoltHubSQLRuntimeContext
18-
> = async (request, context) => {
19-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
20-
const { api } = context;
21-
const user = api.user.getAuthenticatedUser();
14+
const handleFetchEvent: FetchEventCallback<EmbedDoltHubSQLRuntimeContext> = async (_, context) => {
15+
const { api } = context;
16+
const user = api.user.getAuthenticatedUser();
2217

23-
return new Response(JSON.stringify(user));
18+
return new Response(JSON.stringify(user));
2419
};
2520

2621
/**
27-
* Component to render the block when embeding an DoltHub URL.
22+
* Component to render the block when embedding an DoltHub URL.
2823
*/
29-
const embedBlock = createComponent<{
30-
url?: string;
31-
}>({
32-
componentId: "embed",
24+
type Props = {
25+
url: string;
26+
};
27+
28+
const embedBlock = createComponent<Props>({
29+
componentId: 'embed',
3330

34-
async action(element, action) {
35-
switch (action.action) {
36-
case "@link.unfurl": {
37-
const { url } = action;
31+
async action(element, action) {
32+
// @ts-ignore
33+
switch (action.action) {
34+
case '@link.unfurl': {
35+
// @ts-ignore
36+
const { url } = action;
3837

39-
return {
40-
props: {
41-
url,
42-
},
43-
};
44-
}
45-
}
38+
return {
39+
props: {
40+
url,
41+
},
42+
};
43+
}
44+
}
4645

47-
return element;
48-
},
46+
return element;
47+
},
4948

50-
async render(element, context) {
51-
const { url } = element.props;
52-
const aspectRatio = 16 / 9;
53-
return (
54-
<block>
55-
<webframe
56-
source={{
57-
url: url,
58-
}}
59-
aspectRatio={aspectRatio}
60-
/>
61-
</block>
62-
);
63-
},
49+
async render(element) {
50+
const { url } = element.props;
51+
const aspectRatio = 16 / 9;
52+
return (
53+
<block>
54+
<webframe
55+
source={{
56+
url,
57+
}}
58+
aspectRatio={aspectRatio}
59+
/>
60+
</block>
61+
);
62+
},
6463
});
6564

6665
export default createIntegration<EmbedDoltHubSQLRuntimeContext>({
67-
fetch: handleFetchEvent,
68-
components: [embedBlock],
66+
fetch: handleFetchEvent,
67+
components: [embedBlock],
6968
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
find node_modules -type f -name '*.ts' -exec sh -c 'echo "// @ts-nocheck" > /tmp/file.tmp && cat "$1" >> /tmp/file.tmp && mv /tmp/file.tmp "$1"' _ {} \;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "@gitbook/tsconfig/integration.json",
33
"compilerOptions": {
4-
"lib": ["ES6", "DOM"]
4+
"lib": ["ES6", "DOM"],
5+
"skipLibCheck": true,
56
}
67
}

0 commit comments

Comments
 (0)