@teambit/clear-cache 0.0.536 → 0.0.537
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/clear-cache-cmd.js
CHANGED
|
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data =
|
|
9
|
-
|
|
7
|
+
function _cli() {
|
|
8
|
+
const data = require("@teambit/cli");
|
|
9
|
+
_cli = function () {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
14
|
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; }
|
|
16
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
16
|
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); }
|
|
@@ -40,27 +39,25 @@ note: this cache has minimal impact on disk space. to free significant disk spac
|
|
|
40
39
|
if (remote) {
|
|
41
40
|
const success = await this.clearCache.clearRemoteCache(remote);
|
|
42
41
|
if (success) {
|
|
43
|
-
return
|
|
42
|
+
return (0, _cli().formatSuccessSummary)(`cleaned the cache of "${remote}"`);
|
|
44
43
|
}
|
|
45
|
-
return
|
|
44
|
+
return `${_cli().errorSymbol} failed cleaning the cache of "${remote}"`;
|
|
46
45
|
}
|
|
47
46
|
const {
|
|
48
47
|
succeed,
|
|
49
|
-
failed
|
|
48
|
+
failed: failedCaches
|
|
50
49
|
} = await this.clearCache.clearCache();
|
|
51
50
|
const getSuccessOutput = () => {
|
|
52
51
|
if (!succeed.length) return '';
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
return _chalk().default.green(`${_chalk().default.bold(title)}\n${output}`);
|
|
52
|
+
const items = succeed.map(str => (0, _cli().formatItem)(str));
|
|
53
|
+
return `${(0, _cli().formatSuccessSummary)('caches cleared')}\n${items.join('\n')}`;
|
|
56
54
|
};
|
|
57
55
|
const getFailedOutput = () => {
|
|
58
|
-
if (!
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
return _chalk().default.red(`${_chalk().default.bold(title)}\n${output}`);
|
|
56
|
+
if (!failedCaches.length) return '';
|
|
57
|
+
const items = failedCaches.map(str => (0, _cli().formatItem)(str, _cli().errorSymbol));
|
|
58
|
+
return `${_cli().errorSymbol} ${(0, _cli().formatTitle)('caches failed to clear')}\n${items.join('\n')}`;
|
|
62
59
|
};
|
|
63
|
-
return
|
|
60
|
+
return (0, _cli().joinSections)([getSuccessOutput(), getFailedOutput()]);
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
exports.default = ClearCacheCmd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ClearCacheCmd","constructor","clearCache","extendedDescription","report","arg","remote","success","clearRemoteCache","formatSuccessSummary","errorSymbol","succeed","failed","failedCaches","getSuccessOutput","length","items","map","str","formatItem","join","getFailedOutput","formatTitle","joinSections","exports","default"],"sources":["clear-cache-cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { formatTitle, formatItem, formatSuccessSummary, errorSymbol, joinSections } from '@teambit/cli';\nimport type { ClearCacheMain } from './clear-cache.main.runtime';\n\nexport default class ClearCacheCmd implements Command {\n name = 'clear-cache';\n description = 'remove cached data to resolve stale data issues';\n group = 'system';\n extendedDescription: string;\n alias = 'cc';\n options = [['r', 'remote <remote-name>', 'clear memory cache from a remote scope']] as CommandOptions;\n loader = false;\n skipWorkspace = true;\n helpUrl = 'reference/workspace/clearing-cache';\n\n constructor(private clearCache: ClearCacheMain) {\n this.extendedDescription = `clears various caches that Bit uses to improve performance. useful when experiencing stale data issues or\nunexpected behavior. this command removes:\n1) components cache on the filesystem (mainly the dependencies graph and docs)\n2) scope's index file, which maps the component-id:object-hash\n\nnote: this cache has minimal impact on disk space. to free significant disk space, use \"bit capsule delete --all\" to remove build capsules.`;\n }\n\n async report(arg, { remote }: { remote?: string }): Promise<string> {\n if (remote) {\n const success = await this.clearCache.clearRemoteCache(remote);\n if (success) {\n return formatSuccessSummary(`cleaned the cache of \"${remote}\"`);\n }\n return `${errorSymbol} failed cleaning the cache of \"${remote}\"`;\n }\n const { succeed, failed: failedCaches } = await this.clearCache.clearCache();\n const getSuccessOutput = () => {\n if (!succeed.length) return '';\n const items = succeed.map((str) => formatItem(str));\n return `${formatSuccessSummary('caches cleared')}\\n${items.join('\\n')}`;\n };\n const getFailedOutput = () => {\n if (!failedCaches.length) return '';\n const items = failedCaches.map((str) => formatItem(str, errorSymbol));\n return `${errorSymbol} ${formatTitle('caches failed to clear')}\\n${items.join('\\n')}`;\n };\n return joinSections([getSuccessOutput(), getFailedOutput()]);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwG,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,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CJ,MAAM,GAAG;IAClE;IACA,MAAM;MAAEK,OAAO;MAAEC,MAAM,EAAEC;IAAa,CAAC,GAAG,MAAM,IAAI,CAACX,UAAU,CAACA,UAAU,CAAC,CAAC;IAC5E,MAAMY,gBAAgB,GAAGA,CAAA,KAAM;MAC7B,IAAI,CAACH,OAAO,CAACI,MAAM,EAAE,OAAO,EAAE;MAC9B,MAAMC,KAAK,GAAGL,OAAO,CAACM,GAAG,CAAEC,GAAG,IAAK,IAAAC,iBAAU,EAACD,GAAG,CAAC,CAAC;MACnD,OAAO,GAAG,IAAAT,2BAAoB,EAAC,gBAAgB,CAAC,KAAKO,KAAK,CAACI,IAAI,CAAC,IAAI,CAAC,EAAE;IACzE,CAAC;IACD,MAAMC,eAAe,GAAGA,CAAA,KAAM;MAC5B,IAAI,CAACR,YAAY,CAACE,MAAM,EAAE,OAAO,EAAE;MACnC,MAAMC,KAAK,GAAGH,YAAY,CAACI,GAAG,CAAEC,GAAG,IAAK,IAAAC,iBAAU,EAACD,GAAG,EAAER,kBAAW,CAAC,CAAC;MACrE,OAAO,GAAGA,kBAAW,IAAI,IAAAY,kBAAW,EAAC,wBAAwB,CAAC,KAAKN,KAAK,CAACI,IAAI,CAAC,IAAI,CAAC,EAAE;IACvF,CAAC;IACD,OAAO,IAAAG,mBAAY,EAAC,CAACT,gBAAgB,CAAC,CAAC,EAAEO,eAAe,CAAC,CAAC,CAAC,CAAC;EAC9D;AACF;AAACG,OAAA,CAAAC,OAAA,GAAAzB,aAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.537/dist/clear-cache.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.537/dist/clear-cache.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/clear-cache",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.537",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/workspace/clear-cache",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.workspace",
|
|
8
8
|
"name": "clear-cache",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.537"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"chalk": "4.1.2",
|
|
13
12
|
"fs-extra": "10.0.0",
|
|
14
13
|
"@teambit/harmony": "0.4.7",
|
|
15
14
|
"@teambit/legacy.consumer": "0.0.107",
|