Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sleep-client/parser

testingrequired11MIT0.1.0TypeScript support: included

Rest file parser

readme

@sleep-client/parser

Library for parsing sleep client state files.

Installation

$ npm i @sleep-client/parser

Usage

import {
  parse,
  ParsedStateFile,
  mapParsedToExport
} from "@sleep-client/parser";

(await () => {
  try {
    const parsedStateFile: ParsedStateFile = await parse("./path/to/stateFile");

    const workspaces = parsedStateFile.getWorkspaces();
    const collections = parsedStateFile.getWorkspaceCollections(workspaces[0]);
    const requests = parsedStateFile.getCollectionRequests(collections[0]);

    const stateFileJson = JSON.stringify(mapParsedToExport(parsedStateFile));
  } catch(e){
    e.message // Contains any errors parsing
  }
})()