package
Welcome! This package supports local development of custom GitHub Blocks.
npm install @githubnext/blocksGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Welcome! This package supports local development of custom GitHub Blocks.
Using the blocks command, you can run the following commands:
start - Starts a local development environment and builds Blocks bundles.build - Builds Blocks bundles.To reduce the cognitive load associated with writing file and folder block components, we've assembled a helper library that exposes interface definitions and a few helper functions.
yarn add @githubnext/blocks
import {
FileBlockProps,
FolderBlockProps,
getLanguageFromFilename,
getNestedFileTree,
} from '@githubnext/blocks`import { FileBlockProps } from '@githubnext/blocks';
export default function (props: FileBlockProps) {
const { content, metadata, onUpdateMetadata } = props;
...
}import { FolderBlockProps } from '@githubnext/blocks';
export default function (props: FileBlockProps) {
const { tree, metadata, onUpdateMetadata, BlockComponent } = props;
...
}A helper function that returns the "language" of a file, given a valid file path with extension.
A helper function to turn the flat folder tree array into a nested tree structure
import { FolderBlockProps, getNestedFileTree, } from "@githubnext/blocks";
export default function (props: FolderBlockProps) {
const { tree, onNavigateToPath } = props;
const data = useMemo(() => {
const nestedTree = getNestedFileTree(tree)[0]
return nestedTree
}, [tree])
...
}terkelg
terkel@terkel.com
Estimated unpacked size across 65 packages.
35.3 MB+
Includes dependencies.
^2.6.2
3.10.1
^7.0.3
7.0.6
^3.39.0
3.39.3
^35.15.1
38.46.0
^8.0.3
1000.0.0
^6.0.0
18.0.0
^4.0.1
4.0.1
^3.0.0
3.0.0
^2.2.6
2.2.6
^5.3.5
6.6.0
^5.15.0
5.16.7
^3.0.1
6.3.0
^3.1.4
6.1.6
^12.11.0
29.0.1
^17.3.0
19.42.0
^1.0.1
2.3.0