You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

read-cortex-json

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-cortex-json

The thing cortex uses to read cortex.json files or fallback to read cortex configurations from package.json

2.1.1
npmnpm
Version published
Weekly downloads
14
250%
Maintainers
2
Weekly downloads
 
Created
Source

read-cortex-json NPM version Build Status Dependency Status

The thing cortex uses to read cortex.json files or fallback to read cortex configurations from package.json.

Cortex supports both cortex.json and the 'cortex' field of package.json. But with read-cortex-json, you don't have to care about all this, and you should ALWAYS use this module to read and save cortex.json.

Install

npm install read-cortex-json --save

Usage

var cortexJson = require('read-cortex-json');

cortexJson.read(cwd, callback)

  • cwd path current working directory
  • callback function(err, json)
  • err Error
  • json Object

Reads and returns the information of a cortex package.

cortexJson.read('/path/to/your/repo', function(err, json){
  if (err) {
    console.error('There was an error', e);
    return;
  }
  
  console.log('The package data is:', json);
});

cortexJson.enhanced(cwd, callback)

This method is different from cortexJson.read() that it will validate some stuff and flavors the object with some default values which cortex registry needs.

For most situations, you need not use this.

cortexJson.validate(cwd, json, callback)

  • callback function(err)

Validates the json data for a specified cwd. This method will validate directories and entries.

cortexJson.save(cwd, json, callback)

  • callback function(err)

Save the json to the file.

cortexJson.package_root(cwd, callback)

  • callback function(root)

Traverses up from the cwd and gets the first directory that contains a package file of cortex.

Sometimes user might run cortex commands inside the subtle directories of the current repo, and we must make sure cortex commands always run at the root directory.

cortexJson.cached_document(name, cache_root, callback)

  • name String package name
  • cache_root path cache directory of the current profile
  • callback function(err, document)
  • document json

Gets the cached document.

Keywords

read

FAQs

Package last updated on 12 Jun 2014

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