diff --git a/LICENSE b/LICENSE index 9931035..6440771 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 Romain Lenzotti +Copyright (c) 2018 Romain Lenzotti 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: diff --git a/package.json b/package.json index 4db5f7d..c72baf2 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,10 @@ "nconf": "^0.10.0" }, "files": [ - "bin/nsc.js", - "bin", "src" ], "directories": { - "src": "./src", - "bin": "./bin" + "src": "./src" }, "repository": { "type": "git", @@ -50,8 +47,8 @@ "travis-coveralls": "nyc report --reporter=text-lcov | coveralls", "test": "npm run lint && nyc --reporter=html --reporter=text _mocha --recursive", "prepublishOnly": "gflow release post", - "lint": "eslint \"{bin,src,test}/**/*.js\"", - "lint:fix": "eslint --fix \"{bin,src,test}/**/*.js\"" + "lint": "eslint \"{src,test}/**/*.js\"", + "lint:fix": "eslint --fix \"{src,test}/**/*.js\"" }, "release": { "branch": "production" diff --git a/readme.md b/readme.md index 1f3cb32..3fcb6fa 100644 --- a/readme.md +++ b/readme.md @@ -10,10 +10,96 @@ [![Known Vulnerabilities](https://snyk.io/test/github/NodeSitecore/sitecore-config/badge.svg)](https://snyk.io/test/github/NodeSitecore/sitecore-config) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -> A shared configuration between @node-sitecore/cli and @node-sitecore/vue +> A shared configuration between `@node-sitecore/cli` and `@node-sitecore/vue` + +## Features + +- Control over configuration values. +- Support multiple configuration files by environment (`.development.nsrc`, `.test.nsrc`, `.production.nsrc`). +- All value can be overridden by env or args variable ([nconf](https://github.com/indexzero/nconf)) ## Installation ```bash $ npm install -g @node-sitecore/config ``` + +## Configuration fields + +Key | Default value | Tags | Description +---|---|--- +currentWebsite | `Common` | Sitecore, Vuejs | Current code name of the sitecore website. +solutionName | `Base` | Sitecore | Solution name of the Visual Studio project. +siteUrl | `http://base.dev.local` | Sitecore | Site url use on your local machine. You change this value in a separated file like `.dev.nsrc`. +instanceRoot | `http://base.dev.local` | Sitecore | Directory the Sitecore files instance. +srcRoot | `./src` | Sitecore | Source code directory. +websiteRoot | `./website` | Sitecore | Website directory used by Sitecore. +foundationRoot | `./src/Foundation` | Sitecore | Foundation level directory (Helix structure). +foundationScriptsRoot | `./Core/code/Scripts` | Sitecore | Scripts Foundation directory. Shortcut to the shared code. +featureRoot | `./src/Feature` | Sitecore | Feature level directory (Helix structure). +projectRoot | `./src/Project` | Sitecore | Project level directory (Helix structure). +sitecoreLibrariesRoot | `./Website/bin` | Sitecore | Sitecore libraries directory. +licensePath | `./Data/license.xml` | Sitecore | License path required by Sitecore. +buildConfiguration | `Debug` | MsBuild | MsBuild Configuration (Release or Debug). +buildToolsVersion | `15.0` | MsBuild | MsBuild .NET Tools-Version (1.0, 1.1, 2.0, 3.5, 4.0, 12.0, 14.0, 15.0, auto). +buildMaxCpuCount | `0` | MsBuild | Maximal CPU-Count to use. (`-1`: MSBuild Default, `0`: Automatic selection, `> 0`: Concrete value). +buildVerbosity | `minimal` | MsBuild | Specify the amount of information to display in the build output (`quiet`, `minimal`, `normal`, `detailed`, `diagnostic`). +buildNodeReuse | `false` | MsBuild | MsBuild Specify whether to enable or disable the re-use of MSBuild nodes (`true` or `false`). +buildLogCommand | `false` | MsBuild | Logs the MsBuild command that will be executed. +excludeFilesFromDeployment | `['packages.config']` | MsBuild | Exclude files from the deployment on the Sitecore instance. +buildTargets | `['Build']` | MsBuild | Build targets options (`Build`, `Clean`, `Rebuild`). +buildPlatform | `Any CPU` | MsBuild | Build targets options (e.g. x86, x64, Any CPU). +buildProperties | `{}` | MsBuild | Additional build properties. +publishTargets | `['Build']` | MsBuild | Publish targets options (`Build`, `Clean`, `Rebuild`). +publishPlatform | `AnyCpu` | MsBuild | Publish platform (e.g. x86, x64, AnyCpu). +publishProperties | `{...}` | MsBuild | Additional publish properties. +bundles | `{...}` | Vuejs | Additional publish properties. + +### PublishProperties + +Default value of publishProperties: +```json +{ + DeployOnBuild: 'true', + DeployDefaultTarget: 'WebPublish', + WebPublishMethod: 'FileSystem', + DeleteExistingFiles: 'false', + _FindDependencies: 'false' +} +``` + +### Bundles + +Default value of bundles: +```json +{ + bundleName: 'bundle', + polyfills: 'polyfills', + styleguide: 'styleguide' +} +``` + +## Hierarchical configuration + +Configuration management can get complicated very quickly for even trivial applications running in production. nconf addresses this problem by enabling you to setup a hierarchy for different sources of configuration with no defaults. The order in which you attach these configuration sources determines their priority in the hierarchy. Let's take a look at the options available to you + +The priority of hierarchical configuration is defined like there : + +1. Default configuration from `@node-sitecore/config`, +2. Arguments given by command line tools, +3. Environment variables, +4. From file `.nsrc`, +5. From `.development.nsrc`, `.test.nsrc`, `.production.nsrc` or `[process.env.NODE_ENV].nsrc` according to `process.env.NODE_ENV` value. + + +## License + +The MIT License (MIT) + +Copyright (c) 2018 + +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. diff --git a/src/constant.js b/src/constant.js index f36a021..1fdb36d 100644 --- a/src/constant.js +++ b/src/constant.js @@ -11,37 +11,134 @@ module.exports = { * */ DEFAULT_CONF: { + /** + * Current code name of the sitecore website. + * @tags Sitecore, Vuejs + */ currentWebsite: 'Common', + /** + * Solution name of the Visual Studio project. + * @tags Sitecore + */ solutionName: 'Base', + /** + * Site url use on your local machine. You change this value in a separated file like `.dev.nsrc`. + * @tags Sitecore + */ siteUrl: 'http://base.dev.local', - + /** + * Directory the Sitecore files instance. + * @tags Sitecore + */ instanceRoot: formatPath('./build'), + /** + * Source code directory. + * @tags Sitecore + */ srcRoot: formatPath('./src'), + /** + * Website directory used by Sitecore. + * @tags Sitecore + */ websiteRoot: formatPath('./Website'), - featureRoot: formatPath('./src/Feature'), - projectRoot: formatPath('./src/Project'), + /** + * Foundation level directory (Helix structure). + * @tags Sitecore + */ foundationRoot: formatPath('./src/Foundation'), + /** + * Scripts Foundation directory. Shortcut to the shared code. + * @tags Sitecore + */ foundationScriptsRoot: formatPath('./Core/code/Scripts'), + /** + * Feature level directory (Helix structure). + * @tags Sitecore + */ + featureRoot: formatPath('./src/Feature'), + /** + * Project level directory (Helix structure). + * @tags Sitecore + */ + projectRoot: formatPath('./src/Project'), + /** + * Sitecore libraries directory. + * @tags Sitecore + */ sitecoreLibrariesRoot: formatPath('./Website/bin'), + /** + * License path required by Sitecore. + * @tags Sitecore + */ licensePath: formatPath('./Data/license.xml'), - - + /** + * MsBuild Configuration (Release or Debug). + * @tags MsBuild + */ buildConfiguration: 'Debug', + /** + * MsBuild .NET Tools-Version (1.0, 1.1, 2.0, 3.5, 4.0, 12.0, 14.0, 15.0, auto). + * @tags MsBuild + */ buildToolsVersion: 15.0, + /** + * Maximal CPU-Count to use. (`-1`: MSBuild Default, `0`: Automatic selection, `> 0`: Concrete value). + * @tags MsBuild + */ buildMaxCpuCount: 0, + /** + * Specify the amount of information to display in the build output (`quiet`, `minimal`, `normal`, `detailed`, `diagnostic`). + * @tags MsBuild + */ buildVerbosity: 'minimal', + /** + * MsBuild Specify whether to enable or disable the re-use of MSBuild nodes (`true` or `false`). + * @tags MsBuild + */ buildNodeReuse: false, + /** + * Logs the MsBuild command that will be executed. + * @tags MsBuild + */ buildLogCommand: false, + /** + * Exclude files from the deployment on the Sitecore instance. + * @tags MsBuild + */ excludeFilesFromDeployment: ['packages.config'], // build + /** + * Build targets options (`Build`, `Clean`, `Rebuild`). + * @tags MsBuild + */ buildTargets: ['Build'], + /** + * Build platform (e.g. x86, x64, Any CPU). + * @tags MsBuild + */ buildPlatform: 'Any CPU', + /** + * Additional build properties. + * @tags MsBuild + */ buildProperties: {}, // publish + /** + * Publish targets options (`Build`, `Clean`, `Rebuild`). + * @tags MsBuild + */ publishTargets: ['Build'], + /** + * Publish platform (e.g. x86, x64, AnyCpu). + * @tags MsBuild + */ publishPlatform: 'AnyCpu', + /** + * Additional publish properties. + * @tags MsBuild + */ publishProperties: { DeployOnBuild: 'true', DeployDefaultTarget: 'WebPublish', @@ -49,7 +146,10 @@ module.exports = { DeleteExistingFiles: 'false', _FindDependencies: 'false' }, - + /** + * Bundles configurations use by Vue.js and fractal. + * @tags Vuejs + */ bundles: { bundleName: 'bundle', polyfills: 'polyfills', diff --git a/yarn.lock b/yarn.lock index aa5a61f..7976361 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4006,7 +4006,7 @@ secure-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/secure-keys/-/secure-keys-1.0.0.tgz#f0c82d98a3b139a8776a8808050b824431087fca" -semantic-release@^15.5.0: +semantic-release@^15.6.3: version "15.6.3" resolved "https://registry.yarnpkg.com/semantic-release/-/semantic-release-15.6.3.tgz#3e336f421b7f7595c991609d6de3ee7f53918f2a" dependencies: @@ -4481,7 +4481,7 @@ traverse@~0.6.6: version "0.6.6" resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.6.tgz#cbdf560fd7b9af632502fed40f918c157ea97137" -travis-deploy-once@^5.0.0: +travis-deploy-once@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/travis-deploy-once/-/travis-deploy-once-5.0.1.tgz#373c9987a1af5c5a5106ee3d6e042dce2029b02d" dependencies: