@teambit/global-config 0.0.842 → 0.0.843
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/preview/teambit_harmony_global_config-preview.js +1 -0
- package/dist/{preview-1703647408454.js → preview-1703698405864.js} +2 -2
- package/package.json +4 -4
- package/global-config.aspect.ts +0 -8
- package/global-config.main.runtime.ts +0 -93
- package/globals.cmd.ts +0 -37
- package/index.ts +0 -5
- package/system.cmd.ts +0 -33
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/global-config-preview"]=t():e["teambit.harmony/global-config-preview"]=t()}(self,(()=>(()=>{"use strict";var e={18390:(e,t,o)=>{var n={id:"teambit.harmony/global-config@0.0.843",homepage:"https://bit.cloud/teambit/harmony/global-config",exported:!0};function r(){const e=i(o(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,i.__bit_component=n;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/global-config.svg"}));a.__bit_component=n,t.Logo=a},87363:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>d,compositions_metadata:()=>u,overview:()=>f});var e={};o.r(e),o.d(e,{default:()=>s});var t=o(18390);o(87363);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var a=["components"];function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},c.apply(this,arguments)}var p={},l="wrapper";function s(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,a);return(0,r.mdx)(l,c({},p,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,r.mdx)("p",null,"This aspect let you read / change / delete bit's global config.")))}s.isMDXComponent=!0;const d=[t],f=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
|
@@ -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.843/dist/global-config.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_global-config@0.0.843/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,26 +1,26 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/global-config",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.843",
|
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.843"
|
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.
|
16
|
+
"@teambit/cli": "0.0.841"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
19
|
"@types/fs-extra": "9.0.7",
|
20
20
|
"@types/mocha": "9.1.0",
|
21
21
|
"@types/jest": "^29.2.2",
|
22
22
|
"@types/testing-library__jest-dom": "^5.9.5",
|
23
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
23
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.14"
|
24
24
|
},
|
25
25
|
"peerDependencies": {
|
26
26
|
"react": "^17.0.0 || ^18.0.0",
|
package/global-config.aspect.ts
DELETED
@@ -1,93 +0,0 @@
|
|
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
DELETED
@@ -1,37 +0,0 @@
|
|
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
DELETED
package/system.cmd.ts
DELETED
@@ -1,33 +0,0 @@
|
|
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
|
-
}
|