The thing cortex uses to read cortex.json files or fallback to read cortex configurations from package.json
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
npm install read-cortex-json --save
var cortexJson = require'read-cortex-json';
pathcurrent working directory
Reads and returns the information of a cortex package.
cortexJsonread'/path/to/your/repo'if errconsole.error'There was an error' e;return;console.log'The package data is:' json;;
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.
Cleans and validate the
This method will check the
json object first. If it is an old object,
cortexJson.clean will santitize it.
cortexJson.enhanced(), there are always
main, if no main entry found, it will be
css, if no csses found, it will be
entries, if no entries found, it will be
require.resolve()d. That is, if there is a
'index', and after
cortex.entrieswill always be an globbed array(even an empty array) after
entries, is explicitly defined but not found, an error will throw.
'CORTEX_NO_ENTRY'error will throw.
It is a
Save the json to the file.
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.
pathcache directory of the current profile
Gets the cached document.