{"_id":"@brandtotal/webpack-s3-plugin","_rev":"15-98f7bea407d440dbb4930e75e39e0a5c","name":"@brandtotal/webpack-s3-plugin","dist-tags":{"latest":"2.0.0-dev.1"},"versions":{"2.0.0-dev.0":{"name":"@brandtotal/webpack-s3-plugin","version":"2.0.0-dev.0","description":"Uploads compiled assets to s3 after build","main":"dist/s3_plugin.js","scripts":{"build":"babel src -d dist/","_prepublish":"npm run lint && npm run test && npm run build","test":"NODE_ENV='test' mocha -t 10000 --compilers js:babel-register","lint":"eslint ./src ./test","watch":"babel src -d dist/ -w","prep:major":"npm run build && npm version major","prep:minor":"npm run build && npm version minor","prep:patch":"npm run build && npm version patch","yarn-tools-fix-duplicates":"yarn-tools fix-duplicates yarn.lock > yarn.lock.fixed && mv yarn.lock.fixed yarn.lock;"},"repository":{"type":"git","url":"git@github.com:webpack-contrib/s3-plugin-webpack.git"},"keywords":["s3","webpack","node","upload","production"],"author":{"name":"Mika Kalathil"},"license":"MIT","bugs":{"url":"https://github.com/webpack-contrib/s3-plugin-webpack/issues"},"homepage":"https://github.com/webpack-contrib/s3-plugin-webpack","dependencies":{"aws-sdk":"^2.221.1","cdnizer":"^2.0.0","lodash":"^4.17.5","progress":"^2.0.0","recursive-readdir":"^2.2.2"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-loader":"^7.1.4","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.1.2","css-loader":"^0.28.11","dotenv":"^5.0.1","eslint":"^4.19.1","eslint-loader":"^2.0.0","extract-text-webpack-plugin":"^4.0.0-beta.0","file-loader":"^1.1.11","html-webpack-plugin":"^3.2.0","mocha":"^5.0.5","sinon":"^4.5.0","style-loader":"^0.20.3","webpack":"^4.5.0"},"peerDependencies":{"webpack":"^4.5.0"},"licenseText":"Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@brandtotal/webpack-s3-plugin@2.0.0-dev.0","dist":{"shasum":"0f46961eaef272d181c137bfacb91eed89f6446b","tarball":"https://registry.npmjs.org/@brandtotal/webpack-s3-plugin/-/webpack-s3-plugin-2.0.0-dev.0.tgz","fileCount":10,"unpackedSize":28322,"integrity":"sha512-v7lihx1PY2C3ioFKKRV3TAUSHX9CMLvklexgrvVRiJR6+ybLIiHCuwgvPPt1fQwCiyrp5dHh0p0VxmvwDui4CA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCy1u1e6HeefOUAXb8KV0muIhRz0bKwywGuaSyni6IFigIgAU/4Hn8xqzniqaynsh7kPTozGoLlfcmevF0bubKVv2A="}]},"maintainers":[{"name":"amirbt","email":"amir@brandtotal.com"},{"name":"bnayatotal","email":"bnaya@brandtotal.io"},{"name":"liram","email":"liram@brandtotal.com"}],"_npmUser":{"name":"bnayatotal","email":"bnaya@brandtotal.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-s3-plugin_2.0.0-dev.0_1523010700049_0.8660144409979671"},"_hasShrinkwrap":false,"deprecated":"upstream now supports webpack4 use it"},"2.0.0-dev.1":{"name":"@brandtotal/webpack-s3-plugin","version":"2.0.0-dev.1","description":"Uploads compiled assets to s3 after build","main":"dist/s3_plugin.js","scripts":{"build":"babel src -d dist/","prepublish":"npm run lint && npm run test && npm run build","test":"NODE_ENV='test' mocha -t 10000 --compilers js:babel-register","lint":"eslint ./src ./test","watch":"babel src -d dist/ -w","prep:major":"npm run build && npm version major","prep:minor":"npm run build && npm version minor","prep:patch":"npm run build && npm version patch","yarn-tools-fix-duplicates":"yarn-tools fix-duplicates yarn.lock > yarn.lock.fixed && mv yarn.lock.fixed yarn.lock;"},"repository":{"type":"git","url":"git@github.com:webpack-contrib/s3-plugin-webpack.git"},"keywords":["s3","webpack","node","upload","production"],"author":{"name":"Mika Kalathil"},"license":"MIT","bugs":{"url":"https://github.com/webpack-contrib/s3-plugin-webpack/issues"},"homepage":"https://github.com/webpack-contrib/s3-plugin-webpack","dependencies":{"aws-sdk":"^2.221.1","cdnizer":"^2.0.0","lodash":"^4.17.5","mime":"^2.2.2","progress":"^2.0.0","recursive-readdir":"^2.2.2"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-loader":"^7.1.4","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.1.2","css-loader":"^0.28.11","dotenv":"^5.0.1","eslint":"^4.19.1","eslint-loader":"^2.0.0","extract-text-webpack-plugin":"^4.0.0-beta.0","file-loader":"^1.1.11","html-webpack-plugin":"^3.2.0","mocha":"^5.0.5","sinon":"^4.5.0","style-loader":"^0.20.3","webpack":"^4.5.0"},"peerDependencies":{"webpack":"^4.5.0"},"licenseText":"Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@brandtotal/webpack-s3-plugin@2.0.0-dev.1","dist":{"shasum":"6c0e4422d164f8f89f9183bf65c3c28cd5a2aa57","tarball":"https://registry.npmjs.org/@brandtotal/webpack-s3-plugin/-/webpack-s3-plugin-2.0.0-dev.1.tgz","fileCount":10,"unpackedSize":28528,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzZwkCRA9TVsSAnZWagAAmR0P/1mvLG/0qBhbW2Sx1DYQ\nNcdM6rSPFX/pxfoXYrdO7wNxiz9+5ujhOuS8gFbWbnIZ7kKn2BEdPfKN4Zne\nGI/xj72IB3c4HNAjNSw1FaP7HQSBzJjM6N/Y4SC2ie2cNtU4vHFoqbCXBKPj\n8VzuB54ijcKUDlc+IEteoluSTp1hoXX7qOTWWz7nZEKTyMBRTQgODomSduD2\nRqF2JfsO+iV1cEroMIo0UxCTX4XaOiN6yQP2b8/yTNcdkP0BES0ZSKjLAnu4\nWkRkvaUGdq1QQOKRMLgN/IZseudav0dPdqtuipCT2urEwj5bHmojTf88qvEn\nbC7gM/pqEOsmkdolJH7IO/qiZRItW7+0ClYGlI+uOAhIDKiObRsyXW5JYbnL\nfAzZXi4N0CQQlKmdf5QDs+NvSAhTEVmE1z1M6Y0q/uj17Ur141iqU+PlIXmG\n1/5tYXNwnpVeUrRpUs2Yw7qCW2N7PmCV+QicwJWbokTrpjvKVcGHjGCji2fy\nLgEDV75KP+hd4yUci5hHUkkxnWCgPrwr06HUz9IekNmof8Ef+FQEqPBG1l/5\n6FP90mdOAjU3KWFotBwIB3VSKJr2HBiOeNxb4dfsyJbmNa3rV4p2XzWhf7N3\nuekQGFMZo7xbmRCtLefDuj+2a/DvTr12/jL8ZVmlcle0/uhQXidSUt7BV3cq\n4JI8\r\n=kv3x\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-aPm6uSA+HIDm2PIqgH1IafkMy3mD0x4eaiX5TVVedy/nZQSeLYQBGYT/9Qr/fgn27odIAf7GUwh9tkP0TKe5jQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFIulMed++GdecazpKiZJheQxYh9e7K0UBuTkodixzEXAiBmhhn4KlN5YmNzqwCTEzz852BgAu1N8CMGk2U5/Ifr3w=="}]},"maintainers":[{"name":"amirbt","email":"amir@brandtotal.com"},{"name":"bnayatotal","email":"bnaya@brandtotal.io"},{"name":"liram","email":"liram@brandtotal.com"}],"_npmUser":{"name":"bnayatotal","email":"bnaya@brandtotal.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-s3-plugin_2.0.0-dev.1_1523012014446_0.7896505668819238"},"_hasShrinkwrap":false,"deprecated":"upstream now supports webpack4, use it"}},"time":{"created":"2018-04-06T10:31:40.048Z","2.0.0-dev.0":"2018-04-06T10:31:40.126Z","modified":"2022-06-12T15:28:11.223Z","2.0.0-dev.1":"2018-04-06T10:53:34.535Z"},"maintainers":[{"email":"vamekh@brandtotal.com","name":"vamekh"},{"email":"nikoloz@brandtotal.com","name":"nick1234321"},{"email":"developers@brandtotal.com","name":"bt_developers"},{"email":"amir@brandtotal.com","name":"amirbt"},{"email":"yishai@brandtotal.com","name":"yishaib_brandtotal"}],"description":"Uploads compiled assets to s3 after build","homepage":"https://github.com/webpack-contrib/s3-plugin-webpack","keywords":["s3","webpack","node","upload","production"],"repository":{"type":"git","url":"git@github.com:webpack-contrib/s3-plugin-webpack.git"},"author":{"name":"Mika Kalathil"},"bugs":{"url":"https://github.com/webpack-contrib/s3-plugin-webpack/issues"},"license":"MIT","readme":"\nS3 Plugin\n===\n[![Travis Badge](https://travis-ci.org/MikaAK/s3-plugin-webpack.svg?branch=master)](https://travis-ci.org/MikaAK/s3-plugin-webpack)\n[![Code Climate](https://codeclimate.com/github/MikaAK/s3-plugin-webpack/badges/gpa.svg)](https://codeclimate.com/github/MikaAK/s3-plugin-webpack)\n\nThis plugin will upload all built assets to s3\n\n\n### Install Instructions\n\n```bash\n$ npm i webpack-s3-plugin\n```\nNote: This plugin needs NodeJS > 0.12.0\n\n### Usage Instructions\n> I notice a lot of people are setting the directory option when the files are part of their build. Please don't set   directory if your uploading your build. Using the directory option reads the files after compilation to upload instead of from the build process.\n\n> You can also use a [credentials file](https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs) from AWS.\n\n> s3Options default to `ACL: 'public-read'` so you may need to override if you have other needs. See [#28](https://github.com/MikaAK/s3-plugin-webpack/issues/28#issuecomment-309171024)\n\n\n##### Require `webpack-s3-plugin`\n```javascript\nvar S3Plugin = require('webpack-s3-plugin')\n```\n\n##### With exclude\n```javascript\nvar config = {\n  plugins: [\n    new S3Plugin({\n      // Exclude uploading of html\n      exclude: /.*\\.html$/,\n      // s3Options are required\n      s3Options: {\n        accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n        region: 'us-west-1'\n      },\n      s3UploadOptions: {\n        Bucket: 'MyBucket'\n      },\n      cdnizerOptions: {\n        defaultCDNBase: 'http://asdf.ca'\n      }\n    })\n  ]\n}\n```\n\n##### With include\n```javascript\nvar config = {\n  plugins: [\n    new S3Plugin({\n      // Only upload css and js\n      include: /.*\\.(css|js)/,\n      // s3Options are required\n      s3Options: {\n        accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n      },\n      s3UploadOptions: {\n        Bucket: 'MyBucket'\n      }\n    })\n  ]\n}\n```\n\n##### Advanced `include` and `exclude rules`\n\n`include` and `exclude` rules behave similarly to Webpack's loader options.  In addition to a RegExp you can pass a function which will be called with the path as its first argument.  Returning a truthy value will match the rule.  You can also pass an Array of rules, all of which must pass for the file to be included or excluded.\n\n```javascript\nimport isGitIgnored from 'is-gitignored'\n\n// Up to you how to handle this\nvar isPathOkToUpload = function(path) {\n  return require('my-projects-publishing-rules').checkFile(path)\n}\n\nvar config = {\n  plugins: [\n    new S3Plugin({\n      // Only upload css and js and only the paths that our rules database allows\n      include: [\n        /.*\\.(css|js)/,\n        function(path) { isPathOkToUpload(path) }\n      ],\n\n      // function to check if the path is gitignored\n      exclude: isGitIgnored,\n\n      // s3Options are required\n      s3Options: {\n        accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n      },\n      s3UploadOptions: {\n        Bucket: 'MyBucket'\n      }\n    })\n  ]\n}\n```\n\n##### With basePathTransform\n```javascript\nimport gitsha from 'gitsha'\n\nvar addSha = function() {\n  return new Promise(function(resolve, reject) {\n    gitsha(__dirname, function(error, output) {\n      if(error)\n        reject(error)\n      else\n       // resolve to first 5 characters of sha\n       resolve(output.slice(0, 5))\n    })\n  })\n}\n\nvar config = {\n  plugins: [\n    new S3Plugin({\n      s3Options: {\n        accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n      },\n      s3UploadOptions: {\n        Bucket: 'MyBucket'\n      },\n      basePathTransform: addSha\n    })\n  ]\n}\n\n\n// Will output to /${mySha}/${fileName}\n```\n\n##### With CloudFront invalidation\n```javascript\nvar config = {\n  plugins: [\n    new S3Plugin({\n      s3Options: {\n        accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n      },\n      s3UploadOptions: {\n        Bucket: 'MyBucket'\n      },\n      cloudfrontInvalidateOptions: {\n        DistributionId: process.env.CLOUDFRONT_DISTRIBUTION_ID,\n        Items: [\"/*\"]\n      }\n    })\n  ]\n}\n```\n\n##### With Dynamic Upload Options\n```javascript\nvar config = {\n  plugins: [\n    new S3Plugin({\n      s3Options: {\n        accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n        secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n      },\n      s3UploadOptions: {\n        Bucket: 'MyBucket',\n        ContentEncoding(fileName) {\n          if (/\\.gz/.test(fileName))\n            return 'gzip'\n        },\n\n        ContentType(fileName) {\n          if (/\\.js/.test(fileName))\n            return 'application/javascript'\n          else\n            return 'text/plain'\n        }\n      }\n    })\n  ]\n}\n```\n\n### Options\n\n- `exclude`: A Pattern to match for excluded content. Behaves similarly to webpack's loader configuration.\n- `include`: A Pattern to match for included content. Behaves the same as the `exclude`.\n- `s3Options`: Provide keys for upload extention of [s3Config](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property)\n- `s3UploadOptions`: Provide upload options [putObject](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property )\n- `basePath`: Provide the namespace where upload files on S3\n- `directory`: Provide a directory to upload (if not supplied will upload js/css from compilation)\n- `htmlFiles`: Html files to cdnize (defaults to all in output directory)\n- `cdnizerCss`: Config for css cdnizer check below\n- `noCdnizer`: Disable cdnizer (defaults true if no cdnizerOptions passed)\n- `cdnizerOptions`: options to pass to [cdnizer](https://www.npmjs.com/package/cdnizer)\n- `basePathTransform`: transform the base path to add a folder name. Can return a promise or a string\n- `progress`: Enable progress bar (defaults true)\n\n### Contributing\nAll contributions are welcome. Please make a pull request and make sure things still pass after running `npm run test`\nFor tests you will need to either have the environment variables set or setup a .env file. There's a .env.sample so you can `cp .env.sample .env` and fill it in. Make sure to add any new environment variables.\n\n#### Commands to be aware of\n###### *WARNING*: The test suit generates random files for certain checks. Ensure you delete files leftover on your Bucket.\n- `npm run test` - Run test suit (You must have the .env file setup)\n- `npm run build` - Run build\n\n### Thanks\n\n- Thanks to [@Omer](https://github.com/Omer) for fixing credentials from `~/.aws/credentials`\n- Thanks to [@lostjimmy](https://github.com/lostjimmy) for pointing out `path.sep` for Windows compatibility\n","readmeFilename":"README.md"}