forked from apify/proxy-chain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,937 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
presets: ["es2015", "stage-0"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"extends": "airbnb-base", | ||
"plugins": [ | ||
"import", | ||
"promise" | ||
], | ||
"rules": { | ||
"indent": ["error", 4], | ||
"no-underscore-dangle": [2, { | ||
"allow": ["_id"] | ||
}], | ||
"no-use-before-define": 0, | ||
"no-param-reassign": 0, | ||
"consistent-return": 0, | ||
"array-callback-return": 0, | ||
"arrow-body-style": 0, | ||
"no-plusplus": 0, | ||
"strict": ["error", "global"], | ||
"max-len": ["error", 150], | ||
"no-undef": 0, | ||
"func-names": 0, | ||
"import/prefer-default-export": 0, | ||
"import/no-absolute-path": 0, | ||
"import/no-extraneous-dependencies": ["error", { "devDependencies": ["**/test/*.js"] }], | ||
"no-underscore-dangle": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
build | ||
node_modules | ||
*.log | ||
*.pid | ||
*.seed | ||
.DS_Store | ||
lib | ||
coverage | ||
logs | ||
pids | ||
.idea | ||
yarn.lock | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Keep empty .npmignore file here so that /build is not ignored by "npm publish" | ||
# as it is in .gitignore file. Yes, this happened in older versions of NPM. | ||
# See https://docs.npmjs.com/misc/developers for info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
dist: trusty | ||
sudo: required | ||
addons: | ||
before_install: | ||
language: node_js | ||
node_js: | ||
- "8" | ||
- "7" | ||
- "6" | ||
script: | ||
- npm run lint | ||
- npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
0.0.x / 2017-11-06 | ||
================== | ||
- Project created |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# proxy-chain | ||
Enables creation of HTTP proxy-to-proxy | ||
# proxy-chain: Enables creation of HTTP proxy-to-proxy chains | ||
|
||
[](http://badge.fury.io/js/proxy-chain) | ||
[](https://travis-ci.org/Apifier/proxy-chain) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"name": "proxy-chain", | ||
"version": "0.0.1", | ||
"description": "Enables creation of HTTP proxy-to-proxy chains", | ||
"main": "build/index.js", | ||
"keywords": [ | ||
"apify", | ||
"apifier", | ||
"proxy", | ||
"chain" | ||
], | ||
"author": { | ||
"name": "Apify", | ||
"email": "[email protected]", | ||
"url": "https://www.apify.com" | ||
}, | ||
"contributors": [ | ||
"Jan Curn <[email protected]>" | ||
], | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/apifier/proxy-chain" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/apifier/proxy-chain/issues" | ||
}, | ||
"homepage": "https://github.com/apifier/proxy-chain", | ||
"files": [ | ||
"build" | ||
], | ||
"scripts": { | ||
"build": "rm -rf ./build && babel src --out-dir build", | ||
"mytest": "npm run build && node ./build/index.js", | ||
"test": "npm run build && mocha --compilers js:babel-core/register --recursive", | ||
"test-cov": "npm run build && babel-node node_modules/isparta/bin/isparta cover --report html --report text node_modules/.bin/_mocha", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "(test $RUNNING_FROM_SCRIPT || (echo \"You must use publish.sh instead of 'npm publish' directly!\"; exit 1)) && npm test && npm run lint", | ||
"clean": "rm -rf build", | ||
"lint": "npm run build && eslint src test" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^3.5.1", | ||
"underscore": "^1.8.3" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.6.5", | ||
"babel-core": "^6.1.21", | ||
"babel-eslint": "^7.2.2", | ||
"babel-preset-es2015": "^6.1.18", | ||
"babel-preset-stage-0": "^6.1.18", | ||
"basic-auth-parser": "^0.0.2", | ||
"chai": "^4.0.2", | ||
"eslint": "^3.19.0", | ||
"eslint-config-airbnb": "^15.0.1", | ||
"eslint-config-airbnb-base": "^11.1.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^5.0.3", | ||
"eslint-plugin-promise": "^3.4.2", | ||
"eslint-plugin-react": "^7.0.1", | ||
"isparta": "^4.0.0", | ||
"mocha": "^3.2.0", | ||
"proxy": "^0.2.4", | ||
"request": "^2.81.0", | ||
"sinon": "^2.2.0", | ||
"sinon-stub-promise": "^4.0.0" | ||
}, | ||
"optionalDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
|
||
PACKAGE_NAME=`node -pe "require('./package.json').name"` | ||
PACKAGE_VERSION=`node -pe "require('./package.json').version"` | ||
BRANCH=`git status | grep 'On branch' | cut -d ' ' -f 3` | ||
BRANCH_UP_TO_DATE=`git status | grep 'nothing to commit' | tr -s \n ' '`; | ||
GIT_TAG="v${PACKAGE_VERSION}" | ||
|
||
# Upload doc to S3 configuration | ||
DOC_DIR=${PWD}"/docs" | ||
AWS_BUCKET="apify-runtime-js-doc" | ||
|
||
if [ -z "${BRANCH_UP_TO_DATE}" ]; then | ||
printf "${RED}You have uncommitted changes!${NC}\n" | ||
exit 1 | ||
fi | ||
|
||
echo "Generating documentation ..." | ||
npm run build-doc | ||
|
||
echo "Uploading docs to S3 ..." | ||
aws s3 cp "${DOC_DIR}/" "s3://${AWS_BUCKET}/${GIT_TAG}/" --recursive --region us-east-1 --acl public-read --cache-control "public, max-age=86400" | ||
|
||
echo "Pushing to git ..." | ||
git push | ||
|
||
# Master gets published as LATEST if that version doesn't exists yet and retagged as LATEST otherwise. | ||
if [ "${BRANCH}" = "master" ]; then | ||
EXISTING_NPM_VERSION=$(npm view ${PACKAGE_NAME} versions | grep ${PACKAGE_VERSION} | tee) # Using tee to swallow non-zero exit code | ||
if [ -z "${EXISTING_NPM_VERSION}" ]; then | ||
printf "${RED}Version ${PACKAGE_VERSION} was not yet published on NPM. Note that you can only publish to NPM from \"develop\" branch!${NC}\n" | ||
exit 1 | ||
else | ||
echo "Tagging version ${PACKAGE_VERSION} with tag \"latest\" ..." | ||
RUNNING_FROM_SCRIPT=1 npm dist-tag add ${PACKAGE_NAME}@${PACKAGE_VERSION} latest | ||
echo "Copy doc to latest folder..." | ||
aws s3 cp "s3://${AWS_BUCKET}/${GIT_TAG}/" "s3://${AWS_BUCKET}/latest/" --recursive --region us-east-1 --acl public-read --cache-control "public, max-age=3600" | ||
fi | ||
|
||
# Develop branch gets published as BETA and we don't allow to override tag of existing version. | ||
elif [ "${BRANCH}" = "develop" ]; then | ||
echo "Publishing version ${PACKAGE_VERSION} with tag \"beta\" ..." | ||
RUNNING_FROM_SCRIPT=1 npm publish --tag beta | ||
|
||
echo "Tagging git commit with ${GIT_TAG} ..." | ||
git tag ${GIT_TAG} | ||
git push origin ${GIT_TAG} | ||
echo "Git tag: ${GIT_TAG} created." | ||
|
||
echo "Copy docs to S3 to beta folder..." | ||
aws s3 cp "s3://${AWS_BUCKET}/${GIT_TAG}/" "s3://${AWS_BUCKET}/beta/" --recursive --region us-east-1 --acl public-read --cache-control "public, max-age=3600" | ||
|
||
# For other branch throw an error. | ||
else | ||
printf "${RED}You can publish from develop and master branches only!${NC}\n" | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "Done." |
Empty file.
Oops, something went wrong.