@teambit/clear-cache 0.0.535 → 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.
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- function _chalk() {
8
- const data = _interopRequireDefault(require("chalk"));
9
- _chalk = function () {
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 _chalk().default.green(`successfully cleaned the cache of "${remote}"`);
42
+ return (0, _cli().formatSuccessSummary)(`cleaned the cache of "${remote}"`);
44
43
  }
45
- return _chalk().default.red(`failed cleaning the cache of "${remote}"`);
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 title = 'the following cache(s) have been cleared:';
54
- const output = succeed.map(str => ` ✔ ${str}`).join('\n');
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 (!failed.length) return '';
59
- const title = 'the following cache(s) failed to clear:';
60
- const output = failed.map(str => ` X ${str}`).join('\n');
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 `${getSuccessOutput()}\n${getFailedOutput()}`;
60
+ return (0, _cli().joinSections)([getSuccessOutput(), getFailedOutput()]);
64
61
  }
65
62
  }
66
63
  exports.default = ClearCacheCmd;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","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","chalk","green","red","succeed","failed","getSuccessOutput","length","title","output","map","str","join","bold","getFailedOutput","exports"],"sources":["clear-cache-cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\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 chalk.green(`successfully cleaned the cache of \"${remote}\"`);\n }\n return chalk.red(`failed cleaning the cache of \"${remote}\"`);\n }\n const { succeed, failed } = await this.clearCache.clearCache();\n const getSuccessOutput = () => {\n if (!succeed.length) return '';\n const title = 'the following cache(s) have been cleared:';\n const output = succeed.map((str) => ` ✔ ${str}`).join('\\n');\n return chalk.green(`${chalk.bold(title)}\\n${output}`);\n };\n const getFailedOutput = () => {\n if (!failed.length) return '';\n const title = 'the following cache(s) failed to clear:';\n const output = failed.map((str) => ` X ${str}`).join('\\n');\n return chalk.red(`${chalk.bold(title)}\\n${output}`);\n };\n return `${getSuccessOutput()}\\n${getFailedOutput()}`;\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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,G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M,IAAI,CAACX,UAAU,CAACA,UAAU,CAAC,CAAC;IAC9D,MAAMY,gBAAgB,GAAGA,CAAA,KAAM;MAC7B,IAAI,CAACF,OAAO,CAACG,MAAM,EAAE,OAAO,EAAE;MAC9B,MAAMC,KAAK,GAAG,2CAA2C;MACzD,MAAMC,MAAM,GAAGL,OAAO,CAACM,GAAG,CAAEC,GAAG,IAAK,OAAOA,GAAG,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;MAC5D,OAAOX,gBAAK,CAACC,KAAK,CAAC,GAAGD,gBAAK,CAACY,IAAI,CAACL,KAAK,CAAC,KAAKC,MAAM,EAAE,CAAC;IACvD,CAAC;IACD,MAAMK,eAAe,GAAGA,CAAA,KAAM;MAC5B,IAAI,CAACT,MAAM,CAACE,MAAM,EAAE,OAAO,EAAE;MAC7B,MAAMC,KAAK,GAAG,yCAAyC;MACvD,MAAMC,MAAM,GAAGJ,MAAM,CAACK,GAAG,CAAEC,GAAG,IAAK,OAAOA,GAAG,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;MAC3D,OAAOX,gBAAK,CAACE,GAAG,CAAC,GAAGF,gBAAK,CAACY,IAAI,CAACL,KAAK,CAAC,KAAKC,MAAM,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,GAAGH,gBAAgB,CAAC,CAAC,KAAKQ,eAAe,CAAC,CAAC,EAAE;EACtD;AACF;AAACC,OAAA,CAAA1C,OAAA,GAAAmB,aAAA","ignoreList":[]}
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,YAA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,UAAU,CAACM,gBAAgB,CAACF,MAAM,CAAC;MAC9D,IAAIC,OAAO,EAAE;QACX,OAAO,IAAAE,2BAAoB,EAAC,yBAAyBH,MAAM,GAAG,CAAC;MACjE;MACA,OAAO,GAAGI,kBAAW,kCAAkCJ,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.535/dist/clear-cache.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_clear-cache@0.0.535/dist/clear-cache.docs.mdx';
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,22 +1,21 @@
1
1
  {
2
2
  "name": "@teambit/clear-cache",
3
- "version": "0.0.535",
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.535"
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
- "@teambit/scope.modules.find-scope-path": "0.0.26",
16
- "@teambit/workspace.modules.fs-cache": "0.0.48",
17
- "@teambit/workspace.modules.workspace-locator": "0.0.26",
18
- "@teambit/legacy.consumer": "0.0.106",
19
- "@teambit/scope.remotes": "0.0.106"
14
+ "@teambit/legacy.consumer": "0.0.107",
15
+ "@teambit/scope.remotes": "0.0.107",
16
+ "@teambit/scope.modules.find-scope-path": "0.0.27",
17
+ "@teambit/workspace.modules.fs-cache": "0.0.49",
18
+ "@teambit/workspace.modules.workspace-locator": "0.0.27"
20
19
  },
21
20
  "devDependencies": {
22
21
  "@types/fs-extra": "9.0.7",