Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@githubnext/blocks

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@githubnext/blocks

Welcome! This package supports local development of custom GitHub Blocks.

  • 2.3.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

blocks

Welcome! This package supports local development of custom GitHub Blocks.

Scripts

Using the blocks command, you can run the following commands:

  • start - Starts a local development environment and builds Blocks bundles.
  • build - Builds Blocks bundles.

Utility functions

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.

How to use

yarn add @githubnext/blocks

import {
  FileBlockProps,
  FolderBlockProps,
  getLanguageFromFilename,
  getNestedFileTree,
} from '@githubnext/blocks`

FileBlockProps

import { FileBlockProps } from '@githubnext/blocks';

export default function (props: FileBlockProps) {
  const { content, metadata, onUpdateMetadata } = props;
  ...
}

FolderBlockProps

import { FolderBlockProps } from '@githubnext/blocks';

export default function (props: FileBlockProps) {
  const { tree, metadata, onUpdateMetadata, BlockComponent } = props;
  ...
}

getLanguageFromFilename

A helper function that returns the "language" of a file, given a valid file path with extension.

getNestedFileTree

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])
  ...
}

FAQs

Package last updated on 06 Jan 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc