@teambit/global-config 0.0.840 → 0.0.842
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/global-config.composition.d.ts +2 -2
- package/dist/global-config.main.runtime.d.ts +1 -1
- package/dist/global-config.main.runtime.js +2 -2
- package/dist/global-config.main.runtime.js.map +1 -1
- package/dist/globals.cmd.js +2 -2
- package/dist/globals.cmd.js.map +1 -1
- package/dist/{preview-1703387662836.js → preview-1703647408454.js} +2 -2
- package/dist/system.cmd.js +2 -2
- package/dist/system.cmd.js.map +1 -1
- package/global-config.aspect.ts +8 -0
- package/global-config.main.runtime.ts +93 -0
- package/globals.cmd.ts +37 -0
- package/index.ts +5 -0
- package/package.json +12 -19
- package/system.cmd.ts +33 -0
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
export declare const Logo: () =>
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare const Logo: () => JSX.Element;
|
@@ -3,7 +3,7 @@ import { GlobalConfig } from '@teambit/legacy/dist/global-config';
|
|
3
3
|
export declare class GlobalConfigMain {
|
4
4
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
5
5
|
static dependencies: import("@teambit/harmony").Aspect[];
|
6
|
-
static slots:
|
6
|
+
static slots: any[];
|
7
7
|
get(key: string): Promise<string | undefined>;
|
8
8
|
getBool(key: string): Promise<boolean | undefined>;
|
9
9
|
getSync(key: string): string | undefined;
|
@@ -47,8 +47,8 @@ function _system() {
|
|
47
47
|
return data;
|
48
48
|
}
|
49
49
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
50
|
-
function _toPropertyKey(
|
51
|
-
function _toPrimitive(
|
50
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
51
|
+
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); }
|
52
52
|
class GlobalConfigMain {
|
53
53
|
async get(key) {
|
54
54
|
return (0, _globalConfig().get)(key);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_constants","_globalConfig","_globalConfig2","_globals","_system","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
1
|
+
{"version":3,"names":["_cli","data","require","_constants","_globalConfig","_globalConfig2","_globals","_system","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","GlobalConfigMain","get","getBool","result","undefined","Error","getSync","list","listSync","set","val","setSync","del","delSync","getGlobalCapsulesBaseDir","CFG_CAPSULES_ROOT_BASE_DIR","GLOBALS_DEFAULT_CAPSULES","getKnownGlobalDirs","CACHE_ROOT","DEBUG_LOG","GLOBAL_SCOPE","GLOBAL_CONFIG","provider","cli","globalConfig","systemCmd","SystemCmd","systemLogCmd","SystemLogCmd","commands","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} 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 } 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 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 const systemLogCmd = new SystemLogCmd();\n systemCmd.commands = [systemLogCmd];\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,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A,CAAChC,GAAW,EAAgB;IACjC,OAAO,IAAAgC,uBAAO,EAAChC,GAAG,CAAC;EACrB;EAEAiC,wBAAwBA,CAAA,EAAG;IACzB,OAAO,IAAI,CAACR,OAAO,CAACS,uCAA0B,CAAC,IAAIC,qCAAwB;EAC7E;EAEAC,kBAAkBA,CAAA,EAAG;IACnB,OAAO;MACL,YAAY,EAAEC,uBAAU;MACxB,UAAU,EAAEC,sBAAS;MACrB,kBAAkB,EAAEC,yBAAY;MAChC,YAAY,EAAEC,0BAAa;MAC3B,cAAc,EAAE,IAAI,CAACP,wBAAwB,CAAC;IAChD,CAAC;EACH;EAEA,aAAaQ,QAAQA,CAAC,CAACC,GAAG,CAAY,EAAE;IACtC,MAAMC,YAAY,GAAG,IAAIxB,gBAAgB,CAAC,CAAC;IAC3C,MAAMyB,SAAS,GAAG,KAAIC,mBAAS,EAAC,CAAC;IACjC,MAAMC,YAAY,GAAG,KAAIC,sBAAY,EAAC,CAAC;IACvCH,SAAS,CAACI,QAAQ,GAAG,CAACF,YAAY,CAAC;IACnCJ,GAAG,CAACO,QAAQ,CAAC,KAAIC,qBAAU,EAACP,YAAY,CAAC,EAAEC,SAAS,CAAC;IACrD,OAAOD,YAAY;EACrB;AACF;AAACQ,OAAA,CAAAhC,gBAAA,GAAAA,gBAAA;AAAArB,eAAA,CAlEYqB,gBAAgB,aACViC,kBAAW;AAAAtD,eAAA,CADjBqB,gBAAgB,kBAEL,CAACkC,gBAAS,CAAC;AAAAvD,eAAA,CAFtBqB,gBAAgB,WAGZ,EAAE;AAiEnBmC,mCAAkB,CAACC,UAAU,CAACpC,gBAAgB,CAAC"}
|
package/dist/globals.cmd.js
CHANGED
@@ -27,8 +27,8 @@ function _constants() {
|
|
27
27
|
}
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29
29
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
30
|
-
function _toPropertyKey(
|
31
|
-
function _toPrimitive(
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
31
|
+
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-disable-next-line max-classes-per-file
|
32
32
|
class GlobalsCmd {
|
33
33
|
constructor(globalConfig) {
|
34
34
|
this.globalConfig = globalConfig;
|
package/dist/globals.cmd.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_padRight","_constants","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_padRight","_constants","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","GlobalsCmd","constructor","globalConfig","report","list","json","leftCol","keys","padMax","Math","max","map","c","length","values","keyPadded","padRight","chalk","green","join","title","CACHE_GLOBALS_ENV","getKnownGlobalDirs","exports"],"sources":["globals.cmd.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport padRight from 'pad-right';\nimport { CACHE_GLOBALS_ENV } from '@teambit/legacy/dist/constants';\nimport { GlobalConfigMain } from './global-config.main.runtime';\n\nexport class GlobalsCmd implements Command {\n name = 'globals';\n description = `list all globals`;\n group = 'workspace';\n helpUrl = 'reference/config/config-files';\n alias = '';\n options = [['j', 'json', 'json format']] as CommandOptions;\n\n constructor(private globalConfig: GlobalConfigMain) {}\n\n async report() {\n const list = await this.json();\n const leftCol = Object.keys(list);\n const padMax = Math.max(...leftCol.map((c) => c.length)) + 1;\n const values = Object.keys(list)\n .map((key) => {\n const keyPadded = padRight(key, padMax, ' ');\n return `${chalk.green(keyPadded)} ${list[key]}`;\n })\n .join('\\n');\n\n const title = `the following globals are used by Bit. to change the global root dir, use \"${CACHE_GLOBALS_ENV}\" env variable`;\n\n return `${title}\\n\\n${values}`;\n }\n\n async json() {\n return this.globalConfig.getKnownGlobalDirs();\n }\n}\n"],"mappings":";;;;;;AAEA,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,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA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G,CAAE,EAAC;IACjD,CAAC,CAAC,CACDsC,IAAI,CAAC,IAAI,CAAC;IAEb,MAAMC,KAAK,GAAI,8EAA6EC,8BAAkB,gBAAe;IAE7H,OAAQ,GAAED,KAAM,OAAMN,MAAO,EAAC;EAChC;EAEA,MAAMT,IAAIA,CAAA,EAAG;IACX,OAAO,IAAI,CAACH,YAAY,CAACoB,kBAAkB,CAAC,CAAC;EAC/C;AACF;AAACC,OAAA,CAAAvB,UAAA,GAAAA,UAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_global-config@0.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_global-config@0.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_global-config@0.0.842/dist/global-config.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_global-config@0.0.842/dist/global-config.docs.md';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
package/dist/system.cmd.js
CHANGED
@@ -27,8 +27,8 @@ function _constants() {
|
|
27
27
|
}
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29
29
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
30
|
-
function _toPropertyKey(
|
31
|
-
function _toPrimitive(
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
31
|
+
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-disable-next-line max-classes-per-file
|
32
32
|
class SystemCmd {
|
33
33
|
constructor() {
|
34
34
|
_defineProperty(this, "name", 'system <sub-command>');
|
package/dist/system.cmd.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_chalk","_constants","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_chalk","_constants","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","SystemCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports","SystemLogCmd","logFile","fs","readFileSync","DEBUG_LOG"],"sources":["system.cmd.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\nimport { DEBUG_LOG } from '@teambit/legacy/dist/constants';\n\nexport class SystemCmd implements Command {\n name = 'system <sub-command>';\n description = `system operations`;\n group = 'workspace';\n alias = '';\n options = [] as CommandOptions;\n commands: Command[] = [];\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"system\", please run \"bit system --help\" to list the subcommands`\n );\n }\n}\n\nexport class SystemLogCmd implements Command {\n name = 'log';\n description = `print debug.log to the screen`;\n group = 'workspace';\n alias = '';\n options = [] as CommandOptions;\n\n async report() {\n const logFile = fs.readFileSync(DEBUG_LOG, 'utf8');\n return logFile;\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,SAAA;EAAA,MAA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AMO,MAAMW,SAAS,CAAoB;EAAAC,YAAA;IAAArB,eAAA,eACjC,sBAAsB;IAAAA,eAAA,sBACd,mBAAkB;IAAAA,eAAA,gBACzB,WAAW;IAAAA,eAAA,gBACX,EAAE;IAAAA,eAAA,kBACA,EAAE;IAAAA,eAAA,mBACU,EAAE;EAAA;EAExB,MAAMsB,MAAMA,CAAC,CAACC,sBAAsB,CAAW,EAAE;IAC/C,OAAOC,gBAAK,CAACC,GAAG,CACb,IAAGF,sBAAuB,2FAC7B,CAAC;EACH;AACF;AAACG,OAAA,CAAAN,SAAA,GAAAA,SAAA;AAEM,MAAMO,YAAY,CAAoB;EAAAN,YAAA;IAAArB,eAAA,eACpC,KAAK;IAAAA,eAAA,sBACG,+BAA8B;IAAAA,eAAA,gBACrC,WAAW;IAAAA,eAAA,gBACX,EAAE;IAAAA,eAAA,kBACA,EAAE;EAAA;EAEZ,MAAMsB,MAAMA,CAAA,EAAG;IACb,MAAMM,OAAO,GAAGC,kBAAE,CAACC,YAAY,CAACC,sBAAS,EAAE,MAAM,CAAC;IAClD,OAAOH,OAAO;EAChB;AACF;AAACF,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';
|
2
|
+
import {
|
3
|
+
CACHE_ROOT,
|
4
|
+
DEBUG_LOG,
|
5
|
+
GLOBAL_SCOPE,
|
6
|
+
GLOBAL_CONFIG,
|
7
|
+
CFG_CAPSULES_ROOT_BASE_DIR,
|
8
|
+
GLOBALS_DEFAULT_CAPSULES,
|
9
|
+
} from '@teambit/legacy/dist/constants';
|
10
|
+
import {
|
11
|
+
del,
|
12
|
+
delSync,
|
13
|
+
get,
|
14
|
+
getSync,
|
15
|
+
list,
|
16
|
+
listSync,
|
17
|
+
set,
|
18
|
+
setSync,
|
19
|
+
} from '@teambit/legacy/dist/api/consumer/lib/global-config';
|
20
|
+
import { GlobalConfig } from '@teambit/legacy/dist/global-config';
|
21
|
+
import { GlobalConfigAspect } from './global-config.aspect';
|
22
|
+
import { GlobalsCmd } from './globals.cmd';
|
23
|
+
import { SystemCmd, SystemLogCmd } from './system.cmd';
|
24
|
+
|
25
|
+
export class GlobalConfigMain {
|
26
|
+
static runtime = MainRuntime;
|
27
|
+
static dependencies = [CLIAspect];
|
28
|
+
static slots = [];
|
29
|
+
|
30
|
+
async get(key: string): Promise<string | undefined> {
|
31
|
+
return get(key);
|
32
|
+
}
|
33
|
+
|
34
|
+
async getBool(key: string): Promise<boolean | undefined> {
|
35
|
+
const result = await get(key);
|
36
|
+
if (result === undefined || result === null) return undefined;
|
37
|
+
if (typeof result === 'boolean') return result;
|
38
|
+
if (result === 'true') return true;
|
39
|
+
if (result === 'false') return false;
|
40
|
+
throw new Error(`the configuration "${key}" has an invalid value "${result}". it should be boolean`);
|
41
|
+
}
|
42
|
+
|
43
|
+
getSync(key: string): string | undefined {
|
44
|
+
return getSync(key);
|
45
|
+
}
|
46
|
+
|
47
|
+
list(): Promise<Record<string, string>> {
|
48
|
+
return list();
|
49
|
+
}
|
50
|
+
listSync(): Record<string, string> {
|
51
|
+
return listSync();
|
52
|
+
}
|
53
|
+
|
54
|
+
async set(key: string, val: string): Promise<GlobalConfig> {
|
55
|
+
return set(key, val);
|
56
|
+
}
|
57
|
+
setSync(key: string, val: string): GlobalConfig {
|
58
|
+
return setSync(key, val);
|
59
|
+
}
|
60
|
+
|
61
|
+
async del(key: string): Promise<GlobalConfig> {
|
62
|
+
return del(key);
|
63
|
+
}
|
64
|
+
|
65
|
+
delSync(key: string): GlobalConfig {
|
66
|
+
return delSync(key);
|
67
|
+
}
|
68
|
+
|
69
|
+
getGlobalCapsulesBaseDir() {
|
70
|
+
return this.getSync(CFG_CAPSULES_ROOT_BASE_DIR) || GLOBALS_DEFAULT_CAPSULES;
|
71
|
+
}
|
72
|
+
|
73
|
+
getKnownGlobalDirs() {
|
74
|
+
return {
|
75
|
+
'Global Dir': CACHE_ROOT,
|
76
|
+
'Log file': DEBUG_LOG,
|
77
|
+
'Global Scope Dir': GLOBAL_SCOPE,
|
78
|
+
'Config Dir': GLOBAL_CONFIG,
|
79
|
+
'Capsules Dir': this.getGlobalCapsulesBaseDir(),
|
80
|
+
};
|
81
|
+
}
|
82
|
+
|
83
|
+
static async provider([cli]: [CLIMain]) {
|
84
|
+
const globalConfig = new GlobalConfigMain();
|
85
|
+
const systemCmd = new SystemCmd();
|
86
|
+
const systemLogCmd = new SystemLogCmd();
|
87
|
+
systemCmd.commands = [systemLogCmd];
|
88
|
+
cli.register(new GlobalsCmd(globalConfig), systemCmd);
|
89
|
+
return globalConfig;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
GlobalConfigAspect.addRuntime(GlobalConfigMain);
|
package/globals.cmd.ts
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
// eslint-disable-next-line max-classes-per-file
|
2
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
3
|
+
import chalk from 'chalk';
|
4
|
+
import padRight from 'pad-right';
|
5
|
+
import { CACHE_GLOBALS_ENV } from '@teambit/legacy/dist/constants';
|
6
|
+
import { GlobalConfigMain } from './global-config.main.runtime';
|
7
|
+
|
8
|
+
export class GlobalsCmd implements Command {
|
9
|
+
name = 'globals';
|
10
|
+
description = `list all globals`;
|
11
|
+
group = 'workspace';
|
12
|
+
helpUrl = 'reference/config/config-files';
|
13
|
+
alias = '';
|
14
|
+
options = [['j', 'json', 'json format']] as CommandOptions;
|
15
|
+
|
16
|
+
constructor(private globalConfig: GlobalConfigMain) {}
|
17
|
+
|
18
|
+
async report() {
|
19
|
+
const list = await this.json();
|
20
|
+
const leftCol = Object.keys(list);
|
21
|
+
const padMax = Math.max(...leftCol.map((c) => c.length)) + 1;
|
22
|
+
const values = Object.keys(list)
|
23
|
+
.map((key) => {
|
24
|
+
const keyPadded = padRight(key, padMax, ' ');
|
25
|
+
return `${chalk.green(keyPadded)} ${list[key]}`;
|
26
|
+
})
|
27
|
+
.join('\n');
|
28
|
+
|
29
|
+
const title = `the following globals are used by Bit. to change the global root dir, use "${CACHE_GLOBALS_ENV}" env variable`;
|
30
|
+
|
31
|
+
return `${title}\n\n${values}`;
|
32
|
+
}
|
33
|
+
|
34
|
+
async json() {
|
35
|
+
return this.globalConfig.getKnownGlobalDirs();
|
36
|
+
}
|
37
|
+
}
|
package/index.ts
ADDED
package/package.json
CHANGED
@@ -1,35 +1,31 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/global-config",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.842",
|
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.
|
9
|
+
"version": "0.0.842"
|
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
|
-
"core-js": "^3.0.0",
|
16
|
-
"@babel/runtime": "7.20.0",
|
17
15
|
"@teambit/harmony": "0.4.6",
|
18
|
-
"@teambit/cli": "0.0.
|
16
|
+
"@teambit/cli": "0.0.840"
|
19
17
|
},
|
20
18
|
"devDependencies": {
|
21
|
-
"@types/react": "^17.0.8",
|
22
19
|
"@types/fs-extra": "9.0.7",
|
23
20
|
"@types/mocha": "9.1.0",
|
24
|
-
"@types/
|
25
|
-
"@types/
|
26
|
-
"@
|
27
|
-
"@types/testing-library__jest-dom": "5.9.5"
|
21
|
+
"@types/jest": "^29.2.2",
|
22
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
23
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.13"
|
28
24
|
},
|
29
25
|
"peerDependencies": {
|
30
|
-
"
|
31
|
-
"react": "^
|
32
|
-
"
|
26
|
+
"react": "^17.0.0 || ^18.0.0",
|
27
|
+
"@types/react": "^18.2.12",
|
28
|
+
"@teambit/legacy": "1.0.624"
|
33
29
|
},
|
34
30
|
"license": "Apache-2.0",
|
35
31
|
"optionalDependencies": {},
|
@@ -43,7 +39,7 @@
|
|
43
39
|
},
|
44
40
|
"private": false,
|
45
41
|
"engines": {
|
46
|
-
"node": ">=
|
42
|
+
"node": ">=16.0.0"
|
47
43
|
},
|
48
44
|
"repository": {
|
49
45
|
"type": "git",
|
@@ -52,12 +48,9 @@
|
|
52
48
|
"keywords": [
|
53
49
|
"bit",
|
54
50
|
"bit-aspect",
|
51
|
+
"bit-core-aspect",
|
55
52
|
"components",
|
56
53
|
"collaboration",
|
57
|
-
"web"
|
58
|
-
"react",
|
59
|
-
"react-components",
|
60
|
-
"angular",
|
61
|
-
"angular-components"
|
54
|
+
"web"
|
62
55
|
]
|
63
56
|
}
|
package/system.cmd.ts
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
// eslint-disable-next-line max-classes-per-file
|
2
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
3
|
+
import fs from 'fs-extra';
|
4
|
+
import chalk from 'chalk';
|
5
|
+
import { DEBUG_LOG } from '@teambit/legacy/dist/constants';
|
6
|
+
|
7
|
+
export class SystemCmd implements Command {
|
8
|
+
name = 'system <sub-command>';
|
9
|
+
description = `system operations`;
|
10
|
+
group = 'workspace';
|
11
|
+
alias = '';
|
12
|
+
options = [] as CommandOptions;
|
13
|
+
commands: Command[] = [];
|
14
|
+
|
15
|
+
async report([unrecognizedSubcommand]: [string]) {
|
16
|
+
return chalk.red(
|
17
|
+
`"${unrecognizedSubcommand}" is not a subcommand of "system", please run "bit system --help" to list the subcommands`
|
18
|
+
);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
export class SystemLogCmd implements Command {
|
23
|
+
name = 'log';
|
24
|
+
description = `print debug.log to the screen`;
|
25
|
+
group = 'workspace';
|
26
|
+
alias = '';
|
27
|
+
options = [] as CommandOptions;
|
28
|
+
|
29
|
+
async report() {
|
30
|
+
const logFile = fs.readFileSync(DEBUG_LOG, 'utf8');
|
31
|
+
return logFile;
|
32
|
+
}
|
33
|
+
}
|
package/tsconfig.json
CHANGED
@@ -1,38 +1,33 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
3
|
"lib": [
|
4
|
-
"
|
5
|
-
"
|
6
|
-
"
|
7
|
-
"DOM.Iterable",
|
8
|
-
"ScriptHost"
|
4
|
+
"esnext",
|
5
|
+
"dom",
|
6
|
+
"dom.Iterable"
|
9
7
|
],
|
10
|
-
"target": "
|
11
|
-
"module": "
|
12
|
-
"jsx": "react",
|
13
|
-
"allowJs": true,
|
14
|
-
"composite": true,
|
8
|
+
"target": "es2020",
|
9
|
+
"module": "es2020",
|
10
|
+
"jsx": "react-jsx",
|
15
11
|
"declaration": true,
|
16
12
|
"sourceMap": true,
|
17
|
-
"skipLibCheck": true,
|
18
13
|
"experimentalDecorators": true,
|
19
|
-
"
|
14
|
+
"skipLibCheck": true,
|
20
15
|
"moduleResolution": "node",
|
21
16
|
"esModuleInterop": true,
|
22
|
-
"rootDir": ".",
|
23
17
|
"resolveJsonModule": true,
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"strictPropertyInitialization": false,
|
28
|
-
"strict": true,
|
29
|
-
"noImplicitAny": false,
|
30
|
-
"preserveConstEnums": true
|
18
|
+
"allowJs": true,
|
19
|
+
"outDir": "dist",
|
20
|
+
"emitDeclarationOnly": true
|
31
21
|
},
|
32
22
|
"exclude": [
|
23
|
+
"artifacts",
|
24
|
+
"public",
|
33
25
|
"dist",
|
26
|
+
"node_modules",
|
27
|
+
"package.json",
|
34
28
|
"esm.mjs",
|
35
|
-
"
|
29
|
+
"**/*.cjs",
|
30
|
+
"./dist"
|
36
31
|
],
|
37
32
|
"include": [
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
5
5
|
declare module '*.svg' {
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
7
7
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
8
|
+
export const ReactComponent: FunctionComponent<
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
10
|
+
>;
|
9
11
|
const src: string;
|
10
12
|
export default src;
|
11
13
|
}
|
12
|
-
|
13
|
-
// @TODO Gilad
|
14
14
|
declare module '*.jpg' {
|
15
15
|
const value: any;
|
16
16
|
export = value;
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
27
27
|
const value: any;
|
28
28
|
export = value;
|
29
29
|
}
|
30
|
+
declare module '*.otf' {
|
31
|
+
const value: any;
|
32
|
+
export = value;
|
33
|
+
}
|
34
|
+
declare module '*.woff' {
|
35
|
+
const value: any;
|
36
|
+
export = value;
|
37
|
+
}
|
38
|
+
declare module '*.woff2' {
|
39
|
+
const value: any;
|
40
|
+
export = value;
|
41
|
+
}
|