qa-deployer
Advanced tools
Comparing version 1.0.0 to 2.0.0
{ | ||
"name": "qa-deployer", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Deploy a package to a hosting service for easy review", | ||
"main": "qa-deployer.js", | ||
"bin": { | ||
"circleci-deploy-github-pull-request-to-modulus": "bin/circleci-deploy-github-pull-request-to-modulus" | ||
"circleci-deploy": "bin/circleci-deploy", | ||
"circleci-deploy-github-pull-request": "bin/circleci-deploy-github-pull-request" | ||
}, | ||
@@ -25,5 +26,5 @@ "preferGlobal": true, | ||
"async": "~0.8.0", | ||
"extend": "~1.2.1", | ||
"minimist": "~0.0.9", | ||
"request": "~2.33.0" | ||
"request": "~2.33.0", | ||
"s3-site": "SparkartGroupInc/s3-site#remove-extensions-option" | ||
}, | ||
@@ -30,0 +31,0 @@ "devDependencies": { |
@@ -12,3 +12,7 @@ var async = require('async'); | ||
notifier.notify(review_url, callback); | ||
}, callback); | ||
}, function() { | ||
if (callback) { | ||
callback(redeploy, review_url); | ||
} | ||
}); | ||
}); | ||
@@ -27,3 +31,4 @@ }; | ||
case 'modulus': | ||
return require('./src/deployers/' + options.service + '.js').init(options); | ||
case 's3-static-website': | ||
return require('./src/deployers/' + options.service).init(options); | ||
default: | ||
@@ -48,3 +53,3 @@ throw new Error('Invalid deployer service: ' + options.service); | ||
case 'webhook': | ||
return require('./src/notifiers/' + options.service + '.js').init(options); | ||
return require('./src/notifiers/' + options.service).init(options); | ||
default: | ||
@@ -51,0 +56,0 @@ throw new Error('Invalid notifier service: ' + options.service); |
@@ -7,4 +7,4 @@ # qa-deployer -- Deploy a package to a hosting service for easy review | ||
``` | ||
var qa_deployer = require('qa-deployer') | ||
```javascript | ||
var qa_deployer = require('qa-deployer'); | ||
@@ -24,6 +24,6 @@ qa_deployer.deploy({ | ||
comment: function(review_url) { | ||
return 'Ready for review at ' + review_url | ||
return 'Ready for review at ' + review_url; | ||
} | ||
}] | ||
}) | ||
}); | ||
``` | ||
@@ -47,2 +47,14 @@ | ||
### s3-static-website ### | ||
Deploys the current directory to [Amazon S3](http://aws.amazon.com/s3/) as a [static website](http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html). | ||
*Usage* | ||
- `s3_options` - An object used to configure the connection to S3. See the `AWS.S3` [documentation](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property). | ||
- `bucket_name` - The S3 bucket where to upload the files. If the bucket is missing, it will be automatically created and configured to host the static website. | ||
- `region` - The AWS region where the site will be hosted. Optional, defaults to `us-east-1`. | ||
- `removeExtensions` - List of extensions to remove from uploaded files, for example `['.html', '.htm']`. Optional. | ||
- `indexDocument` - Default index document when a folder is requested from S3. Optional, defaults to `index.html`. | ||
## Available Notifiers ## | ||
@@ -75,13 +87,19 @@ | ||
### circleci-deploy-github-pull-request-to-modulus ### | ||
### circleci-deploy ### | ||
Called by [CircleCI](https://circleci.com/), it automatically deploys a branch to Modulus when a commit is made to a GitHub pull request. Uses the `modulus` deployer, with the branch name as the project name. If no open GitHub pull request exists for the current branch, the branch will not be deployed to Modulus, and the project will be stopped instead. | ||
Called by [CircleCI](https://circleci.com/), it automatically deploys a branch when a commit is made. | ||
Note: CircleCI will only trigger new builds when a commit is made to an existing pull request. To deploy a branch when a pull request is created (without pushing an extra commit), the [CircleCI API](https://circleci.com/docs/api#new-build) needs to be called. On way to automatically do this is to create a [PullRequestEvent Webhook](https://developer.github.com/v3/activity/events/types/#pullrequestevent) in the GitHub project's settings. This Webhook will POST to a relay service, such as [Zapier](http://www.zapier.com), which will in turn POST to the appropriate CircleCI API URL. | ||
The following deployers are supported: | ||
- `modulus` - The GitHub branch name is used as the Modulus project name. | ||
- `s3-static-website` - The GitHub organization, repository and branch names are used as the S3 bucket name. | ||
Notifiers can be enabled by adding an options file. This JSON formatted file can contain deployer and notifier options, similar to the module usage above. For example: | ||
``` | ||
```json | ||
{ | ||
"deployer": {"include_modules": true}, | ||
"deployer": { | ||
"service": "modulus", | ||
"include_modules": true | ||
}, | ||
"notifiers": [ | ||
@@ -94,2 +112,17 @@ {"service": "github-pull-request"}, | ||
The file can also be a Node module: | ||
```javascript | ||
module.exports = { | ||
deployer: { | ||
service: 'modulus', | ||
include_modules: true | ||
}, | ||
notifiers: [ | ||
{service: 'github-pull-request'}, | ||
{service: 'webhook', url: 'http://my-webhook', notify_redeploys: true} | ||
] | ||
}; | ||
``` | ||
*Usage* | ||
@@ -99,9 +132,18 @@ | ||
- `MODULUS_USERNAME` | ||
- `MODULUS_PASSWORD` | ||
- `GITHUB_USER` | ||
- `GITHUB_PASS` | ||
With the `modulus` deployer: | ||
- `MODULUS_USERNAME` | ||
- `MODULUS_PASSWORD` | ||
With the `s3-static-website` deployer: | ||
- `AWS_ACCESS_KEY_ID` | ||
- `AWS_SECRET_ACCESS_KEY` | ||
Command line options: | ||
- `--deployer=SERVICE` - The deployer to use. Optional, can also be set from the options file. | ||
- `--options-from=FILE` - Read additional options from JSON formatted FILE. | ||
@@ -111,3 +153,23 @@ | ||
```yaml | ||
dependencies: | ||
post: | ||
- npm install qa-deployer -g | ||
- npm install modulus -g | ||
deployment: | ||
production: | ||
branch: master | ||
commands: | ||
- circleci-deploy --options-from=production-deployer.json | ||
``` | ||
### circleci-deploy-github-pull-request ### | ||
Similar to the `circleci-deploy` script, but will only deploy when an open GitHub pull request exists for the current branch. If not, the branch will not be deployed, and will be withdrawn from the deployer service instead. | ||
Note: CircleCI will only trigger new builds when a commit is made to an existing pull request. To deploy a branch when a pull request is created (without pushing an extra commit), the [CircleCI API](https://circleci.com/docs/api#new-build) needs to be called. On way to automatically do this is to create a [PullRequestEvent Webhook](https://developer.github.com/v3/activity/events/types/#pullrequestevent) in the GitHub project's settings. This Webhook will POST to a relay service, such as [Zapier](http://www.zapier.com), which will in turn POST to the appropriate CircleCI API URL. | ||
Example `circle.yml` configuration file: | ||
```yaml | ||
dependencies: | ||
@@ -121,3 +183,3 @@ post: | ||
commands: | ||
- circleci-deploy-github-pull-request-to-modulus --options-from=qa-deployer.json | ||
- circleci-deploy-github-pull-request --options-from=qa-deployer.json | ||
``` |
@@ -54,3 +54,5 @@ var assert = require('assert'); | ||
qa_deployer.deploy(options, done); | ||
qa_deployer.deploy(options, function() { | ||
done(); | ||
}); | ||
}); | ||
@@ -75,3 +77,5 @@ | ||
qa_deployer.deploy(options, done); | ||
qa_deployer.deploy(options, function() { | ||
done(); | ||
}); | ||
}); | ||
@@ -88,5 +92,7 @@ }); | ||
qa_deployer.withdraw(options, done); | ||
qa_deployer.withdraw(options, function() { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 12 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
45768
25
906
178
1
1
42
+ Addeds3-site@SparkartGroupInc/s3-site#remove-extensions-option
+ Addedtldts@6.1.77(transitive)
+ Addedtldts-core@6.1.77(transitive)
+ Addedtough-cookie@5.1.1(transitive)
- Removedextend@~1.2.1
- Removedextend@1.2.1(transitive)
- Removedtldts@6.1.76(transitive)
- Removedtldts-core@6.1.76(transitive)
- Removedtough-cookie@5.1.0(transitive)