Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[HOLD] add 'logSkyuxVersion' property #27

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All of the following options are required and overridable via the CLI. For exam
| `name` | `null` |
| `version` | `version` property in `package.json` |
| `skyuxVersion` | `_requested.spec` in the `package.json` file in `./node_modules/blackbaud-skyux2/` |
| `logSkyuxVersion` | `true` |
| `azureStorageAccount` | `null` |
| `azureStorageAccessKey` | `null` |
| `azureStorageTableName` | "spa" |
Expand Down
5 changes: 3 additions & 2 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ function getSkyuxVersion() {
* @name getSettings
* @returns {Object} settings
*/
function getSettings(argv) {
function getSettings(argv = {}) {

const packageConfig = getLocalConfig('package.json');
const skyuxConfig = getLocalConfig('skyuxconfig.json');
const logSkyuxVersion = argv.logSkyuxVersion !== 'false' && argv.logSkyuxVersion !== false;

const defaults = {
name: '',
version: '',
skyuxVersion: getSkyuxVersion(),
skyuxVersion: logSkyuxVersion ? getSkyuxVersion() : '',
packageConfig: packageConfig,
skyuxConfig: skyuxConfig,
azureStorageTableName: 'spa'
Expand Down
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function validate(assets, settings) {
'name',
'version',
'skyuxVersion',
'logSkyuxVersion',
'azureStorageAccount',
'azureStorageAccessKey',
'azureStorageTableName'
Expand Down
28 changes: 26 additions & 2 deletions test/lib-settings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('skyux-deploy lib settings', () => {
);
});

function setupPackageJson(_requested) {
function setupPackageJson(_requested, argv) {
const skyuxInstalledPath = path.join(
process.cwd(),
'node_modules',
Expand All @@ -81,12 +81,36 @@ describe('skyux-deploy lib settings', () => {
});

const lib = require('../lib/settings');
const settings = lib.getSettings();
const settings = lib.getSettings(argv);

expect(logger.error).not.toHaveBeenCalled();
return settings;
}

it('should return the default skyux version if logSkyuxVersion is set to false', () => {
const version = 'custom-skyux-version-npm3';
const settings = setupPackageJson(
{
spec: version
},
{
logSkyuxVersion: false
});
expect(settings.skyuxVersion).toEqual('');
});

it('should return the default skyux version if logSkyuxVersion is set to `false`', () => {
const version = 'custom-skyux-version-npm3';
const settings = setupPackageJson(
{
spec: version
},
{
logSkyuxVersion: 'false'
});
expect(settings.skyuxVersion).toEqual('');
});

it('should read the skyux version if it is installed (npm < 5)', () => {
const version = 'custom-skyux-version-npm3';
const settings = setupPackageJson({
Expand Down