|
@@ -1,5 +1,6 @@
|
|
const AWS = require('aws-sdk');
|
|
const AWS = require('aws-sdk');
|
|
const fs = require("fs");
|
|
const fs = require("fs");
|
|
|
|
+const uuid = require('uuid');
|
|
|
|
|
|
// 配置 AWS 访问凭证和 S3 区域
|
|
// 配置 AWS 访问凭证和 S3 区域
|
|
AWS.config.update({
|
|
AWS.config.update({
|
|
@@ -12,7 +13,7 @@ const s3 = new AWS.S3();
|
|
|
|
|
|
const bucketName = 'justlistenmusic4560.com';
|
|
const bucketName = 'justlistenmusic4560.com';
|
|
const filePath = 'bundle.js';
|
|
const filePath = 'bundle.js';
|
|
-const destinationPath = 'bundle2.js';
|
|
|
|
|
|
+const destinationPath = `${uuid.v4()}.js`;
|
|
|
|
|
|
const fileContent = fs.readFileSync(filePath);
|
|
const fileContent = fs.readFileSync(filePath);
|
|
|
|
|
|
@@ -22,7 +23,6 @@ const params = {
|
|
Body: fileContent,
|
|
Body: fileContent,
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
s3.upload(params)
|
|
s3.upload(params)
|
|
.promise()
|
|
.promise()
|
|
.then(data => {
|
|
.then(data => {
|