vite-plugin-deploy-oss 3.4.1 → 3.4.2
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 +16 -54
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,26 +4,16 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/vite-plugin-deploy-oss)
|
|
5
5
|
[](https://www.npmjs.com/package/vite-plugin-deploy-oss)
|
|
6
6
|
|
|
7
|
-
Upload Vite build artifacts to Aliyun OSS.
|
|
8
|
-
[](https://www.npmjs.com/package/vite-plugin-deploy-oss)
|
|
9
|
-
[](https://www.npmjs.com/package/vite-plugin-deploy-oss)
|
|
10
|
-
[](https://www.npmjs.com/package/vite-plugin-deploy-oss)
|
|
11
|
-
|
|
12
7
|
Upload Vite build artifacts to Aliyun OSS.
|
|
13
8
|
|
|
14
9
|
## Installation
|
|
15
10
|
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
11
|
```bash
|
|
19
12
|
pnpm add vite-plugin-deploy-oss -D
|
|
20
13
|
```
|
|
21
14
|
|
|
22
15
|
## Quick Start
|
|
23
16
|
|
|
24
|
-
## Quick Start
|
|
25
|
-
|
|
26
|
-
It is recommended to control the deployment using environment variables to avoid accidental uploads during local builds.
|
|
27
17
|
It is recommended to control the deployment using environment variables to avoid accidental uploads during local builds.
|
|
28
18
|
|
|
29
19
|
```ts
|
|
@@ -51,7 +41,6 @@ export default defineConfig({
|
|
|
51
41
|
})
|
|
52
42
|
```
|
|
53
43
|
|
|
54
|
-
Run build and deploy:
|
|
55
44
|
Run build and deploy:
|
|
56
45
|
|
|
57
46
|
```bash
|
|
@@ -60,33 +49,22 @@ DEPLOY_OSS=1 pnpm build
|
|
|
60
49
|
|
|
61
50
|
## Configuration
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `debug` | `false` | Whether to output time cost information for debugging. |
|
|
80
|
-
| `fancy` | `true` | Whether to display a styled terminal progress bar. |
|
|
81
|
-
|
|
82
|
-
## Important Behaviors
|
|
83
|
-
|
|
84
|
-
- If `open: true` and any of the required options (`accessKeyId`, `accessKeySecret`, `bucket`, `region`, or `uploadDir`) are missing, the build process will fail and terminate.
|
|
85
|
-
- When `manifest` is enabled, all built files are uploaded automatically, and local build files are retained.
|
|
86
|
-
- When `manifest` is enabled, `skip` defaults to an empty array and `autoDelete` is forced to `false`.
|
|
87
|
-
- `oss-manifest.json` only tracks successfully uploaded files in the current build and does not include the manifest file itself.
|
|
88
|
-
- `configBase` affects both Vite's output asset paths and the URL addresses inside the manifest.
|
|
89
|
-
- `alias` only affects the URLs generated inside the manifest; it does not change the actual upload destination on OSS.
|
|
52
|
+
| Option | Default | Description |
|
|
53
|
+
| :--- | :--- | :--- |
|
|
54
|
+
| `open` | `true` | Whether to enable upload. Recommended to control with environment variables. |
|
|
55
|
+
| `accessKeyId` | - | OSS access key ID. |
|
|
56
|
+
| `accessKeySecret` | - | OSS access key secret. |
|
|
57
|
+
| `bucket` | - | OSS bucket name. |
|
|
58
|
+
| `region` | - | OSS region, e.g., `oss-cn-beijing`. |
|
|
59
|
+
| `uploadDir` | - | Target directory in OSS to upload files. |
|
|
60
|
+
| `configBase` | - | Modifies Vite's asset base path synchronously. |
|
|
61
|
+
| `skip` | `'**/index.html'` | Glob pattern for files to skip uploading. |
|
|
62
|
+
| `overwrite` | `true` | Whether to overwrite existing files on OSS with the same name. |
|
|
63
|
+
| `autoDelete` | `false` | Whether to delete local build files after successful upload. |
|
|
64
|
+
| `manifest` | `false` | Whether to generate and upload a build manifest file. |
|
|
65
|
+
| `failOnError` | `true` | Whether to abort the build process if upload fails. |
|
|
66
|
+
| `debug` | `false` | Whether to output time cost information for debugging. |
|
|
67
|
+
| `fancy` | `true` | Whether to display a styled terminal progress bar. |
|
|
90
68
|
|
|
91
69
|
## Important Behaviors
|
|
92
70
|
|
|
@@ -99,23 +77,19 @@ DEPLOY_OSS=1 pnpm build
|
|
|
99
77
|
|
|
100
78
|
## Manifest
|
|
101
79
|
|
|
102
|
-
Enable manifest:
|
|
103
80
|
Enable manifest:
|
|
104
81
|
|
|
105
82
|
```ts
|
|
106
83
|
vitePluginDeployOss({
|
|
107
|
-
// ...other options
|
|
108
84
|
// ...other options
|
|
109
85
|
manifest: true,
|
|
110
86
|
})
|
|
111
87
|
```
|
|
112
88
|
|
|
113
|
-
Customize manifest filename:
|
|
114
89
|
Customize manifest filename:
|
|
115
90
|
|
|
116
91
|
```ts
|
|
117
92
|
vitePluginDeployOss({
|
|
118
|
-
// ...other options
|
|
119
93
|
// ...other options
|
|
120
94
|
manifest: {
|
|
121
95
|
fileName: 'meta/oss-manifest.json',
|
|
@@ -123,7 +97,6 @@ vitePluginDeployOss({
|
|
|
123
97
|
})
|
|
124
98
|
```
|
|
125
99
|
|
|
126
|
-
Manifest JSON example:
|
|
127
100
|
Manifest JSON example:
|
|
128
101
|
|
|
129
102
|
```json
|
|
@@ -142,20 +115,15 @@ Manifest JSON example:
|
|
|
142
115
|
|
|
143
116
|
## Debugging
|
|
144
117
|
|
|
145
|
-
## Debugging
|
|
146
|
-
|
|
147
|
-
Enable `debug` to log the time taken for each key step during deployment, which helps locate bottlenecks:
|
|
148
118
|
Enable `debug` to log the time taken for each key step during deployment, which helps locate bottlenecks:
|
|
149
119
|
|
|
150
120
|
```ts
|
|
151
121
|
vitePluginDeployOss({
|
|
152
|
-
// ...other options
|
|
153
122
|
// ...other options
|
|
154
123
|
debug: process.env.DEPLOY_OSS_DEBUG === '1',
|
|
155
124
|
})
|
|
156
125
|
```
|
|
157
126
|
|
|
158
|
-
You can also run the playground command in the project:
|
|
159
127
|
You can also run the playground command in the project:
|
|
160
128
|
|
|
161
129
|
```bash
|
|
@@ -164,12 +132,6 @@ pnpm run build:test:debug
|
|
|
164
132
|
|
|
165
133
|
## Notes
|
|
166
134
|
|
|
167
|
-
## Notes
|
|
168
|
-
|
|
169
|
-
- It is highly recommended to use environment variables instead of hardcoding sensitive credentials.
|
|
170
|
-
- Keep `failOnError: true` for production builds to avoid completing the build/deployment pipeline when some files failed to upload.
|
|
171
|
-
- Make sure you do not need the local build directory before enabling `autoDelete`.
|
|
172
|
-
- The current version only supports ESM (`import` syntax). CommonJS (`require`) is not supported.
|
|
173
135
|
- It is highly recommended to use environment variables instead of hardcoding sensitive credentials.
|
|
174
136
|
- Keep `failOnError: true` for production builds to avoid completing the build/deployment pipeline when some files failed to upload.
|
|
175
137
|
- Make sure you do not need the local build directory before enabling `autoDelete`.
|