New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@webeach/pages-builder

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webeach/pages-builder

CLI tool for generating multilingual JSON pages and structure.json for the WebEach website based on YAML and Markdown content

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@webeach/pages-builder

A Node.js package for building structured JSON pages from Markdown and YAML content.

🚀 Features

  • Parses page metadata from YAML files.
  • Extracts and processes Markdown content with metadata.
  • Supports multiple languages per page.
  • Generates structured JSON files for easy integration.
  • CLI support for automation.

📦 Installation

yarn add @webeach/pages-builder

⚡ Usage

CLI Usage

webeach-pages-builder build-pages --inputFile=./content/structure.yml --outputDir=dist

Available Commands

  • build-pages → Builds all pages from a structured input file.

CLI Options

OptionRequiredDefaultDescription
--inputFile <path>✅ YesPath to the file containing the page structure.
--outputDir <path>❌ NodistOutput directory where pages will be built.
--minify❌ NotrueWhether to output minified (single-line) JSON. Use --minify=false to disable.

Programmatic API

import { buildAllPages } from '@webeach/pages-builder';

await buildAllPages('./content/structure.yml', './dist');

📂 Project Structure

Your project should be structured like this:

content/
  ├── structure.yml  # Defines page metadata and references
  ├── pages/
  │   ├── html/
  │   │   ├── tags/
  │   │   │   ├── div/
  │   │   │   │   ├── page.yml
  │   │   │   │   ├── content.ru.md
  │   │   │   │   ├── content.en.md
  │   │   │   │   └── ...
  │   │   │   ├── p/
  │   │   │   │   ├── page.yml
  │   │   │   │   ├── content.ru.md
  │   │   │   │   ├── content.en.md
  │   │   │   │   └── ...
  │   │   └── ...
  │   ├── css/
  │   │   ├── properties/
  │   │   │   ├── background-color/
  │   │   │   │   ├── page.yml
  │   │   │   │   ├── content.ru.md
  │   │   │   │   ├── content.en.md
  │   │   │   │   └── ...
  │   │   │   ├── border-radius/
  │   │   │   │   ├── page.yml
  │   │   │   │   ├── content.ru.md
  │   │   │   │   ├── content.en.md
  │   │   │   │   └── ...
  │   │   └── ...

📜 Example structure.yml

pages:
  - id: "html.tags.div"
    route: "/html/div"
    ref: "./html/tags/div/page.yml"

  - id: "css.properties.background-color"
    route: "/css/background-color"
    ref: "./css/properties/background-color/page.yml"

  - id: "css.properties.border-radius"
    parentId: "css"
    route:
      path: "/css/border-radius"
      aliases:
        - "/css/-webkit-border-radius"
        - "/css/-moz-border-radius"
    ref: "./css/properties/border-radius/page.yml"

📜 Output Structure JSON

In addition to page JSON files, the output structure is saved as:

dist/
├── pages/
│   ├── {uuid}/
│   │   ├── ru.json
│   │   ├── en.json
│   │   └── ...
├── structure.json  # Contains metadata for all generated pages

This structure.json file includes mappings of pages and their routes.

📝 Example page.yml

content:
  ru: "content.ru.md"
  en: "content.en.md"

properties:
  title:
    ru: "Блок div"
    en: "Div Block"
  description:
    ru: "HTML-тег `<div>` представляет контейнер..."
    en: "The HTML `<div>` tag represents a container..."
  tags:
    ru: ["html", "container"]
    en: ["html", "container"]

✅ Example Markdown Content (content.en.md)

# Div Block

The `<div>` element is a container for HTML elements.

📜 Output JSON Example

{
  "content": [
    {
      "type": "heading",
      "depth": 1,
      "children": [{ "type": "text", "value": "Div Block" }]
    },
    {
      "type": "paragraph",
      "children": [{ "type": "text", "value": "The `<div>` element is a container for HTML elements." }]
    }
  ],
  "properties": {
    "title": "Div Block",
    "description": "The HTML `<div>` tag represents a container...",
    "tags": ["html", "container"]
  }
}

🔖 Releasing a New Version

Releases are handled automatically using semantic-release.

Before publishing a new version, make sure to:

  • Commit and push all changes to the main branch.
  • Use commit messages that follow the Conventional Commits format:
    • feat: ... — for new features
    • fix: ... — for bug fixes
    • chore: ..., refactor: ..., etc.
  • Versioning is determined automatically based on the type of commits (patch, minor, major).

👨‍💻 Author

Developed and maintained by Ruslan Martynov

If you have any suggestions or find a bug, feel free to open an issue or pull request.

📄 License

This package is licensed under the MIT License.

FAQs

Package last updated on 21 Apr 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