vite-plugin-deploy-oss 0.1.0 → 1.0.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/0.jpg +0 -0
- package/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/index.html +11 -0
- package/package.json +3 -2
- package/vite.config.ts +28 -0
package/0.jpg
ADDED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ function vitePluginDeployOss(option) {
|
|
|
60
60
|
showProgress = true,
|
|
61
61
|
...props
|
|
62
62
|
} = option || {};
|
|
63
|
+
let buildFailed = false;
|
|
63
64
|
let upload = false;
|
|
64
65
|
let outDir = "";
|
|
65
66
|
const maxListeners = Math.max(20, concurrency * 3);
|
|
@@ -140,8 +141,11 @@ function vitePluginDeployOss(option) {
|
|
|
140
141
|
name: "vite-plugin-deploy-oss",
|
|
141
142
|
apply: "build",
|
|
142
143
|
enforce: "post",
|
|
144
|
+
buildEnd(error) {
|
|
145
|
+
if (error) buildFailed = true;
|
|
146
|
+
},
|
|
143
147
|
config(config) {
|
|
144
|
-
if (!open) return;
|
|
148
|
+
if (!open || buildFailed) return;
|
|
145
149
|
const validationErrors = validateOptions();
|
|
146
150
|
if (validationErrors.length > 0) {
|
|
147
151
|
console.log(`${import_chalk.default.red("\u2717 \u914D\u7F6E\u9519\u8BEF:")}
|
|
@@ -157,7 +161,7 @@ ${validationErrors.map((err) => ` - ${err}`).join("\n")}`);
|
|
|
157
161
|
sequential: true,
|
|
158
162
|
order: "post",
|
|
159
163
|
async handler() {
|
|
160
|
-
if (!open || !upload) return;
|
|
164
|
+
if (!open || !upload || buildFailed) return;
|
|
161
165
|
console.log(`${import_chalk.default.blue("\u{1F680} \u5F00\u59CB\u4E0A\u4F20\u6587\u4EF6\u5230 OSS...")}
|
|
162
166
|
`);
|
|
163
167
|
const startTime = Date.now();
|
package/dist/index.mjs
CHANGED
|
@@ -26,6 +26,7 @@ function vitePluginDeployOss(option) {
|
|
|
26
26
|
showProgress = true,
|
|
27
27
|
...props
|
|
28
28
|
} = option || {};
|
|
29
|
+
let buildFailed = false;
|
|
29
30
|
let upload = false;
|
|
30
31
|
let outDir = "";
|
|
31
32
|
const maxListeners = Math.max(20, concurrency * 3);
|
|
@@ -106,8 +107,11 @@ function vitePluginDeployOss(option) {
|
|
|
106
107
|
name: "vite-plugin-deploy-oss",
|
|
107
108
|
apply: "build",
|
|
108
109
|
enforce: "post",
|
|
110
|
+
buildEnd(error) {
|
|
111
|
+
if (error) buildFailed = true;
|
|
112
|
+
},
|
|
109
113
|
config(config) {
|
|
110
|
-
if (!open) return;
|
|
114
|
+
if (!open || buildFailed) return;
|
|
111
115
|
const validationErrors = validateOptions();
|
|
112
116
|
if (validationErrors.length > 0) {
|
|
113
117
|
console.log(`${chalk.red("\u2717 \u914D\u7F6E\u9519\u8BEF:")}
|
|
@@ -123,7 +127,7 @@ ${validationErrors.map((err) => ` - ${err}`).join("\n")}`);
|
|
|
123
127
|
sequential: true,
|
|
124
128
|
order: "post",
|
|
125
129
|
async handler() {
|
|
126
|
-
if (!open || !upload) return;
|
|
130
|
+
if (!open || !upload || buildFailed) return;
|
|
127
131
|
console.log(`${chalk.blue("\u{1F680} \u5F00\u59CB\u4E0A\u4F20\u6587\u4EF6\u5230 OSS...")}
|
|
128
132
|
`);
|
|
129
133
|
const startTime = Date.now();
|
package/index.html
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Document</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<img style="width: 12px" src="./0.jpg" alt="" draggable="false" />
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-deploy-oss",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup",
|
|
45
|
-
"pack": "pnpm run build && pnpm pack"
|
|
45
|
+
"pack": "pnpm run build && pnpm pack",
|
|
46
|
+
"build:test": "vite build"
|
|
46
47
|
}
|
|
47
48
|
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vitePluginDeployOss from './src'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
vitePluginDeployOss({
|
|
7
|
+
open: true,
|
|
8
|
+
|
|
9
|
+
accessKeyId: process.env.zAccessKeyId || '',
|
|
10
|
+
accessKeySecret: process.env.zAccessKeySecret || '',
|
|
11
|
+
bucket: process.env.zBucket || '',
|
|
12
|
+
region: 'oss-cn-beijing',
|
|
13
|
+
alias: process.env.zBucketAlias || '',
|
|
14
|
+
uploadDir: `/test/__test/`,
|
|
15
|
+
skip: ['**/*.html', '**/pluginWebUpdateNotice/**'],
|
|
16
|
+
overwrite: true,
|
|
17
|
+
autoDelete: true,
|
|
18
|
+
|
|
19
|
+
// 修改打包后的资源路径
|
|
20
|
+
configBase: `${process.env.zBucketAlias || ''}/test/__test/`,
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
build: {
|
|
25
|
+
outDir: 'assets',
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
})
|