Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
basehub
šŖJavaScript / TypeScript SDK for BaseHub, a very fast headless cms.
Features:
fetch
is supported... meaning you can use it anywhere.npm i basehub
# .env
BASEHUB_URL="https://basehub.com/<team-slug>/<repo-slug>/graphql?token=<read-token>"
# or disambiguated
BASEHUB_TEAM="<team-slug>"
BASEHUB_REPO="<repo-slug>"
BASEHUB_TOKEN="<read-token>"
š” Get your read token from the Connect panel: https://basehub.com/<team-slug>/<repo-slug>/connect
npx run basehub
āļø Important: make sure you run the generator before your app's build step. A common pattern is to run it in your postinstall script.
This example uses Next.js, but you can use any JavaScript framework.
// app/page.tsx
import { basehub } from "basehub";
const Page = async () => {
const firstQuery = await basehub().query({
__typename: true,
});
return <pre>{JSON.stringify(firstQuery, null, 2)}</pre>;
};
export default Page;
--output
By default, basehub
will generate the SDK inside node_modules/basehub/dist/generated-client
. While this is a good default as it allows you to quickly get started, this approach modifies node_modules
which, depending on your setup, might result in IDE or build pipeline issues. If this happens, please report the issue!
Additionally, you might want to connect to more than one BaseHub Repository.
To solve this, basehub
supports an --output
argument that specifies the directory in which the SDK will be generated. You then can use this directory to import generated stuff. For example: running basehub --output .basehub
will generate the SDK in a new .basehub
directory in the root of your project. You can then import { basehub } from '../<path>/.basehub'
and use the SDK normally.
We recommend including the new --output
directory to .gitignore
, as these generated files are not precisely relevant to Git, but that's up to you and shouldn't affect the SDK's behavior.
The basehub
sdk is generated with GenQL (read their docs). Thank you Morse for creating such a great package.
FAQs
A very fast Headless CMS.
The npm package basehub receives a total of 21,622 weekly downloads. As such, basehub popularity was classified as popular.
We found that basehub demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.