Commit 282fc6fe authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[TASK] cleanup

parent 7a757906
'use strict';
const exec = require('child_process').exec,
settings = require('../../gulp/settings'),
chalk = require('chalk');
console.log(`${chalk.bold(chalk.yellow('Heads up:'))} ${chalk.yellow('this feature is still experimental!')}`);
exec(`node ./sgc-core/node_modules/lighthouse/lighthouse-cli/index.js --chrome-flags="--ignore-certificate-errors" ${settings.getConfig().browsersync.url} --view`);
......@@ -2,7 +2,7 @@
const fs = require('fs');
const path = require('path');
const argv = require('yargs').argv;
const {argv} = require('yargs');
/**
* This module is a global settings singleton
......@@ -14,10 +14,10 @@ class Settings {
* Kick things off
*/
constructor() {
this._config = this.getConfig();
this._config = Settings.parseConfig();
this._extensionPath = this._config.directories.basePath;
this._webPath = this._config.directories.webPath;
this._extension = this._config.extensions[0];
[this._extension] = this._config.extensions;
this._tasks = {
css: () => {return require('./tasks/css')},
js: () => {return require('./tasks/js')},
......@@ -36,12 +36,12 @@ class Settings {
* @param {Boolean} _isWebPath indicates if the requested path is for web, or file system access
*/
getPath(_isWebPath) {
let extensionName = (typeof argv.ext !== 'undefined')
? argv.ext
: this._extension;
return typeof isWebPath !== 'undefined'
? path.join(this._webPath, extensionName)
: path.join(this._extensionPath, extensionName);
let extensionName = (typeof argv.ext === 'undefined')
? this._extension
: argv.ext;
return typeof _isWebPath === 'undefined'
? path.join(this._extensionPath, extensionName)
: path.join(this._webPath, extensionName);
}
/**
......@@ -56,7 +56,7 @@ class Settings {
/**
* Returns the sgc-config object
*/
getConfig() {
static parseConfig() {
try {
fs.statSync('./sgc-core/gulp/config.json');
return require('./config.json');
......@@ -71,6 +71,13 @@ class Settings {
get tasks() {
return this._tasks;
}
/**
* Returns the configuration object
*/
get config() {
return this._config;
}
}
const instance = new Settings();
......
......@@ -16,7 +16,7 @@ module.exports = class task {
*/
constructor() {
this._settings = settings;
this._config = this._settings.getConfig();
this._config = settings.config;
this._path = this._settings.getPath();
this._logger = require('./logger');
if (argv.prod || argv.production) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment