@payloadcms/storage-gcs 3.0.0-beta.17 → 3.0.0-beta.19
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 +52 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -1 +1,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Google Cloud Storage for Payload
|
|
2
|
+
|
|
3
|
+
This package provides a simple way to use [Google Cloud Storage](https://cloud.google.com/storage) with Payload.
|
|
4
|
+
|
|
5
|
+
**NOTE:** This package removes the need to use `@payloadcms/plugin-cloud-storage` as was needed in Payload 2.x.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @payloadcms/storage-gcs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
- Configure the `collections` object to specify which collections should use the Vercel Blob adapter. The slug _must_ match one of your existing collection slugs.
|
|
16
|
+
- The `config` object can be any [`S3ClientConfig`](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3) object (from [`@aws-sdk/client-s3`](https://github.com/aws/aws-sdk-js-v3)). _This is highly dependent on your AWS setup_. Check the AWS documentation for more information.
|
|
17
|
+
- When enabled, this package will automatically set `disableLocalStorage` to `true` for each collection.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { gcsStorage } from '@payloadcms/storage-gcs'
|
|
21
|
+
import { Media } from './collections/Media'
|
|
22
|
+
import { MediaWithPrefix } from './collections/MediaWithPrefix'
|
|
23
|
+
|
|
24
|
+
export default buildConfig({
|
|
25
|
+
collections: [Media, MediaWithPrefix],
|
|
26
|
+
plugins: [
|
|
27
|
+
gcsStorage({
|
|
28
|
+
collections: {
|
|
29
|
+
[mediaSlug]: true,
|
|
30
|
+
[mediaWithPrefixSlug]: {
|
|
31
|
+
prefix,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
bucket: process.env.GCS_BUCKET,
|
|
35
|
+
options: {
|
|
36
|
+
apiEndpoint: process.env.GCS_ENDPOINT,
|
|
37
|
+
projectId: process.env.GCS_PROJECT_ID,
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Configuration Options
|
|
45
|
+
|
|
46
|
+
| Option | Description | Default |
|
|
47
|
+
| ------------- | --------------------------------------------------------------------------------------------------- | --------- |
|
|
48
|
+
| `enabled` | Whether or not to enable the plugin | `true` |
|
|
49
|
+
| `collections` | Collections to apply the storage to | |
|
|
50
|
+
| `bucket` | The name of the bucket to use | |
|
|
51
|
+
| `options` | Google Cloud Storage client configuration. See [Docs](https://github.com/googleapis/nodejs-storage) | |
|
|
52
|
+
| `acl` | Access control list for files that are uploaded | `Private` |
|
package/package.json
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/storage-gcs",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.19",
|
|
4
4
|
"description": "Payload storage adapter for Google Cloud Storage",
|
|
5
|
+
"homepage": "https://payloadcms.com",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/payloadcms/payload.git",
|
|
8
9
|
"directory": "packages/storage-gcs"
|
|
9
10
|
},
|
|
10
11
|
"license": "MIT",
|
|
11
|
-
"homepage": "https://payloadcms.com",
|
|
12
12
|
"author": "Payload CMS, Inc.",
|
|
13
|
-
"main": "./dist/index.js",
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
13
|
"type": "module",
|
|
16
14
|
"exports": {
|
|
17
15
|
".": {
|
|
@@ -20,27 +18,29 @@
|
|
|
20
18
|
"types": "./dist/index.d.ts"
|
|
21
19
|
}
|
|
22
20
|
},
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
23
26
|
"dependencies": {
|
|
24
27
|
"@google-cloud/storage": "^7.7.0",
|
|
25
|
-
"@payloadcms/plugin-cloud-storage": "3.0.0-beta.
|
|
28
|
+
"@payloadcms/plugin-cloud-storage": "3.0.0-beta.19"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"payload": "3.0.0-beta.
|
|
31
|
+
"payload": "3.0.0-beta.19"
|
|
29
32
|
},
|
|
30
33
|
"peerDependencies": {
|
|
31
|
-
"payload": "3.0.0-beta.
|
|
34
|
+
"payload": "3.0.0-beta.19"
|
|
32
35
|
},
|
|
33
36
|
"engines": {
|
|
34
37
|
"node": ">=18.20.2"
|
|
35
38
|
},
|
|
36
|
-
"files": [
|
|
37
|
-
"dist"
|
|
38
|
-
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "pnpm build:swc && pnpm build:types",
|
|
41
|
+
"build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
|
|
41
42
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
|
42
43
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
43
|
-
"build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
|
|
44
44
|
"clean": "rimraf {dist,*.tsbuildinfo}"
|
|
45
45
|
}
|
|
46
46
|
}
|