@node-sitecore/config

3.12.1 • Public • Published

NodeSitecore Config

Build Status Coverage Status Package Quality npm version Dependencies img img Known Vulnerabilities semantic-release

A shared configuration between all packages based on @node-sitecore/cli.

Features

  • Control over configuration values.
  • Support multiple configuration files by environment (.nscrc (default), .development.nscrc, .test.nscrc, .production.nscrc).
  • All value can be overridden by env or args variable (nconf)
  • Extensible with plugins.

Installation

$ npm install @node-sitecore/config --save-dev

Documentation

A documentation is available about differents default options supported by @node-sitecore/config here.

Example Usage

In node.js:

const config = require('@node-sitecore/config');

// getters
console.log(config.currentWebsite) // Custom
console.log(config.websiteDir) // build/Website

// get()

console.log(config.get('customObj')) // Object {attr1: "value1", ...}

// or

console.log(config.get('customObj:attr1') // bundle

// has()
console.log(config.has('customObj:attr1')) // true


// set()
config.set('customObj:attr1', "new value");

// resolver
config.resolve('<rootDir>') // path/to/root
config.resolve('<instanceDir>') // path/to/root/build
config.resolve('<websiteDir>') // path/to/root/build/Website
config.resolve('<themesDir>') // path/to/root/build/Website/themes
config.resolve('<srcDir>') // path/to/root/src
config.resolve('<projectDir>') // path/to/root/src/Project
config.resolve('<featureDir>') // path/to/root/src/Feature
config.resolve('<foundationDir>') // path/to/root/src/Foundation
config.resolve('<currentDir>') // path/to/root/src/Project/Custom/code

Note: API is documented on our website here.

Contributing

Read our contribution documentation.

License

The MIT License (MIT)

Copyright (c) 2018 NodeSitecore

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i @node-sitecore/config

Weekly Downloads

18

Version

3.12.1

License

none

Unpacked Size

48.7 kB

Total Files

17

Last publish

Collaborators

  • romakita
  • timbenniks