store-s3-aws 1.2.2 → 1.3.8
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/package.json +1 -1
- package/send-npm.sh +25 -0
- package/src/AwsS3Store.js +4 -4
package/package.json
CHANGED
package/send-npm.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
NPM_TOKEN="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"
|
|
6
|
+
|
|
7
|
+
# Usa token vindo da variável de ambiente
|
|
8
|
+
if [ -z "$NPM_TOKEN" ]; then
|
|
9
|
+
echo "❌ NPM_TOKEN não definido"
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
echo "🔑 Configurando token npm..."
|
|
14
|
+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
|
15
|
+
|
|
16
|
+
echo "📦 Atualizando versão (patch)..."
|
|
17
|
+
npm version patch
|
|
18
|
+
|
|
19
|
+
echo "🚀 Publicando no npm..."
|
|
20
|
+
npm publish --access public
|
|
21
|
+
|
|
22
|
+
echo "🧹 Limpando credenciais..."
|
|
23
|
+
rm -f .npmrc
|
|
24
|
+
|
|
25
|
+
echo "✅ Publicação concluída!"
|
package/src/AwsS3Store.js
CHANGED
|
@@ -51,11 +51,12 @@ class AwsS3Store {
|
|
|
51
51
|
async save(options) {
|
|
52
52
|
this.debugLog('[METHOD: save] Triggered.');
|
|
53
53
|
|
|
54
|
-
const
|
|
54
|
+
const fileName = path.basename(options.session)
|
|
55
|
+
const remoteFilePath = path.join(this.remoteDataPath, `${fileName}.zip`).replace(/\\/g, '/');
|
|
55
56
|
options.remoteFilePath = remoteFilePath;
|
|
56
|
-
await this.#deletePrevious(options);
|
|
57
|
+
//await this.#deletePrevious(options);
|
|
57
58
|
|
|
58
|
-
const fileStream = createReadStream(`${
|
|
59
|
+
const fileStream = createReadStream(`${fileName}.zip`);
|
|
59
60
|
|
|
60
61
|
const upload = new Upload({
|
|
61
62
|
client: this.#getClientS3(),
|
|
@@ -145,7 +146,6 @@ class AwsS3Store {
|
|
|
145
146
|
|
|
146
147
|
#getClientS3() {
|
|
147
148
|
if (this.#clientS3 === null) {
|
|
148
|
-
console.log(`access_key do store: ${process.env.AWS_ACCESS_KEY_ID}`)
|
|
149
149
|
this.#clientS3 = new S3Client({
|
|
150
150
|
region: this.clientConfig.region
|
|
151
151
|
});
|