@be-link/cos 1.12.7 → 1.12.9

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/bin/upload.js CHANGED
@@ -62,9 +62,7 @@ async function getTempCredentials(mode) {
62
62
 
63
63
  try {
64
64
  const response = await fetch(url, { method: 'POST' });
65
- console.log('🔐 响应:', response);
66
65
  const result = await response.json();
67
- console.log('🔐 结果:', result);
68
66
  const data = result?.data || {};
69
67
  const credentials = data?.credentials;
70
68
 
@@ -121,10 +119,18 @@ async function initCOS() {
121
119
  const secretId = process.env.COS_SECRET_ID;
122
120
  const secretKey = process.env.COS_SECRET_KEY;
123
121
 
122
+ if (!secretId || !secretKey) {
123
+ console.error('❌ 错误:未找到 COS 密钥配置');
124
+ console.error(' 请设置环境变量:');
125
+ console.error(' - COS_SECRET_ID');
126
+ console.error(' - COS_SECRET_KEY');
127
+ process.exit(1);
128
+ }
129
+
124
130
  console.log('✅ 使用环境变量中的密钥');
125
131
  cos = new COS({
126
- SecretId: 'AKIDx3wfJo5e4FAqHSOJ5cu2y3zh9MK2Uhy6',
127
- SecretKey: '3sgW7V7W1PZWIqAKI8krpY3JL9j5C3e1',
132
+ SecretId: secretId,
133
+ SecretKey: secretKey,
128
134
  });
129
135
 
130
136
  return cos;
@@ -140,7 +146,7 @@ function upload(url, filename, retryCount = 0, maxRetries = 3) {
140
146
  reject(new Error('上传参数错误:url 和 filename 不能为空'));
141
147
  return;
142
148
  }
143
-
149
+ console.log('🔐 上传参数:', { url, filename, bucketConfig, region, projectRemoteUrl });
144
150
  cos.putObject(
145
151
  {
146
152
  Bucket: bucketConfig.name,
@@ -155,6 +161,8 @@ function upload(url, filename, retryCount = 0, maxRetries = 3) {
155
161
  // },
156
162
  },
157
163
  function (err, data) {
164
+ console.log(`🔐 上传结果: ${JSON.stringify(data)}`);
165
+ console.log(`❕ 上传失败: ${JSON.stringify(err)}`);
158
166
  if (err) {
159
167
  // 重试逻辑
160
168
  if (retryCount < maxRetries) {
package/dist/index.cjs.js CHANGED
@@ -31,8 +31,8 @@ const BUCKETS_CONFIG = {
31
31
  const PROJECT_BUCKETS_CONFIG = {
32
32
  'be-link-live-h5': {
33
33
  production: {
34
- name: 'release-belink-1304510571',
35
- host: 'release-belink-1304510571.cos.ap-shanghai.myqcloud.com',
34
+ name: 'release-belink-ec-1304510571',
35
+ host: 'release-belink-ec-1304510571.cos.ap-nanjing.myqcloud.com',
36
36
  protocol: 'https',
37
37
  },
38
38
  },
package/dist/index.esm.js CHANGED
@@ -29,8 +29,8 @@ const BUCKETS_CONFIG = {
29
29
  const PROJECT_BUCKETS_CONFIG = {
30
30
  'be-link-live-h5': {
31
31
  production: {
32
- name: 'release-belink-1304510571',
33
- host: 'release-belink-1304510571.cos.ap-shanghai.myqcloud.com',
32
+ name: 'release-belink-ec-1304510571',
33
+ host: 'release-belink-ec-1304510571.cos.ap-nanjing.myqcloud.com',
34
34
  protocol: 'https',
35
35
  },
36
36
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/cos",
3
- "version": "1.12.7",
3
+ "version": "1.12.9",
4
4
  "description": "前端项目产物上传cos",
5
5
  "homepage": "https://github.com/snowmountain-top/be-link#readme",
6
6
  "author": "zhuiyi",