@lage-run/cache-github-actions 0.1.1
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/CHANGELOG.json +20 -0
- package/CHANGELOG.md +13 -0
- package/jest.config.js +1 -0
- package/lib/cacheProvider.d.ts +3 -0
- package/lib/cacheProvider.js +35 -0
- package/lib/cacheProvider.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/package.json +36 -0
- package/tsconfig.json +20 -0
package/CHANGELOG.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lage-run/cache-github-actions",
|
|
3
|
+
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Tue, 04 Oct 2022 15:57:17 GMT",
|
|
6
|
+
"tag": "@lage-run/cache-github-actions_v0.1.1",
|
|
7
|
+
"version": "0.1.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "ken@gizzar.com",
|
|
12
|
+
"package": "@lage-run/cache-github-actions",
|
|
13
|
+
"commit": "77aa5d1300e8cb708f8a3ed4b82010a2affc76a7",
|
|
14
|
+
"comment": "A new custom backfill cache provider for github actions"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Change Log - @lage-run/cache-github-actions
|
|
2
|
+
|
|
3
|
+
This log was last generated on Tue, 04 Oct 2022 15:57:17 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 0.1.1
|
|
8
|
+
|
|
9
|
+
Tue, 04 Oct 2022 15:57:17 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- A new custom backfill cache provider for github actions (ken@gizzar.com)
|
package/jest.config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("monorepo-scripts/config/jest.config.js");
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cacheProvider = void 0;
|
|
7
|
+
const cache_1 = __importDefault(require("@actions/cache"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const workspace_tools_1 = require("workspace-tools");
|
|
10
|
+
const root = (0, workspace_tools_1.getWorkspaceRoot)(process.cwd());
|
|
11
|
+
const cacheProvider = {
|
|
12
|
+
provider: (_logger, cwd) => {
|
|
13
|
+
return {
|
|
14
|
+
async fetch(hash) {
|
|
15
|
+
if (!hash) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const paths = [path_1.default.relative(root, path_1.default.join(cwd, "**"))];
|
|
19
|
+
const restoreKeys = ["lage-"];
|
|
20
|
+
const cacheKey = await cache_1.default.restoreCache(paths, hash, restoreKeys);
|
|
21
|
+
return !!cacheKey;
|
|
22
|
+
},
|
|
23
|
+
async put(hash, filesToCache) {
|
|
24
|
+
if (!hash) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const paths = filesToCache.map((files) => path_1.default.relative(root, path_1.default.join(cwd, files)));
|
|
28
|
+
await cache_1.default.saveCache(paths, hash);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
name: "github-actions",
|
|
33
|
+
};
|
|
34
|
+
exports.cacheProvider = cacheProvider;
|
|
35
|
+
//# sourceMappingURL=cacheProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheProvider.js","sourceRoot":"","sources":["../src/cacheProvider.ts"],"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
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var cacheProvider_1 = require("./cacheProvider");
|
|
5
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return cacheProvider_1.cacheProvider; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAA2D;AAAlD,wGAAA,aAAa,OAAW"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lage-run/cache-github-actions",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Github Action Cache for Lage",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/microsoft/lage"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"types": "lib/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "monorepo-scripts tsc",
|
|
13
|
+
"start": "monorepo-scripts tsc -w --preserveWatchOutput",
|
|
14
|
+
"lint": "monorepo-scripts lint"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@lage-run/target-graph": "^0.4.2",
|
|
18
|
+
"@lage-run/logger": "^1.2.0",
|
|
19
|
+
"backfill-config": "^6.3.0",
|
|
20
|
+
"backfill-cache": "^5.6.1",
|
|
21
|
+
"backfill-hasher": "^6.4.2",
|
|
22
|
+
"backfill-logger": "^5.1.3",
|
|
23
|
+
"fast-glob": "^3.2.11",
|
|
24
|
+
"workspace-tools": "^0.28.0",
|
|
25
|
+
"@actions/cache": "^3.0.4"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@lage-run/monorepo-fixture": "*",
|
|
29
|
+
"@types/mock-fs": "4.13.1",
|
|
30
|
+
"monorepo-scripts": "*",
|
|
31
|
+
"mock-fs": "5.1.4"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"lib": ["ES2017"],
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"outDir": "./lib",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noImplicitAny": false,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"noUnusedLocals": false,
|
|
17
|
+
"sourceMap": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|