0.3.2 • Published 5 months ago

@monokle/parser v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Monokle Parser

This package is designed to be used to parse Kubernetes resources.

Usage

The core function is extractK8sResources() function. It accepts a list of file objects:

export type BaseFile = {
  id: string; // unique id
  path: string; // path to source
  content: string; // file content as text
};

BaseFile can represent regular file present in local file storage, but can be also any remote resource or basically anything else (like data read from db). It important to keep in mind that id should be unique.

File objects can be then passed to extractK8sResources() to be parsed. All non K8s-related files will be ignored:

import {extractK8sResources} from `@monokle/parser`;

const resources = extractK8sResources(files);

Each resource contains following information:

{
  id: string;
  fileId: string;
  filePath: string;
  fileOffset: number;
  name: string;
  apiVersion: string;
  kind: string;
  namespace?: string;
  content?: any;
  text: string;
  refs?: ResourceRef[];
  range?: {
    start: number;
    length: number;
  };
}
0.3.2

5 months ago

0.3.1

5 months ago

0.3.0

5 months ago

0.2.0

8 months ago

0.1.1

8 months ago

0.1.0

9 months ago