diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ac9ceb6 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +node-request-promise-core (1.1.2-1) unstable; urgency=low + + * Initial release (Closes: #929233) + + -- Ying-Chun Liu (PaulLiu) Sun, 19 May 2019 17:23:21 +0800 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..65a6f37 --- /dev/null +++ b/debian/control @@ -0,0 +1,30 @@ +Source: node-request-promise-core +Section: javascript +Priority: optional +Maintainer: Debian Javascript Maintainers +Uploaders: Ying-Chun Liu (PaulLiu) +Build-Depends: chai, + debhelper (>= 10), + gulp, + node-bluebird, + node-body-parser, + node-chalk, + node-request, + node-rimraf, + node-run-sequence, + node-stealthy-require, + nodejs (>= 6) +Standards-Version: 4.3.0 +Homepage: https://github.com/request/promise-core#readme +Vcs-Git: https://salsa.debian.org/js-team/node-request-promise-core.git +Vcs-Browser: https://salsa.debian.org/js-team/node-request-promise-core + +Package: node-request-promise-core +Architecture: all +Depends: node-lodash (>= 4.17.11), nodejs (>= 6), ${misc:Depends} +Description: core logic for adding Promise support to request for Node.js + This package is the core library of node-request-promise. Normal users should + just use node-request-promise. It is only recommended to use this library + directly, if you have very specific requirements. + . + Node.js is an event-based server-side JavaScript engine. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..d23a4c0 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,25 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: request-promise-core +Upstream-Contact: https://github.com/request/promise-core/issues +Source: https://github.com/request/promise-core#readme + +Files: * +Copyright: 2016-2019 Nicolai Kamenzky (https://github.com/analog-nico) +License: ISC + +Files: debian/* +Copyright: 2019 Ying-Chun Liu (PaulLiu) +License: ISC + +License: ISC + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/node-request-promise-core.install b/debian/node-request-promise-core.install new file mode 100644 index 0000000..b8ba615 --- /dev/null +++ b/debian/node-request-promise-core.install @@ -0,0 +1,4 @@ +configure usr/lib/nodejs/request-promise-core/ +errors.js usr/lib/nodejs/request-promise-core/ +lib usr/lib/nodejs/request-promise-core/ +package.json usr/lib/nodejs/request-promise-core/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..c840c3f --- /dev/null +++ b/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ + +# Do not run dh_auto_configure because configure is a directory. +override_dh_auto_configure: + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..6077fca --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,5 @@ +Tests: require +Depends: node-request-promise-core + +Tests: test-example01 +Depends: node-promise, node-request, node-stealthy-require, @ diff --git a/debian/tests/require b/debian/tests/require new file mode 100755 index 0000000..0aa322c --- /dev/null +++ b/debian/tests/require @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +node -e "require('request-promise-core');" diff --git a/debian/tests/test-example01 b/debian/tests/test-example01 new file mode 100755 index 0000000..c1dbf3e --- /dev/null +++ b/debian/tests/test-example01 @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +node debian/tests/test-example01.js diff --git a/debian/tests/test-example01.js b/debian/tests/test-example01.js new file mode 100644 index 0000000..96dbe06 --- /dev/null +++ b/debian/tests/test-example01.js @@ -0,0 +1,49 @@ +// 1. Load the request library + +// Only use a direct require if you are 100% sure that: +// - Your project does not use request directly. That is without the Promise capabilities by calling require('request'). +// - Any of the installed libraries use request. +// ...because Request's prototype will be patched in step 2. +/* var request = require('request'); */ + +// Instead use: +var stealthyRequire = require('stealthy-require'); +var request = stealthyRequire(require.cache, function () { + return require('request'); +}); + + +// 2. Add Promise support to request + +var configure = require('request-promise-core/configure/request2'); + +configure({ + request: request, + // Pass your favorite ES6-compatible promise implementation + PromiseImpl: Promise, + // Expose all methods of the promise instance you want to call on the request(...) call + expose: [ + 'then', // Allows to use request(...).then(...) + 'catch', // Allows to use request(...).catch(...) + 'promise' // Allows to use request(...).promise() which returns the promise instance + ], + // Optional: Pass a callback that is called within the Promise constructor + constructorMixin: function (resolve, reject) { + // `this` is the request object + // Additional arguments may be passed depending on the PromiseImpl used + } +}); + + +// 3. Use request with its promise capabilities + +// E.g. crawl a web page: +request('http://localhost') + .then(function (htmlString) { + // Process html... + console.log("then called - process html..."); + }) + .catch(function (err) { + // Crawling failed... + console.log("catch called - crawling failed..."); + }); diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..26f0c3f --- /dev/null +++ b/debian/watch @@ -0,0 +1,5 @@ +version=3 +opts=\ +dversionmangle=s/\+(debian|dfsg|ds|deb)(\.\d+)?$//,\ +filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/node-request-promise-core-$1.tar.gz/ \ + https://github.com/request/promise-core/releases .*/archive/v?([\d\.]+).tar.gz