@teambit/global-config 0.0.897 → 0.0.899

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,44 @@
1
+ import { Command, CommandOptions } from '@teambit/cli';
2
+ declare class ConfigSet implements Command {
3
+ name: string;
4
+ description: string;
5
+ extendedDescription: string;
6
+ baseUrl: string;
7
+ alias: string;
8
+ skipWorkspace: boolean;
9
+ options: CommandOptions;
10
+ loadAspects: boolean;
11
+ report([key, value]: [string, string]): Promise<string>;
12
+ }
13
+ declare class ConfigGet implements Command {
14
+ name: string;
15
+ description: string;
16
+ alias: string;
17
+ options: CommandOptions;
18
+ report([key]: [string]): Promise<string>;
19
+ }
20
+ declare class ConfigList implements Command {
21
+ name: string;
22
+ description: string;
23
+ alias: string;
24
+ options: CommandOptions;
25
+ report(): Promise<string>;
26
+ }
27
+ declare class ConfigDel implements Command {
28
+ name: string;
29
+ description: string;
30
+ alias: string;
31
+ options: CommandOptions;
32
+ report([key]: [string]): Promise<string>;
33
+ }
34
+ export declare class ConfigCmd implements Command {
35
+ name: string;
36
+ description: string;
37
+ extendedDescription: string;
38
+ group: string;
39
+ alias: string;
40
+ commands: (ConfigSet | ConfigDel | ConfigGet | ConfigList)[];
41
+ options: CommandOptions;
42
+ report(): Promise<string>;
43
+ }
44
+ export {};
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ConfigCmd = void 0;
7
+ function _chalk() {
8
+ const data = _interopRequireDefault(require("chalk"));
9
+ _chalk = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _padRight() {
15
+ const data = _interopRequireDefault(require("pad-right"));
16
+ _padRight = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function config() {
22
+ const data = _interopRequireWildcard(require("@teambit/legacy/dist/api/consumer/lib/global-config"));
23
+ config = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _constants() {
29
+ const data = require("@teambit/legacy/dist/constants");
30
+ _constants = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
36
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
37
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
38
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
39
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
40
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint max-classes-per-file: 0 */
41
+ class ConfigSet {
42
+ constructor() {
43
+ _defineProperty(this, "name", 'set <key> <val>');
44
+ _defineProperty(this, "description", 'set a global configuration');
45
+ _defineProperty(this, "extendedDescription", `to set temporary configuration by env variable, prefix with "BIT_CONFIG", replace "." with "_" and change to upper case.
46
+ for example, "user.token" becomes "BIT_CONFIG_USER_TOKEN"`);
47
+ _defineProperty(this, "baseUrl", 'reference/config/bit-config/');
48
+ _defineProperty(this, "alias", '');
49
+ _defineProperty(this, "skipWorkspace", true);
50
+ _defineProperty(this, "options", []);
51
+ _defineProperty(this, "loadAspects", false);
52
+ }
53
+ async report([key, value]) {
54
+ await config().set(key, value);
55
+ return _chalk().default.green('added configuration successfully');
56
+ }
57
+ }
58
+ class ConfigGet {
59
+ constructor() {
60
+ _defineProperty(this, "name", 'get <key>');
61
+ _defineProperty(this, "description", 'get a value from global configuration');
62
+ _defineProperty(this, "alias", '');
63
+ _defineProperty(this, "options", []);
64
+ }
65
+ async report([key]) {
66
+ const value = await config().get(key);
67
+ return value || '';
68
+ }
69
+ }
70
+ class ConfigList {
71
+ constructor() {
72
+ _defineProperty(this, "name", 'list');
73
+ _defineProperty(this, "description", 'list all configuration(s)');
74
+ _defineProperty(this, "alias", '');
75
+ _defineProperty(this, "options", []);
76
+ }
77
+ async report() {
78
+ const conf = await config().list();
79
+ return Object.entries(conf).map(tuple => {
80
+ return tuple.join(' ');
81
+ }).join('\n');
82
+ }
83
+ }
84
+ class ConfigDel {
85
+ constructor() {
86
+ _defineProperty(this, "name", 'del <key>');
87
+ _defineProperty(this, "description", 'delete given key from global configuration');
88
+ _defineProperty(this, "alias", '');
89
+ _defineProperty(this, "options", []);
90
+ }
91
+ async report([key]) {
92
+ await config().del(key);
93
+ return _chalk().default.green('deleted successfully');
94
+ }
95
+ }
96
+ class ConfigCmd {
97
+ constructor() {
98
+ _defineProperty(this, "name", 'config');
99
+ _defineProperty(this, "description", 'global config management');
100
+ _defineProperty(this, "extendedDescription", `${_constants().BASE_DOCS_DOMAIN}reference/config/bit-config`);
101
+ _defineProperty(this, "group", 'general');
102
+ _defineProperty(this, "alias", '');
103
+ _defineProperty(this, "commands", [new ConfigSet(), new ConfigDel(), new ConfigGet(), new ConfigList()]);
104
+ _defineProperty(this, "options", []);
105
+ }
106
+ async report() {
107
+ const conf = await config().list();
108
+ return Object.entries(conf).map(tuple => {
109
+ tuple[0] = (0, _padRight().default)(tuple[0], 45, ' ');
110
+ return tuple.join('');
111
+ }).join('\n');
112
+ }
113
+ }
114
+ exports.ConfigCmd = ConfigCmd;
115
+
116
+ //# sourceMappingURL=config-cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_padRight","config","_interopRequireWildcard","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","ConfigSet","constructor","report","key","chalk","green","ConfigGet","ConfigList","conf","list","entries","map","tuple","join","ConfigDel","del","ConfigCmd","BASE_DOCS_DOMAIN","rightpad","exports"],"sources":["config-cmd.ts"],"sourcesContent":["/* eslint max-classes-per-file: 0 */\nimport chalk from 'chalk';\nimport rightpad from 'pad-right';\nimport * as config from '@teambit/legacy/dist/api/consumer/lib/global-config';\nimport { BASE_DOCS_DOMAIN } from '@teambit/legacy/dist/constants';\nimport { Command, CommandOptions } from '@teambit/cli';\n\nclass ConfigSet implements Command {\n name = 'set <key> <val>';\n description = 'set a global configuration';\n extendedDescription = `to set temporary configuration by env variable, prefix with \"BIT_CONFIG\", replace \".\" with \"_\" and change to upper case.\nfor example, \"user.token\" becomes \"BIT_CONFIG_USER_TOKEN\"`;\n baseUrl = 'reference/config/bit-config/';\n alias = '';\n skipWorkspace = true;\n options = [] as CommandOptions;\n loadAspects = false;\n\n async report([key, value]: [string, string]) {\n await config.set(key, value);\n return chalk.green('added configuration successfully');\n }\n}\n\nclass ConfigGet implements Command {\n name = 'get <key>';\n description = 'get a value from global configuration';\n alias = '';\n options = [] as CommandOptions;\n\n async report([key]: [string]) {\n const value = await config.get(key);\n return value || '';\n }\n}\n\nclass ConfigList implements Command {\n name = 'list';\n description = 'list all configuration(s)';\n alias = '';\n options = [] as CommandOptions;\n\n async report() {\n const conf: { [key: string]: string } = await config.list();\n return Object.entries(conf)\n .map((tuple) => {\n return tuple.join(' ');\n })\n .join('\\n');\n }\n}\n\nclass ConfigDel implements Command {\n name = 'del <key>';\n description = 'delete given key from global configuration';\n alias = '';\n options = [] as CommandOptions;\n\n async report([key]: [string]) {\n await config.del(key);\n return chalk.green('deleted successfully');\n }\n}\n\nexport class ConfigCmd implements Command {\n name = 'config';\n description = 'global config management';\n extendedDescription = `${BASE_DOCS_DOMAIN}reference/config/bit-config`;\n group = 'general';\n alias = '';\n commands = [new ConfigSet(), new ConfigDel(), new ConfigGet(), new ConfigList()];\n options = [] as CommandOptions;\n\n async report() {\n const conf: { [key: string]: string } = await config.list();\n return Object.entries(conf)\n .map((tuple) => {\n tuple[0] = rightpad(tuple[0], 45, ' ');\n return tuple.join('');\n })\n .join('\\n');\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAK,uBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkE,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CA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G;IACb,MAAMM,IAA+B,GAAG,MAAM3C,MAAM,CAAD,CAAC,CAAC4C,IAAI,CAAC,CAAC;IAC3D,OAAO7B,MAAM,CAAC8B,OAAO,CAACF,IAAI,CAAC,CACxBG,GAAG,CAAEC,KAAK,IAAK;MACdA,KAAK,CAAC,CAAC,CAAC,GAAG,IAAAM,mBAAQ,EAACN,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC;MACtC,OAAOA,KAAK,CAACC,IAAI,CAAC,EAAE,CAAC;IACvB,CAAC,CAAC,CACDA,IAAI,CAAC,IAAI,CAAC;EACf;AACF;AAACM,OAAA,CAAAH,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -46,6 +46,13 @@ function _system() {
46
46
  };
47
47
  return data;
48
48
  }
49
+ function _configCmd() {
50
+ const data = require("./config-cmd");
51
+ _configCmd = function () {
52
+ return data;
53
+ };
54
+ return data;
55
+ }
49
56
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
50
57
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
51
58
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -101,7 +108,7 @@ class GlobalConfigMain {
101
108
  const globalConfig = new GlobalConfigMain();
102
109
  const systemCmd = new (_system().SystemCmd)();
103
110
  systemCmd.commands = [new (_system().SystemLogCmd)(), new (_system().SystemTailLogCmd)()];
104
- cli.register(new (_globals().GlobalsCmd)(globalConfig), systemCmd);
111
+ cli.register(new (_globals().GlobalsCmd)(globalConfig), systemCmd, new (_configCmd().ConfigCmd)());
105
112
  return globalConfig;
106
113
  }
107
114
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_constants","_globalConfig","_globalConfig2","_globals","_system","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GlobalConfigMain","get","key","getBool","result","undefined","Error","getSync","list","listSync","set","val","setSync","del","delSync","getGlobalCapsulesBaseDir","CFG_CAPSULES_ROOT_BASE_DIR","GLOBALS_DEFAULT_CAPSULES","invalidateCache","getKnownGlobalDirs","CACHE_ROOT","DEBUG_LOG","GLOBAL_SCOPE","GLOBAL_CONFIG","provider","cli","globalConfig","systemCmd","SystemCmd","commands","SystemLogCmd","SystemTailLogCmd","register","GlobalsCmd","exports","MainRuntime","CLIAspect","GlobalConfigAspect","addRuntime"],"sources":["global-config.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport {\n CACHE_ROOT,\n DEBUG_LOG,\n GLOBAL_SCOPE,\n GLOBAL_CONFIG,\n CFG_CAPSULES_ROOT_BASE_DIR,\n GLOBALS_DEFAULT_CAPSULES,\n} from '@teambit/legacy/dist/constants';\nimport {\n del,\n delSync,\n get,\n getSync,\n list,\n listSync,\n set,\n setSync,\n invalidateCache,\n} from '@teambit/legacy/dist/api/consumer/lib/global-config';\nimport { GlobalConfig } from '@teambit/legacy/dist/global-config';\nimport { GlobalConfigAspect } from './global-config.aspect';\nimport { GlobalsCmd } from './globals.cmd';\nimport { SystemCmd, SystemLogCmd, SystemTailLogCmd } from './system.cmd';\n\nexport class GlobalConfigMain {\n static runtime = MainRuntime;\n static dependencies = [CLIAspect];\n static slots = [];\n\n async get(key: string): Promise<string | undefined> {\n return get(key);\n }\n\n async getBool(key: string): Promise<boolean | undefined> {\n const result = await get(key);\n if (result === undefined || result === null) return undefined;\n if (typeof result === 'boolean') return result;\n if (result === 'true') return true;\n if (result === 'false') return false;\n throw new Error(`the configuration \"${key}\" has an invalid value \"${result}\". it should be boolean`);\n }\n\n getSync(key: string): string | undefined {\n return getSync(key);\n }\n\n list(): Promise<Record<string, string>> {\n return list();\n }\n listSync(): Record<string, string> {\n return listSync();\n }\n\n async set(key: string, val: string): Promise<GlobalConfig> {\n return set(key, val);\n }\n setSync(key: string, val: string): GlobalConfig {\n return setSync(key, val);\n }\n\n async del(key: string): Promise<GlobalConfig> {\n return del(key);\n }\n\n delSync(key: string): GlobalConfig {\n return delSync(key);\n }\n\n getGlobalCapsulesBaseDir() {\n return this.getSync(CFG_CAPSULES_ROOT_BASE_DIR) || GLOBALS_DEFAULT_CAPSULES;\n }\n\n invalidateCache() {\n invalidateCache();\n }\n\n getKnownGlobalDirs() {\n return {\n 'Global Dir': CACHE_ROOT,\n 'Log file': DEBUG_LOG,\n 'Global Scope Dir': GLOBAL_SCOPE,\n 'Config Dir': GLOBAL_CONFIG,\n 'Capsules Dir': this.getGlobalCapsulesBaseDir(),\n };\n }\n\n static async provider([cli]: [CLIMain]) {\n const globalConfig = new GlobalConfigMain();\n const systemCmd = new SystemCmd();\n systemCmd.commands = [new SystemLogCmd(), new SystemTailLogCmd()];\n cli.register(new GlobalsCmd(globalConfig), systemCmd);\n return globalConfig;\n }\n}\n\nGlobalConfigAspect.addRuntime(GlobalConfigMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAYA,SAAAI,eAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAA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B,kBAAkB,EAAEC,yBAAY;MAChC,YAAY,EAAEC,0BAAa;MAC3B,cAAc,EAAE,IAAI,CAACR,wBAAwB,CAAC;IAChD,CAAC;EACH;EAEA,aAAaS,QAAQA,CAAC,CAACC,GAAG,CAAY,EAAE;IACtC,MAAMC,YAAY,GAAG,IAAI1B,gBAAgB,CAAC,CAAC;IAC3C,MAAM2B,SAAS,GAAG,KAAIC,mBAAS,EAAC,CAAC;IACjCD,SAAS,CAACE,QAAQ,GAAG,CAAC,KAAIC,sBAAY,EAAC,CAAC,EAAE,KAAIC,0BAAgB,EAAC,CAAC,CAAC;IACjEN,GAAG,CAACO,QAAQ,CAAC,KAAIC,qBAAU,EAACP,YAAY,CAAC,EAAEC,SAAS,CAAC;IACrD,OAAOD,YAAY;EACrB;AACF;AAACQ,OAAA,CAAAlC,gBAAA,GAAAA,gBAAA;AAAAnB,eAAA,CArEYmB,gBAAgB,aACVmC,kBAAW;AAAAtD,eAAA,CADjBmB,gBAAgB,kBAEL,CAACoC,gBAAS,CAAC;AAAAvD,eAAA,CAFtBmB,gBAAgB,WAGZ,EAAE;AAoEnBqC,mCAAkB,CAACC,UAAU,CAACtC,gBAAgB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_constants","_globalConfig","_globalConfig2","_globals","_system","_configCmd","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GlobalConfigMain","get","key","getBool","result","undefined","Error","getSync","list","listSync","set","val","setSync","del","delSync","getGlobalCapsulesBaseDir","CFG_CAPSULES_ROOT_BASE_DIR","GLOBALS_DEFAULT_CAPSULES","invalidateCache","getKnownGlobalDirs","CACHE_ROOT","DEBUG_LOG","GLOBAL_SCOPE","GLOBAL_CONFIG","provider","cli","globalConfig","systemCmd","SystemCmd","commands","SystemLogCmd","SystemTailLogCmd","register","GlobalsCmd","ConfigCmd","exports","MainRuntime","CLIAspect","GlobalConfigAspect","addRuntime"],"sources":["global-config.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport {\n CACHE_ROOT,\n DEBUG_LOG,\n GLOBAL_SCOPE,\n GLOBAL_CONFIG,\n CFG_CAPSULES_ROOT_BASE_DIR,\n GLOBALS_DEFAULT_CAPSULES,\n} from '@teambit/legacy/dist/constants';\nimport {\n del,\n delSync,\n get,\n getSync,\n list,\n listSync,\n set,\n setSync,\n invalidateCache,\n} from '@teambit/legacy/dist/api/consumer/lib/global-config';\nimport { GlobalConfig } from '@teambit/legacy/dist/global-config';\nimport { GlobalConfigAspect } from './global-config.aspect';\nimport { GlobalsCmd } from './globals.cmd';\nimport { SystemCmd, SystemLogCmd, SystemTailLogCmd } from './system.cmd';\nimport { ConfigCmd } from './config-cmd';\n\nexport class GlobalConfigMain {\n static runtime = MainRuntime;\n static dependencies = [CLIAspect];\n static slots = [];\n\n async get(key: string): Promise<string | undefined> {\n return get(key);\n }\n\n async getBool(key: string): Promise<boolean | undefined> {\n const result = await get(key);\n if (result === undefined || result === null) return undefined;\n if (typeof result === 'boolean') return result;\n if (result === 'true') return true;\n if (result === 'false') return false;\n throw new Error(`the configuration \"${key}\" has an invalid value \"${result}\". it should be boolean`);\n }\n\n getSync(key: string): string | undefined {\n return getSync(key);\n }\n\n list(): Promise<Record<string, string>> {\n return list();\n }\n listSync(): Record<string, string> {\n return listSync();\n }\n\n async set(key: string, val: string): Promise<GlobalConfig> {\n return set(key, val);\n }\n setSync(key: string, val: string): GlobalConfig {\n return setSync(key, val);\n }\n\n async del(key: string): Promise<GlobalConfig> {\n return del(key);\n }\n\n delSync(key: string): GlobalConfig {\n return delSync(key);\n }\n\n getGlobalCapsulesBaseDir() {\n return this.getSync(CFG_CAPSULES_ROOT_BASE_DIR) || GLOBALS_DEFAULT_CAPSULES;\n }\n\n invalidateCache() {\n invalidateCache();\n }\n\n getKnownGlobalDirs() {\n return {\n 'Global Dir': CACHE_ROOT,\n 'Log file': DEBUG_LOG,\n 'Global Scope Dir': GLOBAL_SCOPE,\n 'Config Dir': GLOBAL_CONFIG,\n 'Capsules Dir': this.getGlobalCapsulesBaseDir(),\n };\n }\n\n static async provider([cli]: [CLIMain]) {\n const globalConfig = new GlobalConfigMain();\n const systemCmd = new SystemCmd();\n systemCmd.commands = [new SystemLogCmd(), new SystemTailLogCmd()];\n cli.register(new GlobalsCmd(globalConfig), systemCmd, new ConfigCmd());\n return globalConfig;\n }\n}\n\nGlobalConfigAspect.addRuntime(GlobalConfigMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAYA,SAAAI,eAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,cAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;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G,CAAC,KAAIC,sBAAY,EAAC,CAAC,EAAE,KAAIC,0BAAgB,EAAC,CAAC,CAAC;IACjEN,GAAG,CAACO,QAAQ,CAAC,KAAIC,qBAAU,EAACP,YAAY,CAAC,EAAEC,SAAS,EAAE,KAAIO,sBAAS,EAAC,CAAC,CAAC;IACtE,OAAOR,YAAY;EACrB;AACF;AAACS,OAAA,CAAAnC,gBAAA,GAAAA,gBAAA;AAAAnB,eAAA,CArEYmB,gBAAgB,aACVoC,kBAAW;AAAAvD,eAAA,CADjBmB,gBAAgB,kBAEL,CAACqC,gBAAS,CAAC;AAAAxD,eAAA,CAFtBmB,gBAAgB,WAGZ,EAAE;AAoEnBsC,mCAAkB,CAACC,UAAU,CAACvC,gBAAgB,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_global-config@0.0.897/dist/global-config.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_global-config@0.0.897/dist/global-config.docs.md';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_global-config@0.0.899/dist/global-config.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_global-config@0.0.899/dist/global-config.docs.md';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@teambit/global-config",
3
- "version": "0.0.897",
3
+ "version": "0.0.899",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/global-config",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "global-config",
9
- "version": "0.0.897"
9
+ "version": "0.0.899"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
13
13
  "pad-right": "0.2.2",
14
14
  "fs-extra": "10.0.0",
15
15
  "@teambit/harmony": "0.4.6",
16
- "@teambit/cli": "0.0.894"
16
+ "@teambit/cli": "0.0.896"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/fs-extra": "9.0.7",