@coursehero/theia
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
import * as rimraf from 'rimraf' | ||
import theia, { Configuration, LocalStorage } from '../theia' | ||
import theia, { Configuration, LocalStorage } from '../src/theia' | ||
@@ -18,7 +18,6 @@ describe('mythos', () => { | ||
}, | ||
storage, | ||
loadFromDisk: false | ||
storage | ||
} | ||
const core = theia(config) | ||
const core = theia(config, 'theia*') | ||
@@ -25,0 +24,0 @@ beforeAll(() => core.buildAll(), 1000 * 60) |
@@ -9,3 +9,3 @@ /// <reference path="../types/tapable.d.ts" /> | ||
export declare function nn<T>(array: (T | null)[]): T[]; | ||
export default function theia(configFromParams?: Configuration): Core; | ||
export default function theia(configFromParams: Configuration, debugNamespaces: string): Core; | ||
export { Builder, Core, CoreHooks, LocalStorage, Plugin, S3Storage, Storage }; | ||
@@ -20,3 +20,2 @@ export declare type Environment = 'test' | 'development' | 'production'; | ||
verbose?: boolean; | ||
loadFromDisk?: boolean; | ||
} | ||
@@ -23,0 +22,0 @@ export interface ComponentLibraryConfigurations { |
"use strict"; | ||
/// <reference path="../types/tapable.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const debug = require("debug"); | ||
const path = require("path"); | ||
@@ -18,5 +19,2 @@ const Core_1 = require("./Core"), CoreHooks = Core_1; | ||
exports.nn = nn; | ||
function getConfig(configPath) { | ||
return require(configPath).default; | ||
} | ||
function configDefaulter(options) { | ||
@@ -39,5 +37,2 @@ const opts = Object.assign({}, options); | ||
} | ||
if (opts.loadFromDisk === undefined) { | ||
opts.loadFromDisk = true; | ||
} | ||
if (opts.plugins === undefined) { | ||
@@ -54,30 +49,5 @@ opts.plugins = []; | ||
} | ||
function theia(configFromParams) { | ||
const configPaths = [ | ||
path.resolve('theia.config'), | ||
path.resolve('dist/theia.config'), | ||
path.resolve('src/theia.config') | ||
]; | ||
const configPath = configPaths.find(p => { | ||
try { | ||
require.resolve(p); | ||
return true; | ||
} | ||
catch (e) { | ||
return false; | ||
} | ||
}); | ||
let config; | ||
const readFromDisk = !configFromParams || (configFromParams && configFromParams.loadFromDisk); | ||
if (readFromDisk && configPath) { | ||
config = getConfig(configPath); | ||
// TODO merge configFromParams | ||
} | ||
else if (configFromParams) { | ||
config = configFromParams; | ||
} | ||
else { | ||
throw new Error('could not find theia config'); | ||
} | ||
config = configDefaulter(config); | ||
function theia(configFromParams, debugNamespaces) { | ||
debug.enable(debugNamespaces); | ||
const config = configDefaulter(configFromParams); | ||
const core = new Core_1.default(config); | ||
@@ -84,0 +54,0 @@ if (config.verbose) { |
{ | ||
"name": "@coursehero/theia", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"bin": "./dist/cli.js", | ||
"main": "dist/theia.js", | ||
@@ -12,2 +13,3 @@ "types": "dist/theia.d.ts", | ||
"bluebird": "^3.5.1", | ||
"commander": "^2.17.1", | ||
"debug": "~3.1.0", | ||
@@ -23,3 +25,3 @@ "fs-extra": "^5.0.0", | ||
}, | ||
"gitHead": "6b26aadae2a4dbe5ee75c0594c687ce896371704" | ||
"gitHead": "ff5f725760db703bc9db3241ec810d81d519ae38" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
220652
46
995
9
9
1
+ Addedcommander@^2.17.1
+ Addedcommander@2.20.3(transitive)