@goldstack/utils-s3-deployment 0.3.20
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
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Goldstack S3 Deployment
|
|
2
|
+
|
|
3
|
+
This library allows uploading folder contents to an S3 bucket. This is useful for publishing websites to S3.
|
|
4
|
+
|
|
5
|
+
This library is used to support the Goldstack [Next.js](https://goldstack.party/templates/nextjs) and [Next.js + Bootstrap](https://goldstack.party/templates/nextjs-bootstrap) templates.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface S3UploadParams {
|
|
2
|
+
userName: string;
|
|
3
|
+
region: string;
|
|
4
|
+
localPath: string;
|
|
5
|
+
bucket: string;
|
|
6
|
+
bucketPath: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const upload: (params: S3UploadParams) => Promise<void>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=utilsS3Deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilsS3Deployment.d.ts","sourceRoot":"","sources":["../src/utilsS3Deployment.ts"],"names":[],"mappings":"AAIA,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,WAAkB,cAAc,KAAG,QAAQ,IAAI,CAkBjE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.upload = void 0;
|
|
4
|
+
const infra_aws_1 = require("@goldstack/infra-aws");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const utils_aws_cli_1 = require("@goldstack/utils-aws-cli");
|
|
7
|
+
const upload = async (params) => {
|
|
8
|
+
const user = await (0, infra_aws_1.getAWSUser)(params.userName);
|
|
9
|
+
// command run twice, once without and once with delete to ensure that
|
|
10
|
+
// users will not try to request files that no longer exist
|
|
11
|
+
// during the upload process
|
|
12
|
+
// see https://github.com/aws/aws-cli/issues/1417
|
|
13
|
+
(0, utils_aws_cli_1.awsCli)({
|
|
14
|
+
command: `s3 sync . s3://${params.bucket}${params.bucketPath}`,
|
|
15
|
+
credentials: user,
|
|
16
|
+
workDir: (0, path_1.resolve)(params.localPath),
|
|
17
|
+
region: params.region,
|
|
18
|
+
});
|
|
19
|
+
(0, utils_aws_cli_1.awsCli)({
|
|
20
|
+
command: `s3 sync . s3://${params.bucket}${params.bucketPath} --delete`,
|
|
21
|
+
credentials: user,
|
|
22
|
+
workDir: (0, path_1.resolve)(params.localPath),
|
|
23
|
+
region: params.region,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.upload = upload;
|
|
27
|
+
//# sourceMappingURL=utilsS3Deployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilsS3Deployment.js","sourceRoot":"","sources":["../src/utilsS3Deployment.ts"],"names":[],"mappings":";;;AAAA,oDAAkD;AAClD,+BAA+B;AAC/B,4DAAkD;AAU3C,MAAM,MAAM,GAAG,KAAK,EAAE,MAAsB,EAAiB,EAAE;IACpE,MAAM,IAAI,GAAG,MAAM,IAAA,sBAAU,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC/C,sEAAsE;IACtE,2DAA2D;IAC3D,4BAA4B;IAC5B,iDAAiD;IACjD,IAAA,sBAAM,EAAC;QACL,OAAO,EAAE,kBAAkB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE;QAC9D,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,IAAA,cAAO,EAAC,MAAM,CAAC,SAAS,CAAC;QAClC,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;IACH,IAAA,sBAAM,EAAC;QACL,OAAO,EAAE,kBAAkB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,WAAW;QACvE,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,IAAA,cAAO,EAAC,MAAM,CAAC,SAAS,CAAC;QAClC,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;AACL,CAAC,CAAC;AAlBW,QAAA,MAAM,UAkBjB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@goldstack/utils-s3-deployment",
|
|
3
|
+
"version": "0.3.20",
|
|
4
|
+
"description": "Utility for deploying files to S3",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"goldstack",
|
|
7
|
+
"utility",
|
|
8
|
+
"s3",
|
|
9
|
+
"deployment",
|
|
10
|
+
"s3 upload"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://goldstack.party",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/goldstack/goldstack/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/goldstack/goldstack.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Max Rohde",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"main": "dist/utilsS3Deployment.js",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "yarn clean && yarn compile",
|
|
26
|
+
"build:watch": "yarn clean && yarn compile:watch",
|
|
27
|
+
"clean": "rm -rf ./dist",
|
|
28
|
+
"compile": "tsc -p tsconfig.json",
|
|
29
|
+
"compile:watch": "tsc -p tsconfig.json --watch",
|
|
30
|
+
"compile:watch:light": "nodemon --watch ./src/ -e '*' --exec 'yarn compile'",
|
|
31
|
+
"coverage": "jest --collect-coverage --passWithNoTests --config=./jest.config.js",
|
|
32
|
+
"prepublishOnly": "yarn run build",
|
|
33
|
+
"publish": "utils-git changed --exec \"yarn npm publish $@\"",
|
|
34
|
+
"test:ci": "jest --passWithNoTests --config=./jest.config.js",
|
|
35
|
+
"version:apply": "utils-git changed --exec \"yarn version $@ && yarn version apply\"",
|
|
36
|
+
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@goldstack/infra-aws": "0.3.17",
|
|
40
|
+
"@goldstack/utils-aws-cli": "0.3.20",
|
|
41
|
+
"@goldstack/utils-docker": "0.3.15",
|
|
42
|
+
"@goldstack/utils-sh": "0.4.13"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@goldstack/utils-git": "0.1.26",
|
|
46
|
+
"@types/jest": "^26.0.21",
|
|
47
|
+
"@types/node": "^14.0.6",
|
|
48
|
+
"jest": "^26.6.3",
|
|
49
|
+
"ts-jest": "^26.5.4",
|
|
50
|
+
"typescript": "^4.4.3"
|
|
51
|
+
}
|
|
52
|
+
}
|