smartystreets-javascript-sdk 1.13.1 → 1.13.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/Makefile +0 -3
- package/package.json +1 -1
- package/browserify.js +0 -33
- package/s3.js +0 -39
package/Makefile
CHANGED
|
@@ -20,9 +20,6 @@ publish: clean test version upload unversion
|
|
|
20
20
|
upload:
|
|
21
21
|
npm publish
|
|
22
22
|
|
|
23
|
-
upload_s3:
|
|
24
|
-
node browserify.js && node s3.js
|
|
25
|
-
|
|
26
23
|
version:
|
|
27
24
|
sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE1)" && rm -f "$(VERSION_FILE1).bak"
|
|
28
25
|
sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE2)" && rm -f "$(VERSION_FILE2).bak"
|
package/package.json
CHANGED
package/browserify.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const distFolder = __dirname + "/dist";
|
|
3
|
-
|
|
4
|
-
fs.mkdir(distFolder, distFolderExists);
|
|
5
|
-
|
|
6
|
-
function distFolderExists(error) {
|
|
7
|
-
if (error) throw error;
|
|
8
|
-
|
|
9
|
-
const filePrefix = "smartystreets-sdk-";
|
|
10
|
-
const version = require("./package.json").version;
|
|
11
|
-
const fileName = distFolder + "/" + filePrefix + version;
|
|
12
|
-
const minifiedFile = fileName + ".min.js";
|
|
13
|
-
const standardFile = fileName + ".js";
|
|
14
|
-
const sdkEntryPoint = "./index.js";
|
|
15
|
-
const standaloneVariableName = "SmartyStreetsSDK";
|
|
16
|
-
const options = {
|
|
17
|
-
standalone: standaloneVariableName,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
let writeToDisk = (destination) => fs.createWriteStream(destination);
|
|
21
|
-
let browserify = require("browserify");
|
|
22
|
-
|
|
23
|
-
browserify(sdkEntryPoint, options)
|
|
24
|
-
.transform("babelify", {presets: ["env"]})
|
|
25
|
-
.bundle()
|
|
26
|
-
.pipe(writeToDisk(standardFile));
|
|
27
|
-
|
|
28
|
-
browserify(sdkEntryPoint, options)
|
|
29
|
-
.transform("babelify", {presets: ["env"]})
|
|
30
|
-
.plugin("tinyify")
|
|
31
|
-
.bundle()
|
|
32
|
-
.pipe(writeToDisk(minifiedFile));
|
|
33
|
-
}
|
package/s3.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const zlib = require("zlib");
|
|
3
|
-
const version = require("./package").version;
|
|
4
|
-
const credentials = {
|
|
5
|
-
accessKeyId: process.env.AWS_ACCESS_KEY,
|
|
6
|
-
secretAccessKey: process.env.AWS_SECRET_KEY,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
let AWS = require("aws-sdk");
|
|
10
|
-
AWS.config.update(credentials);
|
|
11
|
-
|
|
12
|
-
const S3Stream = require("s3-upload-stream");
|
|
13
|
-
const fileName = "smartystreets-sdk-" + version;
|
|
14
|
-
const basePath = __dirname + "/dist/";
|
|
15
|
-
|
|
16
|
-
[".js", ".min.js"].map(fileExtension => uploadFileToS3(basePath, fileName + fileExtension));
|
|
17
|
-
|
|
18
|
-
function uploadFileToS3(filePath, fileName) {
|
|
19
|
-
let s3Stream = S3Stream(new AWS.S3());
|
|
20
|
-
let read = fs.createReadStream(filePath + fileName);
|
|
21
|
-
let compress = zlib.createGzip();
|
|
22
|
-
let upload = s3Stream.upload({
|
|
23
|
-
Bucket: "static.smartystreets.com",
|
|
24
|
-
Key: "sdk/" + version + "/" + fileName,
|
|
25
|
-
StorageClass: "STANDARD",
|
|
26
|
-
ContentType: "application/javascript",
|
|
27
|
-
ContentEncoding: "gzip",
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
upload.on("error", e => {
|
|
31
|
-
throw new e
|
|
32
|
-
});
|
|
33
|
-
upload.on("part", console.log);
|
|
34
|
-
upload.on("uploaded", console.log);
|
|
35
|
-
|
|
36
|
-
read
|
|
37
|
-
.pipe(compress)
|
|
38
|
-
.pipe(upload);
|
|
39
|
-
}
|