-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2149 from dolthub/taylor/integration
Add dependabot and CI to integrations
- Loading branch information
Showing
7 changed files
with
1,682 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/packages/dolt/integrations" | ||
schedule: | ||
interval: monthly | ||
time: "06:30" | ||
timezone: America/Los_Angeles | ||
open-pull-requests-limit: 5 | ||
reviewers: | ||
- liuliu-dev | ||
labels: | ||
- dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Run CI on dolt/integration | ||
on: | ||
pull_request: | ||
paths: | ||
- "packages/dolt/integration/**" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ci-integration-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
- name: Install and run CI | ||
working-directory: ./packages/dolt/integration | ||
run: | | ||
yarn | ||
yarn run ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
{ | ||
"name": "embedDoltHubSQL", | ||
"name": "embed-dolthub-sql", | ||
"private": true, | ||
"scripts": { | ||
"ci": "yarn ignore-node-modules && yarn typecheck && yarn lint", | ||
"ignore-node-modules": "sh ./ts-ignore-node-modules.sh", | ||
"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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,68 @@ | ||
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) => { | ||
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], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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"' _ {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"extends": "@gitbook/tsconfig/integration.json", | ||
"compilerOptions": { | ||
"lib": ["ES6", "DOM"] | ||
"lib": ["ES6", "DOM"], | ||
"skipLibCheck": true, | ||
} | ||
} |
Oops, something went wrong.