turborepo-remote-cache 1.7.3 → 1.8.0
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/README.md +8 -8
- package/build/plugins/remote-cache/index.js +1 -0
- package/build/plugins/remote-cache/index.js.map +1 -1
- package/build/plugins/remote-cache/routes/get-status.js +14 -0
- package/build/plugins/remote-cache/routes/get-status.js.map +1 -0
- package/build/plugins/remote-cache/routes/index.js +3 -1
- package/build/plugins/remote-cache/routes/index.js.map +1 -1
- package/build/plugins/remote-cache/routes/status-schema.js +11 -0
- package/build/plugins/remote-cache/routes/status-schema.js.map +1 -0
- package/package.json +26 -30
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
 [](https://github.com/ducktors/turborepo-remote-cache/actions/workflows/ci.yml) [](https://github.com/ducktors/turborepo-remote-cache/actions/workflows/release.yml) [](https://github.com/ducktors/turborepo-remote-cache/actions/workflows/docker.yml) [](https://coveralls.io/github/ducktors/turborepo-remote-cache?branch=main) [](https://hub.docker.com/r/fox1t/turborepo-remote-cache) [](
|
|
3
|
+
[](https://github.com/ducktors/turborepo-remote-cache/releases) [](https://github.com/ducktors/turborepo-remote-cache/actions/workflows/ci.yml) [](https://github.com/ducktors/turborepo-remote-cache/actions/workflows/release.yml) [](https://github.com/ducktors/turborepo-remote-cache/actions/workflows/docker.yml) [](https://coveralls.io/github/ducktors/turborepo-remote-cache?branch=main) [](https://hub.docker.com/r/fox1t/turborepo-remote-cache) [](https://www.npmjs.com/package/turborepo-remote-cache) [](https://github.com/semantic-release/semantic-release) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
4
4
|
[](#contributors-)
|
|
5
5
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
6
6
|
|
|
@@ -23,19 +23,19 @@ It supports several storage providers and deploys environments. Moreover, the pr
|
|
|
23
23
|
[Full documentation is available here](https://ducktors.github.io/turborepo-remote-cache/supported-storage-providers)
|
|
24
24
|
|
|
25
25
|
## Contribute to this project
|
|
26
|
-
1. Clone this repository
|
|
26
|
+
1. Clone this repository
|
|
27
27
|
|
|
28
28
|
```git clone git@github.com:ducktors/turborepo-remote-cache.git```
|
|
29
29
|
|
|
30
|
-
2. Move inside repository folder
|
|
30
|
+
2. Move inside repository folder
|
|
31
31
|
|
|
32
32
|
```cd turborepo-remote-cache```
|
|
33
33
|
|
|
34
|
-
3. Install dependencies
|
|
34
|
+
3. Install dependencies
|
|
35
35
|
|
|
36
|
-
```
|
|
36
|
+
```pnpm install```
|
|
37
37
|
|
|
38
|
-
4. Copy example variables
|
|
38
|
+
4. Copy example variables
|
|
39
39
|
|
|
40
40
|
```cp .env.example .env```
|
|
41
41
|
|
|
@@ -43,11 +43,11 @@ It supports several storage providers and deploys environments. Moreover, the pr
|
|
|
43
43
|
|
|
44
44
|
6. Run the project in development mode
|
|
45
45
|
|
|
46
|
-
```
|
|
46
|
+
```pnpm dev```
|
|
47
47
|
|
|
48
48
|
## How to commit
|
|
49
49
|
|
|
50
|
-
This repo uses [Semantic Release](https://github.com/semantic-release/semantic-release) with Conventional Commits.
|
|
50
|
+
This repo uses [Semantic Release](https://github.com/semantic-release/semantic-release) with Conventional Commits.
|
|
51
51
|
Releases are automatically created based on the type of commit message: feat for minor and fix for patch.
|
|
52
52
|
|
|
53
53
|
```
|
|
@@ -41,6 +41,7 @@ async function turboRemoteCache(instance, options) {
|
|
|
41
41
|
i.route(routes_1.headArtifact);
|
|
42
42
|
i.route(routes_1.putArtifact);
|
|
43
43
|
i.route(routes_1.artifactsEvents);
|
|
44
|
+
i.route(routes_1.getStatus);
|
|
44
45
|
}, { prefix: `/${apiVersion}` });
|
|
45
46
|
}
|
|
46
47
|
exports.default = turboRemoteCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/remote-cache/index.ts"],"names":[],"mappings":";;AACA,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act, artifactsEvents, headArtifact, getStatus } from './routes'\nimport { createLocation } from './storage'\nimport { STORAGE_PROVIDERS } from '../../env'\n\nasync function turboRemoteCache(\n instance: FastifyInstance,\n options: {\n allowedTokens: string[]\n apiVersion?: `v${number}`\n provider?: STORAGE_PROVIDERS\n },\n) {\n const bodyLimit = <number>instance.config.BODY_LIMIT\n const { allowedTokens, apiVersion = 'v8', provider = STORAGE_PROVIDERS.LOCAL } = options\n if (!(Array.isArray(allowedTokens) && allowedTokens.length)) {\n throw new Error(\n `'allowedTokens' options must be a string[], ${typeof allowedTokens} provided instead`,\n )\n }\n\n instance.addContentTypeParser<Buffer>(\n 'application/octet-stream',\n { parseAs: 'buffer', bodyLimit },\n async function parser(request, payload) {\n return payload\n },\n )\n\n const tokens = new Set<string>(allowedTokens)\n instance.addHook('onRequest', async function (request) {\n let authHeader = request.headers['authorization']\n authHeader = Array.isArray(authHeader) ? authHeader.join() : authHeader\n\n if (!authHeader) {\n throw badRequest(`Missing Authorization header`)\n }\n const [, token] = authHeader.split('Bearer ')\n if (!tokens.has(token)) {\n throw unauthorized(`Invalid authorization token`)\n }\n })\n\n instance.decorate(\n 'location',\n createLocation(provider, {\n accessKey: instance.config.S3_ACCESS_KEY,\n secretKey: instance.config.S3_SECRET_KEY,\n path: instance.config.STORAGE_PATH,\n region: instance.config.S3_REGION,\n endpoint: instance.config.S3_ENDPOINT,\n clientEmail: instance.config.GCS_CLIENT_EMAIL,\n privateKey: instance.config.GCS_PRIVATE_KEY?.replace(/\\\\n/g, '\\n'),\n projectId: instance.config.GCS_PROJECT_ID,\n useTmp: !!instance.config.STORAGE_PATH_USE_TMP_FOLDER,\n }),\n )\n\n await instance.register(\n async function (i) {\n i.route(getArtifact)\n i.route(headArtifact)\n i.route(putArtifact)\n i.route(artifactsEvents)\n i.route(getStatus)\n },\n { prefix: `/${apiVersion}` },\n )\n}\n\nexport default turboRemoteCache\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStatus = void 0;
|
|
4
|
+
const status_schema_1 = require("./status-schema");
|
|
5
|
+
exports.getStatus = {
|
|
6
|
+
method: 'GET',
|
|
7
|
+
url: '/artifacts/status',
|
|
8
|
+
schema: status_schema_1.statusRouteSchema,
|
|
9
|
+
logLevel: 'error',
|
|
10
|
+
async handler(req, reply) {
|
|
11
|
+
reply.send({ status: 'enabled' });
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=get-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-status.js","sourceRoot":"","sources":["../../../../src/plugins/remote-cache/routes/get-status.ts"],"names":[],"mappings":";;;AAGA,mDAAmD;AAEtC,QAAA,SAAS,GAQlB;IACF,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,mBAAmB;IACxB,MAAM,EAAE,iCAAiB;IACzB,QAAQ,EAAE,OAAO;IACjB,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK;QACtB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAA;IACnC,CAAC;CACF,CAAA","sourcesContent":["import type { Server } from 'http'\nimport type { RawReplyDefaultExpression, RawRequestDefaultExpression, RouteOptions } from 'fastify'\nimport { type Params, type Querystring } from './schema'\nimport { statusRouteSchema } from './status-schema'\n\nexport const getStatus: RouteOptions<\n Server,\n RawRequestDefaultExpression,\n RawReplyDefaultExpression,\n {\n Querystring: Querystring\n Params: Params\n }\n> = {\n method: 'GET',\n url: '/artifacts/status',\n schema: statusRouteSchema,\n logLevel: 'error',\n async handler(req, reply) {\n reply.send({ status: 'enabled' })\n },\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.artifactsEvents = exports.putArtifact = exports.headArtifact = exports.getArtifact = void 0;
|
|
3
|
+
exports.getStatus = exports.artifactsEvents = exports.putArtifact = exports.headArtifact = exports.getArtifact = void 0;
|
|
4
4
|
var get_artifact_1 = require("./get-artifact");
|
|
5
5
|
Object.defineProperty(exports, "getArtifact", { enumerable: true, get: function () { return get_artifact_1.getArtifact; } });
|
|
6
6
|
var head_artifact_1 = require("./head-artifact");
|
|
@@ -9,4 +9,6 @@ var put_artifact_1 = require("./put-artifact");
|
|
|
9
9
|
Object.defineProperty(exports, "putArtifact", { enumerable: true, get: function () { return put_artifact_1.putArtifact; } });
|
|
10
10
|
var artifacts_events_1 = require("./artifacts-events");
|
|
11
11
|
Object.defineProperty(exports, "artifactsEvents", { enumerable: true, get: function () { return artifacts_events_1.artifactsEvents; } });
|
|
12
|
+
var get_status_1 = require("./get-status");
|
|
13
|
+
Object.defineProperty(exports, "getStatus", { enumerable: true, get: function () { return get_status_1.getStatus; } });
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/remote-cache/routes/index.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,iDAA8C;AAArC,6GAAA,YAAY,OAAA;AACrB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,uDAAoD;AAA3C,mHAAA,eAAe,OAAA","sourcesContent":["export { getArtifact } from './get-artifact'\nexport { headArtifact } from './head-artifact'\nexport { putArtifact } from './put-artifact'\nexport { artifactsEvents } from './artifacts-events'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/remote-cache/routes/index.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,iDAA8C;AAArC,6GAAA,YAAY,OAAA;AACrB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,uDAAoD;AAA3C,mHAAA,eAAe,OAAA;AACxB,2CAAwC;AAA/B,uGAAA,SAAS,OAAA","sourcesContent":["export { getArtifact } from './get-artifact'\nexport { headArtifact } from './head-artifact'\nexport { putArtifact } from './put-artifact'\nexport { artifactsEvents } from './artifacts-events'\nexport { getStatus } from './get-status'\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statusRouteSchema = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const querystring = typebox_1.Type.Object({}, { additionalParameters: false });
|
|
6
|
+
const params = typebox_1.Type.Object({}, { additionalParameters: false });
|
|
7
|
+
exports.statusRouteSchema = {
|
|
8
|
+
querystring,
|
|
9
|
+
params,
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=status-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-schema.js","sourceRoot":"","sources":["../../../../src/plugins/remote-cache/routes/status-schema.ts"],"names":[],"mappings":";;;AAAA,+CAAgD;AAEhD,MAAM,WAAW,GAAG,cAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAA;AAGpE,MAAM,MAAM,GAAG,cAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAA;AAGlD,QAAA,iBAAiB,GAAG;IAC/B,WAAW;IACX,MAAM;CACP,CAAA","sourcesContent":["import { Static, Type } from '@sinclair/typebox'\n\nconst querystring = Type.Object({}, { additionalParameters: false })\nexport type Querystring = Static<typeof querystring>\n\nconst params = Type.Object({}, { additionalParameters: false })\nexport type Params = Static<typeof params>\n\nexport const statusRouteSchema = {\n querystring,\n params,\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turborepo-remote-cache",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Turborepo remote cache server",
|
|
5
5
|
"main": "build",
|
|
6
6
|
"author": "Maksim Sinik <maksim@sinik.it>",
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
"turborepo-remote-cache": "./build/cli.js"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"
|
|
12
|
+
"preinstall": "npx only-allow pnpm",
|
|
13
|
+
"prebuild": "pnpm lint && rimraf ./build",
|
|
13
14
|
"build": "tsc -p ./tsconfig.json",
|
|
14
15
|
"start": "node --enable-source-maps build/index.js",
|
|
15
|
-
"update": "npx npm-check -u",
|
|
16
16
|
"lint": "eslint --ext .ts --no-error-on-unmatched-pattern \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
17
17
|
"dev": "tsup --watch --onSuccess \"run-p dev:start check:types\"",
|
|
18
18
|
"dev:start": "node --inspect -r @cspotcode/source-map-support/register -r dotenv/config build/index.js",
|
|
19
19
|
"check:types": "tsc -p ./tsconfig.json --noEmit",
|
|
20
20
|
"test": "cross-env TS_NODE_PROJECT=./test/tsconfig.json tap --ts",
|
|
21
|
-
"posttest": "tap --coverage-report=lcov",
|
|
22
|
-
"test:watch": "
|
|
23
|
-
"test:report": "
|
|
21
|
+
"posttest": "tap --coverage-report=lcov --no-browser",
|
|
22
|
+
"test:watch": "pnpm test -- --watch",
|
|
23
|
+
"test:report": "pnpm test -- --output-file=out.tap && tap-mocha-reporter xunit < out.tap > junit-testresults.xml",
|
|
24
24
|
"commitlint": "commitlint",
|
|
25
25
|
"semantic-release": "semantic-release",
|
|
26
26
|
"commit": "npx git-cz",
|
|
@@ -31,25 +31,26 @@
|
|
|
31
31
|
"url": "git+https://github.com/ducktors/turborepo-remote-cache.git"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"fastify
|
|
45
|
-
"fastify-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"pino
|
|
51
|
-
"
|
|
52
|
-
"
|
|
34
|
+
"@commitlint/lint": "^17.2.0",
|
|
35
|
+
"@google-cloud/storage": "6.4.1",
|
|
36
|
+
"@hapi/boom": "9.1.4",
|
|
37
|
+
"@sinclair/typebox": "0.23.1",
|
|
38
|
+
"@vercel/node": "1.12.1",
|
|
39
|
+
"ajv": "8.11.0",
|
|
40
|
+
"aws-sdk": "2.1053.0",
|
|
41
|
+
"boom": "7.3.0",
|
|
42
|
+
"close-with-grace": "1.1.0",
|
|
43
|
+
"env-schema": "5.1.0",
|
|
44
|
+
"fastify": "3.25.0",
|
|
45
|
+
"fastify-autoload": "3.9.0",
|
|
46
|
+
"fastify-plugin": "3.0.0",
|
|
47
|
+
"fs-blob-store": "6.0.0",
|
|
48
|
+
"hyperid": "2.3.1",
|
|
49
|
+
"make-promises-safe": "5.1.0",
|
|
50
|
+
"pino": "6.13.3",
|
|
51
|
+
"pino-pretty": "7.3.0",
|
|
52
|
+
"s3-blob-store": "4.1.1",
|
|
53
|
+
"tslib": "2.3.1"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@commitlint/cli": "^17.1.2",
|
|
@@ -89,11 +90,6 @@
|
|
|
89
90
|
"tsup": "^5.11.6",
|
|
90
91
|
"typescript": "^4.5.4"
|
|
91
92
|
},
|
|
92
|
-
"config": {
|
|
93
|
-
"commitizen": {
|
|
94
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
93
|
"bugs": {
|
|
98
94
|
"url": "https://github.com/ducktors/turborepo-remote-cache/issues"
|
|
99
95
|
},
|