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

playground-parser

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playground-parser

Generate Playground Pages

  • 1.0.0-dd-alpha
  • alpha
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Playground Parser

The Playground Parser helps generate dynamic component preview pages for Lightning Web Components (LWC) and Aura components. It reads metadata and example files, processes them, and generates HTML, JavaScript, and CSS files for each component example to be displayed in a playground environment.

The generated preview pages include dynamic code previews, allowing developers to view and interact with different component examples. It supports both LWC and Aura model types (with screenshots for previews) and generates the appropriate content for each example.

Setup

yarn install

Assumptions

  • To extract example metadata from the Markdown document file, it is assumed that the file name will end with the component name, either in camel case or kebab case.

Environment Variables

Set the following environment variables before running the setup and start scripts:

  • IN_PLAYGROUND_DIR: The folder path of the input folder, defaults to in-playground.
  • OUT_PLAYGROUND_DIR: The folder path of the output folder, defaults to out-playground.

IN_PLAYGROUND_DIR Folder Format

model1/namespace1/
   component1/
   component2/
model2/namespace2/
   component1/
   component2/

Example:

lwc/
   lightning/
      button/
         button.md
         examples/
aura/
   lightning/
      button/
         button.md
         examples/

OUT_PLAYGROUND_DIR Folder Format

model1/namespace1/
   examples/
   playground/
   example-metadata.json
model2/namespace2/
   examples/
   playground/
   example-metadata.json

Example:

lwc/
   lightning/
      examples/
      playground/
      example-metadata.json
aura/
   lightning/
      examples/
      playground/
      example-metadata.json

Scripts

Parse

This script reads examples from IN_PLAYGROUND_DIR and generates the playground pages and example metadata into OUT_PLAYGROUND_DIR.

yarn parse

During development, you can pass the path to the lightning-design-system content repository as a variable. This will create the in-playground directory.

Example:

LIGHTNING_DESIGN_SYSTEM_REPO_PATH='/Users/smopada/Desktop/work/doc-repos/lightning-design-system' yarn parse

Alternatively, if you have extracted the folder from the ui-lightning-components jar, you can pass its path as a variable. This will also create the in-playground directory.

Example:

UI_LIGHTNING_COMPONENTS_PATH='../ui-lightning-components-254.7.17' yarn parse

FAQs

Package last updated on 13 Jan 2025

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