@viewdo/dxp-story-cli
Version:
README.md
58 lines (44 loc) • 1.92 kB
JavaScript
const SyncManager = require('./managers/sync-manager')
const ConfigurationManager = require('./managers/configuration-manager')
const NamespaceManager = require('./managers/namespace-manager')
const AuthenticationManager = require('./managers/authentication-manager')
const PromptService = require('./services/prompt-service')
const FileService = require('./services/file-service')
const ApiService = require('./services/api-service')
const AuthService = require('./services/auth-service')
const task_service = require('./services/task-service')
const console_service = require('./services/console-service')
const urls = require('./conventions/url-conventions')
module.exports = class App {
constructor(options = {}) {
let services = {
console_service,
file_service: new FileService(options.path || process.cwd()),
auth_service: new AuthService(
urls.auth_api,
urls.auth0_domain,
options.client_id || process.env.AUTH0_CLIENT_ID || "1JgudKJ3ys8ztvqHFPN1wJup7VS9jTPn",
options.client_secret || process.env.AUTH0_CLIENT_SECRET,
urls.audience),
api_service: new ApiService(urls.domain_api),
task_service
}
//this.options = options;
this.console_service = console_service
this.task_service = task_service
this.prompt_service = new PromptService(options)
this.namespace_manager = new NamespaceManager(options, services)
this.configuration_manager = new ConfigurationManager(options, services)
this.auth_manager = new AuthenticationManager(options, services)
this.sync_manager = new SyncManager(options, services,
this.configuration_manager,
this.auth_manager)
if(!this.configuration_manager.file.exists()) {
this.console_service.log('Creating dxp-config.json file for sync settings.')
this.configuration_manager.save()
}
}
get root() {
return process.cwd()
}
}