@lage-run/cli 0.33.2 → 0.33.3

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/jest.config.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("@lage-run/monorepo-scripts/config/jest.config.js");
@@ -1,5 +0,0 @@
1
- import type { TargetRunner, TargetRunnerOptions } from "@lage-run/runners";
2
- export declare class ClearCacheRunner implements TargetRunner {
3
- shouldRun(): Promise<boolean>;
4
- run(runOptions: TargetRunnerOptions): Promise<void>;
5
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ClearCacheRunner", {
6
- enumerable: true,
7
- get: function() {
8
- return ClearCacheRunner;
9
- }
10
- });
11
- const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
- const _promises = require("fs/promises");
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
19
- class ClearCacheRunner {
20
- async shouldRun() {
21
- return true;
22
- }
23
- async run(runOptions) {
24
- const { target } = runOptions;
25
- const { clearPaths } = target.options;
26
- for (const cachePath of clearPaths){
27
- if (_fs.default.existsSync(cachePath)) {
28
- const entries = _fs.default.readdirSync(cachePath);
29
- for (const entry of entries){
30
- const entryPath = _path.default.join(cachePath, entry);
31
- const entryStat = await (0, _promises.stat)(entryPath);
32
- await removeCacheEntry(entryPath, entryStat);
33
- }
34
- }
35
- }
36
- }
37
- }
38
- async function removeCacheEntry(entryPath, entryStat) {
39
- if (entryStat.isDirectory()) {
40
- return (0, _promises.rm)(entryPath, {
41
- recursive: true
42
- });
43
- } else {
44
- return (0, _promises.unlink)(entryPath);
45
- }
46
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/commands/cache/runners/ClearCacheRunner.ts"],"sourcesContent":["import type { TargetRunner, TargetRunnerOptions } from \"@lage-run/runners\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport { rm, stat, unlink } from \"fs/promises\";\n\nexport class ClearCacheRunner implements TargetRunner {\n async shouldRun(): Promise<boolean> {\n return true;\n }\n async run(runOptions: TargetRunnerOptions): Promise<void> {\n const { target } = runOptions;\n const { clearPaths } = target.options!;\n\n for (const cachePath of clearPaths) {\n if (fs.existsSync(cachePath)) {\n const entries = fs.readdirSync(cachePath);\n\n for (const entry of entries) {\n const entryPath = path.join(cachePath, entry);\n const entryStat = await stat(entryPath);\n await removeCacheEntry(entryPath, entryStat);\n }\n }\n }\n }\n}\n\nasync function removeCacheEntry(entryPath: string, entryStat: fs.Stats) {\n if (entryStat.isDirectory()) {\n return rm(entryPath, { recursive: true });\n } else {\n return unlink(entryPath);\n }\n}\n"],"names":["ClearCacheRunner","shouldRun","run","runOptions","target","clearPaths","options","cachePath","fs","existsSync","entries","readdirSync","entry","entryPath","path","join","entryStat","stat","removeCacheEntry","isDirectory","rm","recursive","unlink"],"mappings":";;;;+BAKaA;;;eAAAA;;;2DAJE;6DACE;0BACgB;;;;;;AAE1B,MAAMA;IACX,MAAMC,YAA8B;QAClC,OAAO;IACT;IACA,MAAMC,IAAIC,UAA+B,EAAiB;QACxD,MAAM,EAAEC,MAAM,EAAE,GAAGD;QACnB,MAAM,EAAEE,UAAU,EAAE,GAAGD,OAAOE,OAAO;QAErC,KAAK,MAAMC,aAAaF,WAAY;YAClC,IAAIG,WAAE,CAACC,UAAU,CAACF,YAAY;gBAC5B,MAAMG,UAAUF,WAAE,CAACG,WAAW,CAACJ;gBAE/B,KAAK,MAAMK,SAASF,QAAS;oBAC3B,MAAMG,YAAYC,aAAI,CAACC,IAAI,CAACR,WAAWK;oBACvC,MAAMI,YAAY,MAAMC,IAAAA,cAAI,EAACJ;oBAC7B,MAAMK,iBAAiBL,WAAWG;gBACpC;YACF;QACF;IACF;AACF;AAEA,eAAeE,iBAAiBL,SAAiB,EAAEG,SAAmB;IACpE,IAAIA,UAAUG,WAAW,IAAI;QAC3B,OAAOC,IAAAA,YAAE,EAACP,WAAW;YAAEQ,WAAW;QAAK;IACzC,OAAO;QACL,OAAOC,IAAAA,gBAAM,EAACT;IAChB;AACF"}
@@ -1,5 +0,0 @@
1
- import type { TargetRunner, TargetRunnerOptions } from "@lage-run/runners";
2
- export declare class PruneCacheRunner implements TargetRunner {
3
- shouldRun(): Promise<boolean>;
4
- run(runOptions: TargetRunnerOptions): Promise<void>;
5
- }
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "PruneCacheRunner", {
6
- enumerable: true,
7
- get: function() {
8
- return PruneCacheRunner;
9
- }
10
- });
11
- const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
- const _promises = require("fs/promises");
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
19
- const MS_IN_A_DAY = 1000 * 60 * 60 * 24;
20
- class PruneCacheRunner {
21
- async shouldRun() {
22
- return true;
23
- }
24
- async run(runOptions) {
25
- const { target } = runOptions;
26
- const { clearPaths, prunePeriod, now } = target.options;
27
- for (const cachePath of clearPaths){
28
- if (_fs.default.existsSync(cachePath)) {
29
- const entries = _fs.default.readdirSync(cachePath);
30
- for (const entry of entries){
31
- const entryPath = _path.default.join(cachePath, entry);
32
- const entryStat = await (0, _promises.stat)(entryPath);
33
- if (now - entryStat.mtime.getTime() > prunePeriod * MS_IN_A_DAY) {
34
- await removeCacheEntry(entryPath, entryStat);
35
- }
36
- }
37
- }
38
- }
39
- }
40
- }
41
- async function removeCacheEntry(entryPath, entryStat) {
42
- if (entryStat.isDirectory()) {
43
- return (0, _promises.rm)(entryPath, {
44
- recursive: true
45
- });
46
- } else {
47
- return (0, _promises.unlink)(entryPath);
48
- }
49
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/commands/cache/runners/PruneCacheRunner.ts"],"sourcesContent":["import type { TargetRunner, TargetRunnerOptions } from \"@lage-run/runners\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport { rm, stat, unlink } from \"fs/promises\";\n\nconst MS_IN_A_DAY = 1000 * 60 * 60 * 24;\n\nexport class PruneCacheRunner implements TargetRunner {\n async shouldRun(): Promise<boolean> {\n return true;\n }\n async run(runOptions: TargetRunnerOptions): Promise<void> {\n const { target } = runOptions;\n const { clearPaths, prunePeriod, now } = target.options!;\n\n for (const cachePath of clearPaths) {\n if (fs.existsSync(cachePath)) {\n const entries = fs.readdirSync(cachePath);\n\n for (const entry of entries) {\n const entryPath = path.join(cachePath, entry);\n const entryStat = await stat(entryPath);\n\n if (now - entryStat.mtime.getTime() > prunePeriod * MS_IN_A_DAY) {\n await removeCacheEntry(entryPath, entryStat);\n }\n }\n }\n }\n }\n}\n\nasync function removeCacheEntry(entryPath: string, entryStat: fs.Stats) {\n if (entryStat.isDirectory()) {\n return rm(entryPath, { recursive: true });\n } else {\n return unlink(entryPath);\n }\n}\n"],"names":["PruneCacheRunner","MS_IN_A_DAY","shouldRun","run","runOptions","target","clearPaths","prunePeriod","now","options","cachePath","fs","existsSync","entries","readdirSync","entry","entryPath","path","join","entryStat","stat","mtime","getTime","removeCacheEntry","isDirectory","rm","recursive","unlink"],"mappings":";;;;+BAOaA;;;eAAAA;;;2DANE;6DACE;0BACgB;;;;;;AAEjC,MAAMC,cAAc,OAAO,KAAK,KAAK;AAE9B,MAAMD;IACX,MAAME,YAA8B;QAClC,OAAO;IACT;IACA,MAAMC,IAAIC,UAA+B,EAAiB;QACxD,MAAM,EAAEC,MAAM,EAAE,GAAGD;QACnB,MAAM,EAAEE,UAAU,EAAEC,WAAW,EAAEC,GAAG,EAAE,GAAGH,OAAOI,OAAO;QAEvD,KAAK,MAAMC,aAAaJ,WAAY;YAClC,IAAIK,WAAE,CAACC,UAAU,CAACF,YAAY;gBAC5B,MAAMG,UAAUF,WAAE,CAACG,WAAW,CAACJ;gBAE/B,KAAK,MAAMK,SAASF,QAAS;oBAC3B,MAAMG,YAAYC,aAAI,CAACC,IAAI,CAACR,WAAWK;oBACvC,MAAMI,YAAY,MAAMC,IAAAA,cAAI,EAACJ;oBAE7B,IAAIR,MAAMW,UAAUE,KAAK,CAACC,OAAO,KAAKf,cAAcN,aAAa;wBAC/D,MAAMsB,iBAAiBP,WAAWG;oBACpC;gBACF;YACF;QACF;IACF;AACF;AAEA,eAAeI,iBAAiBP,SAAiB,EAAEG,SAAmB;IACpE,IAAIA,UAAUK,WAAW,IAAI;QAC3B,OAAOC,IAAAA,YAAE,EAACT,WAAW;YAAEU,WAAW;QAAK;IACzC,OAAO;QACL,OAAOC,IAAAA,gBAAM,EAACX;IAChB;AACF"}
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../tsconfig.lage2.json",
3
- "compilerOptions": {
4
- "outDir": "./lib"
5
- },
6
- "include": ["src/**/*.ts", "src/index.ts"]
7
- }