├── views ├── error.hbs ├── layout.hbs ├── partials │ ├── admin-header.hbs │ └── user-header.hbs ├── index.hbs ├── admin │ ├── add-category.hbs │ └── admin-login.hbs ├── user │ ├── view-category.hbs │ ├── verify-otp.hbs │ ├── login.hbs │ ├── view-image.hbs │ ├── order-success.hbs │ ├── verify-phone.hbs │ ├── view-products.hbs │ ├── orders.hbs │ ├── Add-address.hbs │ ├── signup.hbs │ └── cart.hbs └── layout │ └── layout.hbs ├── E-project ├── node_modules │ ├── @mapbox │ │ └── node-pre-gyp │ │ │ ├── bin │ │ │ ├── node-pre-gyp.cmd │ │ │ └── node-pre-gyp │ │ │ ├── node_modules │ │ │ ├── semver │ │ │ │ ├── classes │ │ │ │ │ ├── index.js │ │ │ │ │ └── comparator.js │ │ │ │ └── bin │ │ │ │ │ └── semver.js │ │ │ ├── .bin │ │ │ │ ├── nopt │ │ │ │ ├── semver │ │ │ │ ├── nopt.cmd │ │ │ │ ├── semver.cmd │ │ │ │ ├── nopt.ps1 │ │ │ │ └── semver.ps1 │ │ │ └── nopt │ │ │ │ ├── LICENSE │ │ │ │ ├── package.json │ │ │ │ ├── bin │ │ │ │ └── nopt.js │ │ │ │ ├── CHANGELOG.md │ │ │ │ └── README.md │ │ │ ├── lib │ │ │ ├── util │ │ │ │ ├── nw-pre-gyp │ │ │ │ │ ├── package.json │ │ │ │ │ └── index.html │ │ │ │ ├── compile.js │ │ │ │ ├── handle_gyp_opts.js │ │ │ │ ├── s3_setup.js │ │ │ │ └── napi.js │ │ │ ├── rebuild.js │ │ │ ├── reinstall.js │ │ │ ├── reveal.js │ │ │ ├── clean.js │ │ │ ├── pre-binding.js │ │ │ ├── info.js │ │ │ ├── unpublish.js │ │ │ ├── testpackage.js │ │ │ ├── build.js │ │ │ ├── configure.js │ │ │ ├── package.js │ │ │ ├── testbinary.js │ │ │ ├── publish.js │ │ │ ├── main.js │ │ │ ├── install.js │ │ │ └── node-pre-gyp.js │ │ │ ├── contributing.md │ │ │ └── LICENSE │ └── .bin │ │ ├── rc │ │ ├── mime │ │ ├── is-ci │ │ ├── nopt │ │ ├── rimraf │ │ ├── mkdirp │ │ ├── semver │ │ ├── nodemon │ │ ├── color-support │ │ ├── nodetouch │ │ ├── uglifyjs │ │ ├── handlebars │ │ ├── mime.cmd │ │ ├── rc.cmd │ │ ├── is-ci.cmd │ │ ├── node-pre-gyp │ │ ├── nopt.cmd │ │ ├── rimraf.cmd │ │ ├── mkdirp.cmd │ │ ├── semver.cmd │ │ ├── nodemon.cmd │ │ ├── uglifyjs.cmd │ │ ├── color-support.cmd │ │ ├── handlebars.cmd │ │ ├── nodetouch.cmd │ │ ├── node-pre-gyp.cmd │ │ ├── rc.ps1 │ │ ├── mime.ps1 │ │ ├── is-ci.ps1 │ │ ├── rimraf.ps1 │ │ ├── nopt.ps1 │ │ ├── mkdirp.ps1 │ │ ├── semver.ps1 │ │ ├── color-support.ps1 │ │ ├── nodemon.ps1 │ │ ├── nodetouch.ps1 │ │ ├── uglifyjs.ps1 │ │ ├── handlebars.ps1 │ │ └── node-pre-gyp.ps1 ├── confiq │ ├── collection.js │ └── connection.js ├── app.js ├── bin │ └── www └── helpers │ └── product-helpers.js ├── confiq ├── collection.js └── connection.js ├── package.json ├── app.js ├── bin └── www ├── helpers └── product-helpers.js └── routes ├── admin.js └── user.js /views/error.hbs: -------------------------------------------------------------------------------- 1 |

{{message}}

2 |

{{error.status}}

3 |
{{error.stack}}
4 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | node "%~dp0\node-pre-gyp" %* 3 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | require('../lib/main'); 5 | -------------------------------------------------------------------------------- /confiq/collection.js: -------------------------------------------------------------------------------- 1 | module.exports={ 2 | PRODUCT_COLLECTION:'product', 3 | USER_COLLECTION:'user', 4 | PRODUCT_CATEGORY:'category', 5 | CART_COLLECTION:'cart', 6 | ORDER_COLLECTION:'order' 7 | } -------------------------------------------------------------------------------- /E-project/confiq/collection.js: -------------------------------------------------------------------------------- 1 | module.exports={ 2 | PRODUCT_COLLECTION:'product', 3 | USER_COLLECTION:'user', 4 | PRODUCT_CATEGORY:'category', 5 | CART_COLLECTION:'cart', 6 | ORDER_COLLECTION:'order' 7 | } -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/semver/classes/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | SemVer: require('./semver.js'), 3 | Range: require('./range.js'), 4 | Comparator: require('./comparator.js'), 5 | } 6 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "index.html", 3 | "name": "nw-pre-gyp-module-test", 4 | "description": "Node-webkit-based module test.", 5 | "version": "0.0.1", 6 | "window": { 7 | "show": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /views/layout.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{title}} 5 | 6 | 7 | 8 | 9 | {{{body}}} 10 | 11 | 12 | -------------------------------------------------------------------------------- /views/partials/admin-header.hbs: -------------------------------------------------------------------------------- 1 |
2 | 13 | 14 |
-------------------------------------------------------------------------------- /E-project/node_modules/.bin/rc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../rc/cli.js" "$@" 10 | else 11 | exec node "$basedir/../rc/cli.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/mime: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../mime/cli.js" "$@" 10 | else 11 | exec node "$basedir/../mime/cli.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/is-ci: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../is-ci/bin.js" "$@" 10 | else 11 | exec node "$basedir/../is-ci/bin.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nopt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@" 10 | else 11 | exec node "$basedir/../nopt/bin/nopt.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/rimraf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@" 10 | else 11 | exec node "$basedir/../rimraf/bin.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/mkdirp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@" 10 | else 11 | exec node "$basedir/../mkdirp/bin/cmd.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/semver: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../semver/bin/semver" "$@" 10 | else 11 | exec node "$basedir/../semver/bin/semver" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | 4 | ### Releasing a new version: 5 | 6 | - Ensure tests are passing on travis and appveyor 7 | - Run `node scripts/abi_crosswalk.js` and commit any changes 8 | - Update the changelog 9 | - Tag a new release like: `git tag -a v0.6.34 -m "tagging v0.6.34" && git push --tags` 10 | - Run `npm publish` 11 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nodemon: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../nodemon/bin/nodemon.js" "$@" 10 | else 11 | exec node "$basedir/../nodemon/bin/nodemon.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/color-support: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../color-support/bin.js" "$@" 10 | else 11 | exec node "$basedir/../color-support/bin.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nodetouch: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../touch/bin/nodetouch.js" "$@" 10 | else 11 | exec node "$basedir/../touch/bin/nodetouch.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/uglifyjs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../uglify-js/bin/uglifyjs" "$@" 10 | else 11 | exec node "$basedir/../uglify-js/bin/uglifyjs" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/handlebars: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../handlebars/bin/handlebars" "$@" 10 | else 11 | exec node "$basedir/../handlebars/bin/handlebars" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/.bin/nopt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@" 10 | else 11 | exec node "$basedir/../nopt/bin/nopt.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/mime.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/rc.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rc\cli.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/.bin/semver: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" 10 | else 11 | exec node "$basedir/../semver/bin/semver.js" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/is-ci.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\is-ci\bin.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/node-pre-gyp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | exec "$basedir/node" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" "$@" 10 | else 11 | exec node "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" "$@" 12 | fi 13 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nopt.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/rimraf.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/mkdirp.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/semver.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nodemon.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nodemon\bin\nodemon.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/uglifyjs.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\uglify-js\bin\uglifyjs" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/color-support.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\color-support\bin.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/handlebars.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\handlebars\bin\handlebars" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nodetouch.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\touch\bin\nodetouch.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/node-pre-gyp.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@mapbox\node-pre-gyp\bin\node-pre-gyp" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/.bin/nopt.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %* 18 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/.bin/semver.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | GOTO start 3 | :find_dp0 4 | SET dp0=%~dp0 5 | EXIT /b 6 | :start 7 | SETLOCAL 8 | CALL :find_dp0 9 | 10 | IF EXIST "%dp0%\node.exe" ( 11 | SET "_prog=%dp0%\node.exe" 12 | ) ELSE ( 13 | SET "_prog=node" 14 | SET PATHEXT=%PATHEXT:;.JS;=;% 15 | ) 16 | 17 | endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* 18 | -------------------------------------------------------------------------------- /confiq/connection.js: -------------------------------------------------------------------------------- 1 | const mongoClient=require('mongodb').MongoClient 2 | const state={ 3 | db:null 4 | } 5 | module.exports.connect=function(done){ 6 | const url='mongodb://localhost:27017' 7 | const dbname='shopping' 8 | 9 | mongoClient.connect(url,(err,data)=>{ 10 | if(err) return done(err) 11 | state.db=data.db(dbname) 12 | 13 | }) 14 | done() 15 | } 16 | module.exports.get=function(){ 17 | return state.db 18 | } -------------------------------------------------------------------------------- /E-project/confiq/connection.js: -------------------------------------------------------------------------------- 1 | const mongoClient=require('mongodb').MongoClient 2 | const state={ 3 | db:null 4 | } 5 | module.exports.connect=function(done){ 6 | const url='mongodb://localhost:27017' 7 | const dbname='shopping' 8 | 9 | mongoClient.connect(url,(err,data)=>{ 10 | if(err) return done(err) 11 | state.db=data.db(dbname) 12 | 13 | }) 14 | done() 15 | } 16 | module.exports.get=function(){ 17 | return state.db 18 | } -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/rebuild.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = rebuild; 4 | 5 | exports.usage = 'Runs "clean" and "build" at once'; 6 | 7 | const napi = require('./util/napi.js'); 8 | 9 | function rebuild(gyp, argv, callback) { 10 | const package_json = gyp.package_json; 11 | let commands = [ 12 | { name: 'clean', args: [] }, 13 | { name: 'build', args: ['rebuild'] } 14 | ]; 15 | commands = napi.expand_commands(package_json, gyp.opts, commands); 16 | for (let i = commands.length; i !== 0; i--) { 17 | gyp.todo.unshift(commands[i - 1]); 18 | } 19 | process.nextTick(callback); 20 | } 21 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/reinstall.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = rebuild; 4 | 5 | exports.usage = 'Runs "clean" and "install" at once'; 6 | 7 | const napi = require('./util/napi.js'); 8 | 9 | function rebuild(gyp, argv, callback) { 10 | const package_json = gyp.package_json; 11 | let installArgs = []; 12 | const napi_build_version = napi.get_best_napi_build_version(package_json, gyp.opts); 13 | if (napi_build_version != null) installArgs = [napi.get_command_arg(napi_build_version)]; 14 | gyp.todo.unshift( 15 | { name: 'clean', args: [] }, 16 | { name: 'install', args: installArgs } 17 | ); 18 | process.nextTick(callback); 19 | } 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "e-project", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "nodemon ./bin/www" 7 | }, 8 | "dependencies": { 9 | "bcrypt": "^5.0.1", 10 | "cookie-parser": "~1.4.4", 11 | "debug": "~2.6.9", 12 | "express": "~4.16.1", 13 | "express-fileupload": "^1.3.1", 14 | "express-handlebars": "^6.0.5", 15 | "express-session": "^1.17.2", 16 | "hbs": "^4.2.0", 17 | "http-errors": "~1.6.3", 18 | "js-image-zoom": "^0.7.0", 19 | "mongodb": "^4.5.0", 20 | "morgan": "~1.9.1", 21 | "nodemon": "^2.0.15", 22 | "promis": "^1.1.4", 23 | "promise": "^8.1.0", 24 | "twilio": "^3.76.1" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Node-webkit-based module test 6 | 22 | 23 | 24 |

Node-webkit-based module test

25 | 26 | 27 | -------------------------------------------------------------------------------- /views/index.hbs: -------------------------------------------------------------------------------- 1 | 2 |
3 |

gj

4 |
5 |
6 | {{#each products}} 7 |
8 |
9 | Card image cap 13 |
14 |
{{this.name}}
15 |

{{this.description}}

16 | Add Cart 17 |
18 |
19 |
20 | 21 | {{/each}} 22 |
23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/nopt/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter and Contributors 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /views/admin/add-category.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | 7 | 8 |
9 | 10 | 11 |
12 | 13 | 14 | z 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | 23 |
24 |
25 |
-------------------------------------------------------------------------------- /E-project/node_modules/.bin/rc.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../rc/cli.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../rc/cli.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../rc/cli.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../rc/cli.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/mime.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../mime/cli.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../mime/cli.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/is-ci.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../is-ci/bin.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../is-ci/bin.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../is-ci/bin.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../is-ci/bin.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/rimraf.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../rimraf/bin.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../rimraf/bin.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/nopt/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nopt", 3 | "version": "5.0.0", 4 | "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", 5 | "author": "Isaac Z. Schlueter (http://blog.izs.me/)", 6 | "main": "lib/nopt.js", 7 | "scripts": { 8 | "preversion": "npm test", 9 | "postversion": "npm publish", 10 | "prepublishOnly": "git push origin --follow-tags", 11 | "test": "tap test/*.js" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/npm/nopt.git" 16 | }, 17 | "bin": { 18 | "nopt": "bin/nopt.js" 19 | }, 20 | "license": "ISC", 21 | "dependencies": { 22 | "abbrev": "1" 23 | }, 24 | "devDependencies": { 25 | "tap": "^14.10.6" 26 | }, 27 | "files": [ 28 | "bin", 29 | "lib" 30 | ], 31 | "engines": { 32 | "node": ">=6" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nopt.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/mkdirp.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/semver.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../semver/bin/semver" $args 23 | } else { 24 | & "node$exe" "$basedir/../semver/bin/semver" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /views/admin/admin-login.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Admin Login

5 |
6 | {{#if msg}} 7 |

Login failed

8 | {{/if}} 9 |
10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 | 18 | 19 |
20 |
21 |
22 |
-------------------------------------------------------------------------------- /E-project/node_modules/.bin/color-support.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../color-support/bin.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../color-support/bin.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../color-support/bin.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../color-support/bin.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nodemon.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/nodetouch.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/uglifyjs.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args 23 | } else { 24 | & "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/.bin/nopt.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/handlebars.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../handlebars/bin/handlebars" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../handlebars/bin/handlebars" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../handlebars/bin/handlebars" $args 23 | } else { 24 | & "node$exe" "$basedir/../handlebars/bin/handlebars" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/.bin/semver.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args 23 | } else { 24 | & "node$exe" "$basedir/../semver/bin/semver.js" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/.bin/node-pre-gyp.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | # Support pipeline input 13 | if ($MyInvocation.ExpectingInput) { 14 | $input | & "$basedir/node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args 15 | } else { 16 | & "$basedir/node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args 17 | } 18 | $ret=$LASTEXITCODE 19 | } else { 20 | # Support pipeline input 21 | if ($MyInvocation.ExpectingInput) { 22 | $input | & "node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args 23 | } else { 24 | & "node$exe" "$basedir/../@mapbox/node-pre-gyp/bin/node-pre-gyp" $args 25 | } 26 | $ret=$LASTEXITCODE 27 | } 28 | exit $ret 29 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/reveal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = reveal; 4 | 5 | exports.usage = 'Reveals data on the versioned binary'; 6 | 7 | const versioning = require('./util/versioning.js'); 8 | const napi = require('./util/napi.js'); 9 | 10 | function unix_paths(key, val) { 11 | return val && val.replace ? val.replace(/\\/g, '/') : val; 12 | } 13 | 14 | function reveal(gyp, argv, callback) { 15 | const package_json = gyp.package_json; 16 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 17 | const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 18 | let hit = false; 19 | // if a second arg is passed look to see 20 | // if it is a known option 21 | // console.log(JSON.stringify(gyp.opts,null,1)) 22 | const remain = gyp.opts.argv.remain[gyp.opts.argv.remain.length - 1]; 23 | if (remain && Object.hasOwnProperty.call(opts, remain)) { 24 | console.log(opts[remain].replace(/\\/g, '/')); 25 | hit = true; 26 | } 27 | // otherwise return all options as json 28 | if (!hit) { 29 | console.log(JSON.stringify(opts, unix_paths, 2)); 30 | } 31 | return callback(); 32 | } 33 | -------------------------------------------------------------------------------- /views/user/view-category.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | {{#each products}} 7 |
8 |
9 | 10 | 11 | ... 12 |
13 |

{{this.brand}}
14 | {{this.description}} 15 | 16 |
₹{{this.offerPrice}} orginal price ₹{{this.orginalPrice}} 17 |
{{this.offerpercentage}}% off
Hurry, Only 7 left!

18 | 19 | 20 |

21 | ADD CART 22 |

23 | 24 | 25 |
26 |
27 |
28 | {{/each}} 29 |
30 |
31 |
32 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/clean.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = clean; 4 | 5 | exports.usage = 'Removes the entire folder containing the compiled .node module'; 6 | 7 | const rm = require('rimraf'); 8 | const exists = require('fs').exists || require('path').exists; 9 | const versioning = require('./util/versioning.js'); 10 | const napi = require('./util/napi.js'); 11 | const path = require('path'); 12 | 13 | function clean(gyp, argv, callback) { 14 | const package_json = gyp.package_json; 15 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 16 | const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 17 | const to_delete = opts.module_path; 18 | if (!to_delete) { 19 | return callback(new Error('module_path is empty, refusing to delete')); 20 | } else if (path.normalize(to_delete) === path.normalize(process.cwd())) { 21 | return callback(new Error('module_path is not set, refusing to delete')); 22 | } else { 23 | exists(to_delete, (found) => { 24 | if (found) { 25 | if (!gyp.opts.silent_clean) console.log('[' + package_json.name + '] Removing "%s"', to_delete); 26 | return rm(to_delete, callback); 27 | } 28 | return callback(); 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const npg = require('..'); 4 | const versioning = require('../lib/util/versioning.js'); 5 | const napi = require('../lib/util/napi.js'); 6 | const existsSync = require('fs').existsSync || require('path').existsSync; 7 | const path = require('path'); 8 | 9 | module.exports = exports; 10 | 11 | exports.usage = 'Finds the require path for the node-pre-gyp installed module'; 12 | 13 | exports.validate = function(package_json, opts) { 14 | versioning.validate_config(package_json, opts); 15 | }; 16 | 17 | exports.find = function(package_json_path, opts) { 18 | if (!existsSync(package_json_path)) { 19 | throw new Error(package_json_path + 'does not exist'); 20 | } 21 | const prog = new npg.Run({ package_json_path, argv: process.argv }); 22 | prog.setBinaryHostProperty(); 23 | const package_json = prog.package_json; 24 | 25 | versioning.validate_config(package_json, opts); 26 | let napi_build_version; 27 | if (napi.get_napi_build_versions(package_json, opts)) { 28 | napi_build_version = napi.get_best_napi_build_version(package_json, opts); 29 | } 30 | opts = opts || {}; 31 | if (!opts.module_root) opts.module_root = path.dirname(package_json_path); 32 | const meta = versioning.evaluate(package_json, opts, napi_build_version); 33 | return meta.module; 34 | }; 35 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/info.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = info; 4 | 5 | exports.usage = 'Lists all published binaries (requires aws-sdk)'; 6 | 7 | const log = require('npmlog'); 8 | const versioning = require('./util/versioning.js'); 9 | const s3_setup = require('./util/s3_setup.js'); 10 | 11 | function info(gyp, argv, callback) { 12 | const package_json = gyp.package_json; 13 | const opts = versioning.evaluate(package_json, gyp.opts); 14 | const config = {}; 15 | s3_setup.detect(opts, config); 16 | const s3 = s3_setup.get_s3(config); 17 | const s3_opts = { 18 | Bucket: config.bucket, 19 | Prefix: config.prefix 20 | }; 21 | s3.listObjects(s3_opts, (err, meta) => { 22 | if (err && err.code === 'NotFound') { 23 | return callback(new Error('[' + package_json.name + '] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + config.prefix)); 24 | } else if (err) { 25 | return callback(err); 26 | } else { 27 | log.verbose(JSON.stringify(meta, null, 1)); 28 | if (meta && meta.Contents) { 29 | meta.Contents.forEach((obj) => { 30 | console.log(obj.Key); 31 | }); 32 | } else { 33 | console.error('[' + package_json.name + '] No objects found at https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + config.prefix); 34 | } 35 | return callback(); 36 | } 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c), Mapbox 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | * Neither the name of node-pre-gyp nor the names of its contributors 14 | may be used to endorse or promote products derived from this software 15 | without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/unpublish.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = unpublish; 4 | 5 | exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)'; 6 | 7 | const log = require('npmlog'); 8 | const versioning = require('./util/versioning.js'); 9 | const napi = require('./util/napi.js'); 10 | const s3_setup = require('./util/s3_setup.js'); 11 | const url = require('url'); 12 | 13 | function unpublish(gyp, argv, callback) { 14 | const package_json = gyp.package_json; 15 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 16 | const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 17 | const config = {}; 18 | s3_setup.detect(opts, config); 19 | const s3 = s3_setup.get_s3(config); 20 | const key_name = url.resolve(config.prefix, opts.package_name); 21 | const s3_opts = { 22 | Bucket: config.bucket, 23 | Key: key_name 24 | }; 25 | s3.headObject(s3_opts, (err, meta) => { 26 | if (err && err.code === 'NotFound') { 27 | console.log('[' + package_json.name + '] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key); 28 | return callback(); 29 | } else if (err) { 30 | return callback(err); 31 | } else { 32 | log.info('unpublish', JSON.stringify(meta)); 33 | s3.deleteObject(s3_opts, (err2, resp) => { 34 | if (err2) return callback(err2); 35 | log.info(JSON.stringify(resp)); 36 | console.log('[' + package_json.name + '] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key); 37 | return callback(); 38 | }); 39 | } 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var createError = require('http-errors'); 2 | var express = require('express'); 3 | var path = require('path'); 4 | var cookieParser = require('cookie-parser'); 5 | var logger = require('morgan'); 6 | 7 | var userRouter = require('./routes/user'); 8 | var adminRouter = require('./routes/admin'); 9 | var hbs=require('express-handlebars') 10 | var fileUpload=require('express-fileupload') 11 | var db=require('./confiq/connection') 12 | var session=require('express-session') 13 | 14 | var app = express(); 15 | 16 | // view engine setup 17 | app.set('views', path.join(__dirname, 'views')); 18 | app.set('view engine', 'hbs'); 19 | app.engine('hbs',hbs.engine({extname:'hbs',defaultLayout:'layout',layoutsDir:__dirname+'/views/layout/',partialsDir:__dirname+'/views/partials/'})); 20 | 21 | app.use(logger('dev')); 22 | app.use(express.json()); 23 | app.use(express.urlencoded({ extended: false })); 24 | app.use(cookieParser()); 25 | app.use(express.static(path.join(__dirname, 'public'))); 26 | app.use(fileUpload()) 27 | db.connect((err)=>{ 28 | if(err) 29 | console.log("connection error"+err); 30 | else console.log("database connecter to port"); 31 | 32 | }) 33 | app.use(session({secret:"key",cookie:{maxAge:6000000}})) 34 | 35 | app.use('/', userRouter); 36 | app.use('/admin', adminRouter); 37 | 38 | // catch 404 and forward to error handler 39 | app.use(function(req, res, next) { 40 | next(createError(404)); 41 | }); 42 | 43 | // error handler 44 | app.use(function(err, req, res, next) { 45 | // set locals, only providing error in development 46 | res.locals.message = err.message; 47 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 48 | 49 | // render the error page 50 | res.status(err.status || 500); 51 | res.render('error'); 52 | }); 53 | 54 | module.exports = app; 55 | -------------------------------------------------------------------------------- /E-project/app.js: -------------------------------------------------------------------------------- 1 | var createError = require('http-errors'); 2 | var express = require('express'); 3 | var path = require('path'); 4 | var cookieParser = require('cookie-parser'); 5 | var logger = require('morgan'); 6 | 7 | var userRouter = require('./routes/user'); 8 | var adminRouter = require('./routes/admin'); 9 | var hbs=require('express-handlebars') 10 | var fileUpload=require('express-fileupload') 11 | var db=require('./confiq/connection') 12 | var session=require('express-session') 13 | 14 | var app = express(); 15 | 16 | // view engine setup 17 | app.set('views', path.join(__dirname, 'views')); 18 | app.set('view engine', 'hbs'); 19 | app.engine('hbs',hbs.engine({extname:'hbs',defaultLayout:'layout',layoutsDir:__dirname+'/views/layout/',partialsDir:__dirname+'/views/partials/'})); 20 | 21 | app.use(logger('dev')); 22 | app.use(express.json()); 23 | app.use(express.urlencoded({ extended: false })); 24 | app.use(cookieParser()); 25 | app.use(express.static(path.join(__dirname, 'public'))); 26 | app.use(fileUpload()) 27 | db.connect((err)=>{ 28 | if(err) 29 | console.log("connection error"+err); 30 | else console.log("database connecter to port"); 31 | 32 | }) 33 | app.use(session({secret:"key",cookie:{maxAge:6000000}})) 34 | 35 | app.use('/', userRouter); 36 | app.use('/admin', adminRouter); 37 | 38 | // catch 404 and forward to error handler 39 | app.use(function(req, res, next) { 40 | next(createError(404)); 41 | }); 42 | 43 | // error handler 44 | app.use(function(err, req, res, next) { 45 | // set locals, only providing error in development 46 | res.locals.message = err.message; 47 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 48 | 49 | // render the error page 50 | res.status(err.status || 500); 51 | res.render('error'); 52 | }); 53 | 54 | module.exports = app; 55 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/nopt/bin/nopt.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var nopt = require("../lib/nopt") 3 | , path = require("path") 4 | , types = { num: Number 5 | , bool: Boolean 6 | , help: Boolean 7 | , list: Array 8 | , "num-list": [Number, Array] 9 | , "str-list": [String, Array] 10 | , "bool-list": [Boolean, Array] 11 | , str: String 12 | , clear: Boolean 13 | , config: Boolean 14 | , length: Number 15 | , file: path 16 | } 17 | , shorthands = { s: [ "--str", "astring" ] 18 | , b: [ "--bool" ] 19 | , nb: [ "--no-bool" ] 20 | , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] 21 | , "?": ["--help"] 22 | , h: ["--help"] 23 | , H: ["--help"] 24 | , n: [ "--num", "125" ] 25 | , c: ["--config"] 26 | , l: ["--length"] 27 | , f: ["--file"] 28 | } 29 | , parsed = nopt( types 30 | , shorthands 31 | , process.argv 32 | , 2 ) 33 | 34 | console.log("parsed", parsed) 35 | 36 | if (parsed.help) { 37 | console.log("") 38 | console.log("nopt cli tester") 39 | console.log("") 40 | console.log("types") 41 | console.log(Object.keys(types).map(function M (t) { 42 | var type = types[t] 43 | if (Array.isArray(type)) { 44 | return [t, type.map(function (type) { return type.name })] 45 | } 46 | return [t, type && type.name] 47 | }).reduce(function (s, i) { 48 | s[i[0]] = i[1] 49 | return s 50 | }, {})) 51 | console.log("") 52 | console.log("shorthands") 53 | console.log(shorthands) 54 | } 55 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/testpackage.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = testpackage; 4 | 5 | exports.usage = 'Tests that the staged package is valid'; 6 | 7 | const fs = require('fs'); 8 | const path = require('path'); 9 | const log = require('npmlog'); 10 | const existsAsync = fs.exists || path.exists; 11 | const versioning = require('./util/versioning.js'); 12 | const napi = require('./util/napi.js'); 13 | const testbinary = require('./testbinary.js'); 14 | const tar = require('tar'); 15 | const makeDir = require('make-dir'); 16 | 17 | function testpackage(gyp, argv, callback) { 18 | const package_json = gyp.package_json; 19 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 20 | const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 21 | const tarball = opts.staged_tarball; 22 | existsAsync(tarball, (found) => { 23 | if (!found) { 24 | return callback(new Error('Cannot test package because ' + tarball + ' missing: run `node-pre-gyp package` first')); 25 | } 26 | const to = opts.module_path; 27 | function filter_func(entry) { 28 | log.info('install', 'unpacking [' + entry.path + ']'); 29 | } 30 | 31 | makeDir(to).then(() => { 32 | tar.extract({ 33 | file: tarball, 34 | cwd: to, 35 | strip: 1, 36 | onentry: filter_func 37 | }).then(after_extract, callback); 38 | }).catch((err) => { 39 | return callback(err); 40 | }); 41 | 42 | function after_extract() { 43 | testbinary(gyp, argv, (err) => { 44 | if (err) { 45 | return callback(err); 46 | } else { 47 | console.log('[' + package_json.name + '] Package appears valid'); 48 | return callback(); 49 | } 50 | }); 51 | } 52 | }); 53 | } 54 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = build; 4 | 5 | exports.usage = 'Attempts to compile the module by dispatching to node-gyp or nw-gyp'; 6 | 7 | const napi = require('./util/napi.js'); 8 | const compile = require('./util/compile.js'); 9 | const handle_gyp_opts = require('./util/handle_gyp_opts.js'); 10 | const configure = require('./configure.js'); 11 | 12 | function do_build(gyp, argv, callback) { 13 | handle_gyp_opts(gyp, argv, (err, result) => { 14 | let final_args = ['build'].concat(result.gyp).concat(result.pre); 15 | if (result.unparsed.length > 0) { 16 | final_args = final_args. 17 | concat(['--']). 18 | concat(result.unparsed); 19 | } 20 | if (!err && result.opts.napi_build_version) { 21 | napi.swap_build_dir_in(result.opts.napi_build_version); 22 | } 23 | compile.run_gyp(final_args, result.opts, (err2) => { 24 | if (result.opts.napi_build_version) { 25 | napi.swap_build_dir_out(result.opts.napi_build_version); 26 | } 27 | return callback(err2); 28 | }); 29 | }); 30 | } 31 | 32 | function build(gyp, argv, callback) { 33 | 34 | // Form up commands to pass to node-gyp: 35 | // We map `node-pre-gyp build` to `node-gyp configure build` so that we do not 36 | // trigger a clean and therefore do not pay the penalty of a full recompile 37 | if (argv.length && (argv.indexOf('rebuild') > -1)) { 38 | argv.shift(); // remove `rebuild` 39 | // here we map `node-pre-gyp rebuild` to `node-gyp rebuild` which internally means 40 | // "clean + configure + build" and triggers a full recompile 41 | compile.run_gyp(['clean'], {}, (err3) => { 42 | if (err3) return callback(err3); 43 | configure(gyp, argv, (err4) => { 44 | if (err4) return callback(err4); 45 | return do_build(gyp, argv, callback); 46 | }); 47 | }); 48 | } else { 49 | return do_build(gyp, argv, callback); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('e-project:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /E-project/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('e-project:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/configure.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = configure; 4 | 5 | exports.usage = 'Attempts to configure node-gyp or nw-gyp build'; 6 | 7 | const napi = require('./util/napi.js'); 8 | const compile = require('./util/compile.js'); 9 | const handle_gyp_opts = require('./util/handle_gyp_opts.js'); 10 | 11 | function configure(gyp, argv, callback) { 12 | handle_gyp_opts(gyp, argv, (err, result) => { 13 | let final_args = result.gyp.concat(result.pre); 14 | // pull select node-gyp configure options out of the npm environ 15 | const known_gyp_args = ['dist-url', 'python', 'nodedir', 'msvs_version']; 16 | known_gyp_args.forEach((key) => { 17 | const val = gyp.opts[key] || gyp.opts[key.replace('-', '_')]; 18 | if (val) { 19 | final_args.push('--' + key + '=' + val); 20 | } 21 | }); 22 | // --ensure=false tell node-gyp to re-install node development headers 23 | // but it is only respected by node-gyp install, so we have to call install 24 | // as a separate step if the user passes it 25 | if (gyp.opts.ensure === false) { 26 | const install_args = final_args.concat(['install', '--ensure=false']); 27 | compile.run_gyp(install_args, result.opts, (err2) => { 28 | if (err2) return callback(err2); 29 | if (result.unparsed.length > 0) { 30 | final_args = final_args. 31 | concat(['--']). 32 | concat(result.unparsed); 33 | } 34 | compile.run_gyp(['configure'].concat(final_args), result.opts, (err3) => { 35 | return callback(err3); 36 | }); 37 | }); 38 | } else { 39 | if (result.unparsed.length > 0) { 40 | final_args = final_args. 41 | concat(['--']). 42 | concat(result.unparsed); 43 | } 44 | compile.run_gyp(['configure'].concat(final_args), result.opts, (err4) => { 45 | if (!err4 && result.opts.napi_build_version) { 46 | napi.swap_build_dir_out(result.opts.napi_build_version); 47 | } 48 | return callback(err4); 49 | }); 50 | } 51 | }); 52 | } 53 | -------------------------------------------------------------------------------- /views/user/verify-otp.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 | 8 | 9 |
10 |
11 | 12 | 13 |

Enter Otp

14 | {{#if number}} 15 |

Invalid Otp Please Check Phone Number

16 | {{else}} 17 |

{{phone}}

18 | {{/if}} 19 | 20 | 21 |
22 | 23 | 24 |
25 | 26 | 27 |

Resent OTP

28 | 29 | 30 | 31 |
32 | 33 | 34 | 35 |
36 | 37 |
38 | 39 |
40 |

Don't have an account? Sign Up 41 |

42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
-------------------------------------------------------------------------------- /views/user/login.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 | 8 | 9 |
10 |
11 | 12 | 13 |

Login

14 | {{#if loginErr}} 15 |

invalid password

16 | {{/if}} 17 | {{#if userBlock}} 18 |

your Are Blocked

19 | {{/if}} 20 | 21 |

Please enter your login and password!

22 | 23 |
24 | 25 | 26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 |

LOGIN WITH OTP

34 | 35 | 36 | 37 |
38 | 39 | 40 | 41 |
42 | 43 |
44 | 45 |
46 |

Don't have an account? Sign Up 47 |

48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
-------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/package.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = _package; 4 | 5 | exports.usage = 'Packs binary (and enclosing directory) into locally staged tarball'; 6 | 7 | const fs = require('fs'); 8 | const path = require('path'); 9 | const log = require('npmlog'); 10 | const versioning = require('./util/versioning.js'); 11 | const napi = require('./util/napi.js'); 12 | const existsAsync = fs.exists || path.exists; 13 | const makeDir = require('make-dir'); 14 | const tar = require('tar'); 15 | 16 | function readdirSync(dir) { 17 | let list = []; 18 | const files = fs.readdirSync(dir); 19 | 20 | files.forEach((file) => { 21 | const stats = fs.lstatSync(path.join(dir, file)); 22 | if (stats.isDirectory()) { 23 | list = list.concat(readdirSync(path.join(dir, file))); 24 | } else { 25 | list.push(path.join(dir, file)); 26 | } 27 | }); 28 | return list; 29 | } 30 | 31 | function _package(gyp, argv, callback) { 32 | const package_json = gyp.package_json; 33 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 34 | const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 35 | const from = opts.module_path; 36 | const binary_module = path.join(from, opts.module_name + '.node'); 37 | existsAsync(binary_module, (found) => { 38 | if (!found) { 39 | return callback(new Error('Cannot package because ' + binary_module + ' missing: run `node-pre-gyp rebuild` first')); 40 | } 41 | const tarball = opts.staged_tarball; 42 | const filter_func = function(entry) { 43 | const basename = path.basename(entry); 44 | if (basename.length && basename[0] !== '.') { 45 | console.log('packing ' + entry); 46 | return true; 47 | } else { 48 | console.log('skipping ' + entry); 49 | } 50 | return false; 51 | }; 52 | makeDir(path.dirname(tarball)).then(() => { 53 | let files = readdirSync(from); 54 | const base = path.basename(from); 55 | files = files.map((file) => { 56 | return path.join(base, path.relative(from, file)); 57 | }); 58 | tar.create({ 59 | portable: false, 60 | gzip: true, 61 | filter: filter_func, 62 | file: tarball, 63 | cwd: path.dirname(from) 64 | }, files, (err2) => { 65 | if (err2) console.error('[' + package_json.name + '] ' + err2.message); 66 | else log.info('package', 'Binary staged at "' + tarball + '"'); 67 | return callback(err2); 68 | }); 69 | }).catch((err) => { 70 | return callback(err); 71 | }); 72 | }); 73 | } 74 | -------------------------------------------------------------------------------- /views/user/view-image.hbs: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |
7 | 8 |
9 | 10 |
11 |
12 | 13 | {{product.description}} 14 |

₹{{product.offerPrice}}₹{{product.orginalPrice}} {{product.offerpercentage}}%off

15 |

Available offers
16 | 17 | Bank Offer10% off on Slice Cards, up to ₹200. On orders of ₹1000 and aboveT&C
18 | 19 | Bank Offer5% Cashback on Flipkart Axis Bank a CardT&C
20 | 21 | Partner OfferBuy this product and get upto ₹500 off on Flipkart Furniture Know More
22 | 23 | Partner OfferSign up for Men's card Pay Later and get Card worth ₹100* Know More
24 | 25 | 26 |

38 | 39 |

40 | 41 | 42 |
43 | 44 |
45 | 46 |
47 |
48 | 49 | 50 | 51 | 52 | 53 | 54 |
55 | 56 |
57 | -------------------------------------------------------------------------------- /views/user/order-success.hbs: -------------------------------------------------------------------------------- 1 | 62 |
63 |
64 |
65 |
66 | 67 |
68 |
69 |
70 |
71 |
72 |
3
73 |
74 |
75 |
76 |
77 |
78 |
79 |
Order Confirmed Your illustraion will go to you soon View Invoice
Go to your Order 80 |
81 |
82 | 83 |
84 |
85 |
86 |
87 |
88 |
-------------------------------------------------------------------------------- /views/user/verify-phone.hbs: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |
7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 |

OTP Login

15 | {{#if number}} 16 |

Invalid phone Number

17 | {{/if}} 18 | {{#if userBlock}} 19 |

YOU ARE BLOCKED

20 | {{/if}} 21 | 22 | 23 |
24 | 25 | 26 |
27 | 28 | 29 |

Login With OTP

30 | 31 | 32 | 33 |
34 | 35 | 36 | 37 |
38 | 39 |
40 | 41 |
42 |

Don't have an account? Sign Up 43 |

44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | 53 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports; 4 | 5 | const fs = require('fs'); 6 | const path = require('path'); 7 | const win = process.platform === 'win32'; 8 | const existsSync = fs.existsSync || path.existsSync; 9 | const cp = require('child_process'); 10 | 11 | // try to build up the complete path to node-gyp 12 | /* priority: 13 | - node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887) 14 | - node-gyp on NODE_PATH 15 | - node-gyp inside npm on NODE_PATH (ignore on iojs) 16 | - node-gyp inside npm beside node exe 17 | */ 18 | function which_node_gyp() { 19 | let node_gyp_bin; 20 | if (process.env.npm_config_node_gyp) { 21 | try { 22 | node_gyp_bin = process.env.npm_config_node_gyp; 23 | if (existsSync(node_gyp_bin)) { 24 | return node_gyp_bin; 25 | } 26 | } catch (err) { 27 | // do nothing 28 | } 29 | } 30 | try { 31 | const node_gyp_main = require.resolve('node-gyp'); // eslint-disable-line node/no-missing-require 32 | node_gyp_bin = path.join(path.dirname( 33 | path.dirname(node_gyp_main)), 34 | 'bin/node-gyp.js'); 35 | if (existsSync(node_gyp_bin)) { 36 | return node_gyp_bin; 37 | } 38 | } catch (err) { 39 | // do nothing 40 | } 41 | if (process.execPath.indexOf('iojs') === -1) { 42 | try { 43 | const npm_main = require.resolve('npm'); // eslint-disable-line node/no-missing-require 44 | node_gyp_bin = path.join(path.dirname( 45 | path.dirname(npm_main)), 46 | 'node_modules/node-gyp/bin/node-gyp.js'); 47 | if (existsSync(node_gyp_bin)) { 48 | return node_gyp_bin; 49 | } 50 | } catch (err) { 51 | // do nothing 52 | } 53 | } 54 | const npm_base = path.join(path.dirname( 55 | path.dirname(process.execPath)), 56 | 'lib/node_modules/npm/'); 57 | node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js'); 58 | if (existsSync(node_gyp_bin)) { 59 | return node_gyp_bin; 60 | } 61 | } 62 | 63 | module.exports.run_gyp = function(args, opts, callback) { 64 | let shell_cmd = ''; 65 | const cmd_args = []; 66 | if (opts.runtime && opts.runtime === 'node-webkit') { 67 | shell_cmd = 'nw-gyp'; 68 | if (win) shell_cmd += '.cmd'; 69 | } else { 70 | const node_gyp_path = which_node_gyp(); 71 | if (node_gyp_path) { 72 | shell_cmd = process.execPath; 73 | cmd_args.push(node_gyp_path); 74 | } else { 75 | shell_cmd = 'node-gyp'; 76 | if (win) shell_cmd += '.cmd'; 77 | } 78 | } 79 | const final_args = cmd_args.concat(args); 80 | const cmd = cp.spawn(shell_cmd, final_args, { cwd: undefined, env: process.env, stdio: [0, 1, 2] }); 81 | cmd.on('error', (err) => { 82 | if (err) { 83 | return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ')')); 84 | } 85 | callback(null, opts); 86 | }); 87 | cmd.on('close', (code) => { 88 | if (code && code !== 0) { 89 | return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + code + ')')); 90 | } 91 | callback(null, opts); 92 | }); 93 | }; 94 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/nopt/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### v4.0.1 (2016-12-14) 2 | 3 | #### WHOOPS 4 | 5 | * [`fb9b1ce`](https://github.com/npm/nopt/commit/fb9b1ce57b3c69b4f7819015be87719204f77ef6) 6 | Merged so many patches at once that the code fencing 7 | ([@adius](https://github.com/adius)) added got broken. Sorry, 8 | ([@adius](https://github.com/adius))! 9 | ([@othiym23](https://github.com/othiym23)) 10 | 11 | ### v4.0.0 (2016-12-13) 12 | 13 | #### BREAKING CHANGES 14 | 15 | * [`651d447`](https://github.com/npm/nopt/commit/651d4473946096d341a480bbe56793de3fc706aa) 16 | When parsing String-typed arguments, if the next value is `""`, don't simply 17 | swallow it. ([@samjonester](https://github.com/samjonester)) 18 | 19 | #### PERFORMANCE TWEAKS 20 | 21 | * [`3370ce8`](https://github.com/npm/nopt/commit/3370ce87a7618ba228883861db84ddbcdff252a9) 22 | Simplify initialization. ([@elidoran](https://github.com/elidoran)) 23 | * [`356e58e`](https://github.com/npm/nopt/commit/356e58e3b3b431a4b1af7fd7bdee44c2c0526a09) 24 | Store `Array.isArray(types[arg])` for reuse. 25 | ([@elidoran](https://github.com/elidoran)) 26 | * [`0d95e90`](https://github.com/npm/nopt/commit/0d95e90515844f266015b56d2c80b94e5d14a07e) 27 | Interpret single-item type arrays as a single type. 28 | ([@samjonester](https://github.com/samjonester)) 29 | * [`07c69d3`](https://github.com/npm/nopt/commit/07c69d38b5186450941fbb505550becb78a0e925) 30 | Simplify key-value extraction. ([@elidoran](https://github.com/elidoran)) 31 | * [`39b6e5c`](https://github.com/npm/nopt/commit/39b6e5c65ac47f60cd43a1fbeece5cd4c834c254) 32 | Only call `Date.parse(val)` once. ([@elidoran](https://github.com/elidoran)) 33 | * [`934943d`](https://github.com/npm/nopt/commit/934943dffecb55123a2b15959fe2a359319a5dbd) 34 | Use `osenv.home()` to find a user's home directory instead of assuming it's 35 | always `$HOME`. ([@othiym23](https://github.com/othiym23)) 36 | 37 | #### TEST & CI IMPROVEMENTS 38 | 39 | * [`326ffff`](https://github.com/npm/nopt/commit/326ffff7f78a00bcd316adecf69075f8a8093619) 40 | Fix `/tmp` test to work on Windows. 41 | ([@elidoran](https://github.com/elidoran)) 42 | * [`c89d31a`](https://github.com/npm/nopt/commit/c89d31a49d14f2238bc6672db08da697bbc57f1b) 43 | Only run Windows tests on Windows, only run Unix tests on a Unix. 44 | ([@elidoran](https://github.com/elidoran)) 45 | * [`affd3d1`](https://github.com/npm/nopt/commit/affd3d1d0addffa93006397b2013b18447339366) 46 | Refresh Travis to run the tests against the currently-supported batch of npm 47 | versions. ([@helio](https://github.com/helio)-frota) 48 | * [`55f9449`](https://github.com/npm/nopt/commit/55f94497d163ed4d16dd55fd6c4fb95cc440e66d) 49 | `tap@8.0.1` ([@othiym23](https://github.com/othiym23)) 50 | 51 | #### DOC TWEAKS 52 | 53 | * [`5271229`](https://github.com/npm/nopt/commit/5271229ee7c810217dd51616c086f5d9ab224581) 54 | Use JavaScript code block for syntax highlighting. 55 | ([@adius](https://github.com/adius)) 56 | * [`c0d156f`](https://github.com/npm/nopt/commit/c0d156f229f9994c5dfcec4a8886eceff7a07682) 57 | The code sample in the README had `many2: [ oneThing ]`, and now it has 58 | `many2: [ two, things ]`. ([@silkentrance](https://github.com/silkentrance)) 59 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/testbinary.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = testbinary; 4 | 5 | exports.usage = 'Tests that the binary.node can be required'; 6 | 7 | const path = require('path'); 8 | const log = require('npmlog'); 9 | const cp = require('child_process'); 10 | const versioning = require('./util/versioning.js'); 11 | const napi = require('./util/napi.js'); 12 | 13 | function testbinary(gyp, argv, callback) { 14 | const args = []; 15 | const options = {}; 16 | let shell_cmd = process.execPath; 17 | const package_json = gyp.package_json; 18 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 19 | const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 20 | // skip validation for runtimes we don't explicitly support (like electron) 21 | if (opts.runtime && 22 | opts.runtime !== 'node-webkit' && 23 | opts.runtime !== 'node') { 24 | return callback(); 25 | } 26 | const nw = (opts.runtime && opts.runtime === 'node-webkit'); 27 | // ensure on windows that / are used for require path 28 | const binary_module = opts.module.replace(/\\/g, '/'); 29 | if ((process.arch !== opts.target_arch) || 30 | (process.platform !== opts.target_platform)) { 31 | let msg = 'skipping validation since host platform/arch ('; 32 | msg += process.platform + '/' + process.arch + ')'; 33 | msg += ' does not match target ('; 34 | msg += opts.target_platform + '/' + opts.target_arch + ')'; 35 | log.info('validate', msg); 36 | return callback(); 37 | } 38 | if (nw) { 39 | options.timeout = 5000; 40 | if (process.platform === 'darwin') { 41 | shell_cmd = 'node-webkit'; 42 | } else if (process.platform === 'win32') { 43 | shell_cmd = 'nw.exe'; 44 | } else { 45 | shell_cmd = 'nw'; 46 | } 47 | const modulePath = path.resolve(binary_module); 48 | const appDir = path.join(__dirname, 'util', 'nw-pre-gyp'); 49 | args.push(appDir); 50 | args.push(modulePath); 51 | log.info('validate', "Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'"); 52 | cp.execFile(shell_cmd, args, options, (err, stdout, stderr) => { 53 | // check for normal timeout for node-webkit 54 | if (err) { 55 | if (err.killed === true && err.signal && err.signal.indexOf('SIG') > -1) { 56 | return callback(); 57 | } 58 | const stderrLog = stderr.toString(); 59 | log.info('stderr', stderrLog); 60 | if (/^\s*Xlib:\s*extension\s*"RANDR"\s*missing\s*on\s*display\s*":\d+\.\d+"\.\s*$/.test(stderrLog)) { 61 | log.info('RANDR', 'stderr contains only RANDR error, ignored'); 62 | return callback(); 63 | } 64 | return callback(err); 65 | } 66 | return callback(); 67 | }); 68 | return; 69 | } 70 | args.push('--eval'); 71 | args.push("require('" + binary_module.replace(/'/g, '\'') + "')"); 72 | log.info('validate', "Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'"); 73 | cp.execFile(shell_cmd, args, options, (err, stdout, stderr) => { 74 | if (err) { 75 | return callback(err, { stdout: stdout, stderr: stderr }); 76 | } 77 | return callback(); 78 | }); 79 | } 80 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/publish.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = publish; 4 | 5 | exports.usage = 'Publishes pre-built binary (requires aws-sdk)'; 6 | 7 | const fs = require('fs'); 8 | const path = require('path'); 9 | const log = require('npmlog'); 10 | const versioning = require('./util/versioning.js'); 11 | const napi = require('./util/napi.js'); 12 | const s3_setup = require('./util/s3_setup.js'); 13 | const existsAsync = fs.exists || path.exists; 14 | const url = require('url'); 15 | 16 | function publish(gyp, argv, callback) { 17 | const package_json = gyp.package_json; 18 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 19 | const opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 20 | const tarball = opts.staged_tarball; 21 | existsAsync(tarball, (found) => { 22 | if (!found) { 23 | return callback(new Error('Cannot publish because ' + tarball + ' missing: run `node-pre-gyp package` first')); 24 | } 25 | 26 | log.info('publish', 'Detecting s3 credentials'); 27 | const config = {}; 28 | s3_setup.detect(opts, config); 29 | const s3 = s3_setup.get_s3(config); 30 | 31 | const key_name = url.resolve(config.prefix, opts.package_name); 32 | const s3_opts = { 33 | Bucket: config.bucket, 34 | Key: key_name 35 | }; 36 | log.info('publish', 'Authenticating with s3'); 37 | log.info('publish', config); 38 | 39 | log.info('publish', 'Checking for existing binary at ' + opts.hosted_path); 40 | s3.headObject(s3_opts, (err, meta) => { 41 | if (meta) log.info('publish', JSON.stringify(meta)); 42 | if (err && err.code === 'NotFound') { 43 | // we are safe to publish because 44 | // the object does not already exist 45 | log.info('publish', 'Preparing to put object'); 46 | const s3_put_opts = { 47 | ACL: 'public-read', 48 | Body: fs.createReadStream(tarball), 49 | Key: key_name, 50 | Bucket: config.bucket 51 | }; 52 | log.info('publish', 'Putting object', s3_put_opts.ACL, s3_put_opts.Bucket, s3_put_opts.Key); 53 | try { 54 | s3.putObject(s3_put_opts, (err2, resp) => { 55 | log.info('publish', 'returned from putting object'); 56 | if (err2) { 57 | log.info('publish', 's3 putObject error: "' + err2 + '"'); 58 | return callback(err2); 59 | } 60 | if (resp) log.info('publish', 's3 putObject response: "' + JSON.stringify(resp) + '"'); 61 | log.info('publish', 'successfully put object'); 62 | console.log('[' + package_json.name + '] published to ' + opts.hosted_path); 63 | return callback(); 64 | }); 65 | } catch (err3) { 66 | log.info('publish', 's3 putObject error: "' + err3 + '"'); 67 | return callback(err3); 68 | } 69 | } else if (err) { 70 | log.info('publish', 's3 headObject error: "' + err + '"'); 71 | return callback(err); 72 | } else { 73 | log.error('publish', 'Cannot publish over existing version'); 74 | log.error('publish', "Update the 'version' field in package.json and try again"); 75 | log.error('publish', 'If the previous version was published in error see:'); 76 | log.error('publish', '\t node-pre-gyp unpublish'); 77 | return callback(new Error('Failed publishing to ' + opts.hosted_path)); 78 | } 79 | }); 80 | }); 81 | } 82 | -------------------------------------------------------------------------------- /views/layout/layout.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 27 | 28 | 29 | Hello, world! 30 | 31 | 49 | 50 | 51 | 52 | {{#if admin}} 53 | {{>admin-header}} 54 | {{else home}} 55 | {{else}} 56 | {{>user-header}} 57 | {{/if}} 58 | {{{body}}} 59 | 60 | 61 | 62 | 63 | 68 | 69 | 70 | 71 | 72 | 76 | 77 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Set the title. 5 | */ 6 | 7 | process.title = 'node-pre-gyp'; 8 | 9 | const node_pre_gyp = require('../'); 10 | const log = require('npmlog'); 11 | 12 | /** 13 | * Process and execute the selected commands. 14 | */ 15 | 16 | const prog = new node_pre_gyp.Run({ argv: process.argv }); 17 | let completed = false; 18 | 19 | if (prog.todo.length === 0) { 20 | if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) { 21 | console.log('v%s', prog.version); 22 | process.exit(0); 23 | } else if (~process.argv.indexOf('-h') || ~process.argv.indexOf('--help')) { 24 | console.log('%s', prog.usage()); 25 | process.exit(0); 26 | } 27 | console.log('%s', prog.usage()); 28 | process.exit(1); 29 | } 30 | 31 | // if --no-color is passed 32 | if (prog.opts && Object.hasOwnProperty.call(prog, 'color') && !prog.opts.color) { 33 | log.disableColor(); 34 | } 35 | 36 | log.info('it worked if it ends with', 'ok'); 37 | log.verbose('cli', process.argv); 38 | log.info('using', process.title + '@%s', prog.version); 39 | log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch); 40 | 41 | 42 | /** 43 | * Change dir if -C/--directory was passed. 44 | */ 45 | 46 | const dir = prog.opts.directory; 47 | if (dir) { 48 | const fs = require('fs'); 49 | try { 50 | const stat = fs.statSync(dir); 51 | if (stat.isDirectory()) { 52 | log.info('chdir', dir); 53 | process.chdir(dir); 54 | } else { 55 | log.warn('chdir', dir + ' is not a directory'); 56 | } 57 | } catch (e) { 58 | if (e.code === 'ENOENT') { 59 | log.warn('chdir', dir + ' is not a directory'); 60 | } else { 61 | log.warn('chdir', 'error during chdir() "%s"', e.message); 62 | } 63 | } 64 | } 65 | 66 | function run() { 67 | const command = prog.todo.shift(); 68 | if (!command) { 69 | // done! 70 | completed = true; 71 | log.info('ok'); 72 | return; 73 | } 74 | 75 | // set binary.host when appropriate. host determines the s3 target bucket. 76 | const target = prog.setBinaryHostProperty(command.name); 77 | if (target && ['install', 'publish', 'unpublish', 'info'].indexOf(command.name) >= 0) { 78 | log.info('using binary.host: ' + prog.package_json.binary.host); 79 | } 80 | 81 | prog.commands[command.name](command.args, function(err) { 82 | if (err) { 83 | log.error(command.name + ' error'); 84 | log.error('stack', err.stack); 85 | errorMessage(); 86 | log.error('not ok'); 87 | console.log(err.message); 88 | return process.exit(1); 89 | } 90 | const args_array = [].slice.call(arguments, 1); 91 | if (args_array.length) { 92 | console.log.apply(console, args_array); 93 | } 94 | // now run the next command in the queue 95 | process.nextTick(run); 96 | }); 97 | } 98 | 99 | process.on('exit', (code) => { 100 | if (!completed && !code) { 101 | log.error('Completion callback never invoked!'); 102 | errorMessage(); 103 | process.exit(6); 104 | } 105 | }); 106 | 107 | process.on('uncaughtException', (err) => { 108 | log.error('UNCAUGHT EXCEPTION'); 109 | log.error('stack', err.stack); 110 | errorMessage(); 111 | process.exit(7); 112 | }); 113 | 114 | function errorMessage() { 115 | // copied from npm's lib/util/error-handler.js 116 | const os = require('os'); 117 | log.error('System', os.type() + ' ' + os.release()); 118 | log.error('command', process.argv.map(JSON.stringify).join(' ')); 119 | log.error('cwd', process.cwd()); 120 | log.error('node -v', process.version); 121 | log.error(process.title + ' -v', 'v' + prog.package.version); 122 | } 123 | 124 | // start running the given commands! 125 | run(); 126 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/util/handle_gyp_opts.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = handle_gyp_opts; 4 | 5 | const versioning = require('./versioning.js'); 6 | const napi = require('./napi.js'); 7 | 8 | /* 9 | 10 | Here we gather node-pre-gyp generated options (from versioning) and pass them along to node-gyp. 11 | 12 | We massage the args and options slightly to account for differences in what commands mean between 13 | node-pre-gyp and node-gyp (e.g. see the difference between "build" and "rebuild" below) 14 | 15 | Keep in mind: the values inside `argv` and `gyp.opts` below are different depending on whether 16 | node-pre-gyp is called directory, or if it is called in a `run-script` phase of npm. 17 | 18 | We also try to preserve any command line options that might have been passed to npm or node-pre-gyp. 19 | But this is fairly difficult without passing way to much through. For example `gyp.opts` contains all 20 | the process.env and npm pushes a lot of variables into process.env which node-pre-gyp inherits. So we have 21 | to be very selective about what we pass through. 22 | 23 | For example: 24 | 25 | `npm install --build-from-source` will give: 26 | 27 | argv == [ 'rebuild' ] 28 | gyp.opts.argv == { remain: [ 'install' ], 29 | cooked: [ 'install', '--fallback-to-build' ], 30 | original: [ 'install', '--fallback-to-build' ] } 31 | 32 | `./bin/node-pre-gyp build` will give: 33 | 34 | argv == [] 35 | gyp.opts.argv == { remain: [ 'build' ], 36 | cooked: [ 'build' ], 37 | original: [ '-C', 'test/app1', 'build' ] } 38 | 39 | */ 40 | 41 | // select set of node-pre-gyp versioning info 42 | // to share with node-gyp 43 | const share_with_node_gyp = [ 44 | 'module', 45 | 'module_name', 46 | 'module_path', 47 | 'napi_version', 48 | 'node_abi_napi', 49 | 'napi_build_version', 50 | 'node_napi_label' 51 | ]; 52 | 53 | function handle_gyp_opts(gyp, argv, callback) { 54 | 55 | // Collect node-pre-gyp specific variables to pass to node-gyp 56 | const node_pre_gyp_options = []; 57 | // generate custom node-pre-gyp versioning info 58 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 59 | const opts = versioning.evaluate(gyp.package_json, gyp.opts, napi_build_version); 60 | share_with_node_gyp.forEach((key) => { 61 | const val = opts[key]; 62 | if (val) { 63 | node_pre_gyp_options.push('--' + key + '=' + val); 64 | } else if (key === 'napi_build_version') { 65 | node_pre_gyp_options.push('--' + key + '=0'); 66 | } else { 67 | if (key !== 'napi_version' && key !== 'node_abi_napi') 68 | return callback(new Error('Option ' + key + ' required but not found by node-pre-gyp')); 69 | } 70 | }); 71 | 72 | // Collect options that follow the special -- which disables nopt parsing 73 | const unparsed_options = []; 74 | let double_hyphen_found = false; 75 | gyp.opts.argv.original.forEach((opt) => { 76 | if (double_hyphen_found) { 77 | unparsed_options.push(opt); 78 | } 79 | if (opt === '--') { 80 | double_hyphen_found = true; 81 | } 82 | }); 83 | 84 | // We try respect and pass through remaining command 85 | // line options (like --foo=bar) to node-gyp 86 | const cooked = gyp.opts.argv.cooked; 87 | const node_gyp_options = []; 88 | cooked.forEach((value) => { 89 | if (value.length > 2 && value.slice(0, 2) === '--') { 90 | const key = value.slice(2); 91 | const val = cooked[cooked.indexOf(value) + 1]; 92 | if (val && val.indexOf('--') === -1) { // handle '--foo=bar' or ['--foo','bar'] 93 | node_gyp_options.push('--' + key + '=' + val); 94 | } else { // pass through --foo 95 | node_gyp_options.push(value); 96 | } 97 | } 98 | }); 99 | 100 | const result = { 'opts': opts, 'gyp': node_gyp_options, 'pre': node_pre_gyp_options, 'unparsed': unparsed_options }; 101 | return callback(null, result); 102 | } 103 | -------------------------------------------------------------------------------- /views/user/view-products.hbs: -------------------------------------------------------------------------------- 1 | 2 | 31 | 32 | 33 |

CATEGORY

34 | 35 | 36 |
37 |
38 |
39 | {{#each category}} 40 |
41 |
42 | 43 | 100x100 44 |
45 |
{{this.category}}
46 |
47 |
48 |
49 | {{/each}} 50 |
51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
61 |
62 |
63 | {{#each products}} 64 |
65 |
66 | 67 | 68 | ... 69 |
70 |

{{this.brand}}
71 | {{this.description}} 72 | 73 |
₹{{this.offerPrice}} orginal price ₹{{this.orginalPrice}} 74 |
{{this.offerpercentage}}% off
Hurry, Only 7 left!

75 | 76 | 77 |

78 | 79 |

80 | 81 | 82 |
83 |
84 |
85 | {{/each}} 86 |
87 |
88 |
89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/semver/classes/comparator.js: -------------------------------------------------------------------------------- 1 | const ANY = Symbol('SemVer ANY') 2 | // hoisted class for cyclic dependency 3 | class Comparator { 4 | static get ANY () { 5 | return ANY 6 | } 7 | 8 | constructor (comp, options) { 9 | options = parseOptions(options) 10 | 11 | if (comp instanceof Comparator) { 12 | if (comp.loose === !!options.loose) { 13 | return comp 14 | } else { 15 | comp = comp.value 16 | } 17 | } 18 | 19 | debug('comparator', comp, options) 20 | this.options = options 21 | this.loose = !!options.loose 22 | this.parse(comp) 23 | 24 | if (this.semver === ANY) { 25 | this.value = '' 26 | } else { 27 | this.value = this.operator + this.semver.version 28 | } 29 | 30 | debug('comp', this) 31 | } 32 | 33 | parse (comp) { 34 | const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] 35 | const m = comp.match(r) 36 | 37 | if (!m) { 38 | throw new TypeError(`Invalid comparator: ${comp}`) 39 | } 40 | 41 | this.operator = m[1] !== undefined ? m[1] : '' 42 | if (this.operator === '=') { 43 | this.operator = '' 44 | } 45 | 46 | // if it literally is just '>' or '' then allow anything. 47 | if (!m[2]) { 48 | this.semver = ANY 49 | } else { 50 | this.semver = new SemVer(m[2], this.options.loose) 51 | } 52 | } 53 | 54 | toString () { 55 | return this.value 56 | } 57 | 58 | test (version) { 59 | debug('Comparator.test', version, this.options.loose) 60 | 61 | if (this.semver === ANY || version === ANY) { 62 | return true 63 | } 64 | 65 | if (typeof version === 'string') { 66 | try { 67 | version = new SemVer(version, this.options) 68 | } catch (er) { 69 | return false 70 | } 71 | } 72 | 73 | return cmp(version, this.operator, this.semver, this.options) 74 | } 75 | 76 | intersects (comp, options) { 77 | if (!(comp instanceof Comparator)) { 78 | throw new TypeError('a Comparator is required') 79 | } 80 | 81 | if (!options || typeof options !== 'object') { 82 | options = { 83 | loose: !!options, 84 | includePrerelease: false, 85 | } 86 | } 87 | 88 | if (this.operator === '') { 89 | if (this.value === '') { 90 | return true 91 | } 92 | return new Range(comp.value, options).test(this.value) 93 | } else if (comp.operator === '') { 94 | if (comp.value === '') { 95 | return true 96 | } 97 | return new Range(this.value, options).test(comp.semver) 98 | } 99 | 100 | const sameDirectionIncreasing = 101 | (this.operator === '>=' || this.operator === '>') && 102 | (comp.operator === '>=' || comp.operator === '>') 103 | const sameDirectionDecreasing = 104 | (this.operator === '<=' || this.operator === '<') && 105 | (comp.operator === '<=' || comp.operator === '<') 106 | const sameSemVer = this.semver.version === comp.semver.version 107 | const differentDirectionsInclusive = 108 | (this.operator === '>=' || this.operator === '<=') && 109 | (comp.operator === '>=' || comp.operator === '<=') 110 | const oppositeDirectionsLessThan = 111 | cmp(this.semver, '<', comp.semver, options) && 112 | (this.operator === '>=' || this.operator === '>') && 113 | (comp.operator === '<=' || comp.operator === '<') 114 | const oppositeDirectionsGreaterThan = 115 | cmp(this.semver, '>', comp.semver, options) && 116 | (this.operator === '<=' || this.operator === '<') && 117 | (comp.operator === '>=' || comp.operator === '>') 118 | 119 | return ( 120 | sameDirectionIncreasing || 121 | sameDirectionDecreasing || 122 | (sameSemVer && differentDirectionsInclusive) || 123 | oppositeDirectionsLessThan || 124 | oppositeDirectionsGreaterThan 125 | ) 126 | } 127 | } 128 | 129 | module.exports = Comparator 130 | 131 | const parseOptions = require('../internal/parse-options') 132 | const { re, t } = require('../internal/re') 133 | const cmp = require('../functions/cmp') 134 | const debug = require('../internal/debug') 135 | const SemVer = require('./semver') 136 | const Range = require('./range') 137 | -------------------------------------------------------------------------------- /views/partials/user-header.hbs: -------------------------------------------------------------------------------- 1 |
2 | 136 | 137 |
-------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/semver/bin/semver.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Standalone semver comparison program. 3 | // Exits successfully and prints matching version(s) if 4 | // any supplied version is valid and passes all tests. 5 | 6 | const argv = process.argv.slice(2) 7 | 8 | let versions = [] 9 | 10 | const range = [] 11 | 12 | let inc = null 13 | 14 | const version = require('../package.json').version 15 | 16 | let loose = false 17 | 18 | let includePrerelease = false 19 | 20 | let coerce = false 21 | 22 | let rtl = false 23 | 24 | let identifier 25 | 26 | const semver = require('../') 27 | 28 | let reverse = false 29 | 30 | let options = {} 31 | 32 | const main = () => { 33 | if (!argv.length) { 34 | return help() 35 | } 36 | while (argv.length) { 37 | let a = argv.shift() 38 | const indexOfEqualSign = a.indexOf('=') 39 | if (indexOfEqualSign !== -1) { 40 | const value = a.slice(indexOfEqualSign + 1) 41 | a = a.slice(0, indexOfEqualSign) 42 | argv.unshift(value) 43 | } 44 | switch (a) { 45 | case '-rv': case '-rev': case '--rev': case '--reverse': 46 | reverse = true 47 | break 48 | case '-l': case '--loose': 49 | loose = true 50 | break 51 | case '-p': case '--include-prerelease': 52 | includePrerelease = true 53 | break 54 | case '-v': case '--version': 55 | versions.push(argv.shift()) 56 | break 57 | case '-i': case '--inc': case '--increment': 58 | switch (argv[0]) { 59 | case 'major': case 'minor': case 'patch': case 'prerelease': 60 | case 'premajor': case 'preminor': case 'prepatch': 61 | inc = argv.shift() 62 | break 63 | default: 64 | inc = 'patch' 65 | break 66 | } 67 | break 68 | case '--preid': 69 | identifier = argv.shift() 70 | break 71 | case '-r': case '--range': 72 | range.push(argv.shift()) 73 | break 74 | case '-c': case '--coerce': 75 | coerce = true 76 | break 77 | case '--rtl': 78 | rtl = true 79 | break 80 | case '--ltr': 81 | rtl = false 82 | break 83 | case '-h': case '--help': case '-?': 84 | return help() 85 | default: 86 | versions.push(a) 87 | break 88 | } 89 | } 90 | 91 | options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } 92 | 93 | versions = versions.map((v) => { 94 | return coerce ? (semver.coerce(v, options) || { version: v }).version : v 95 | }).filter((v) => { 96 | return semver.valid(v) 97 | }) 98 | if (!versions.length) { 99 | return fail() 100 | } 101 | if (inc && (versions.length !== 1 || range.length)) { 102 | return failInc() 103 | } 104 | 105 | for (let i = 0, l = range.length; i < l; i++) { 106 | versions = versions.filter((v) => { 107 | return semver.satisfies(v, range[i], options) 108 | }) 109 | if (!versions.length) { 110 | return fail() 111 | } 112 | } 113 | return success(versions) 114 | } 115 | 116 | const failInc = () => { 117 | console.error('--inc can only be used on a single version with no range') 118 | fail() 119 | } 120 | 121 | const fail = () => process.exit(1) 122 | 123 | const success = () => { 124 | const compare = reverse ? 'rcompare' : 'compare' 125 | versions.sort((a, b) => { 126 | return semver[compare](a, b, options) 127 | }).map((v) => { 128 | return semver.clean(v, options) 129 | }).map((v) => { 130 | return inc ? semver.inc(v, inc, options, identifier) : v 131 | }).forEach((v, i, _) => { 132 | console.log(v) 133 | }) 134 | } 135 | 136 | const help = () => console.log( 137 | `SemVer ${version} 138 | 139 | A JavaScript implementation of the https://semver.org/ specification 140 | Copyright Isaac Z. Schlueter 141 | 142 | Usage: semver [options] [ [...]] 143 | Prints valid versions sorted by SemVer precedence 144 | 145 | Options: 146 | -r --range 147 | Print versions that match the specified range. 148 | 149 | -i --increment [] 150 | Increment a version by the specified level. Level can 151 | be one of: major, minor, patch, premajor, preminor, 152 | prepatch, or prerelease. Default level is 'patch'. 153 | Only one version may be specified. 154 | 155 | --preid 156 | Identifier to be used to prefix premajor, preminor, 157 | prepatch or prerelease version increments. 158 | 159 | -l --loose 160 | Interpret versions and ranges loosely 161 | 162 | -p --include-prerelease 163 | Always include prerelease versions in range matching 164 | 165 | -c --coerce 166 | Coerce a string into SemVer if possible 167 | (does not imply --loose) 168 | 169 | --rtl 170 | Coerce version strings right to left 171 | 172 | --ltr 173 | Coerce version strings left to right (default) 174 | 175 | Program exits successfully if any valid version satisfies 176 | all supplied ranges, and prints all satisfying versions. 177 | 178 | If no satisfying versions are found, then exits failure. 179 | 180 | Versions are printed in ascending order, so supplying 181 | multiple versions to the utility will just sort them.`) 182 | 183 | main() 184 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports; 4 | 5 | const url = require('url'); 6 | const fs = require('fs'); 7 | const path = require('path'); 8 | 9 | module.exports.detect = function(opts, config) { 10 | const to = opts.hosted_path; 11 | const uri = url.parse(to); 12 | config.prefix = (!uri.pathname || uri.pathname === '/') ? '' : uri.pathname.replace('/', ''); 13 | if (opts.bucket && opts.region) { 14 | config.bucket = opts.bucket; 15 | config.region = opts.region; 16 | config.endpoint = opts.host; 17 | config.s3ForcePathStyle = opts.s3ForcePathStyle; 18 | } else { 19 | const parts = uri.hostname.split('.s3'); 20 | const bucket = parts[0]; 21 | if (!bucket) { 22 | return; 23 | } 24 | if (!config.bucket) { 25 | config.bucket = bucket; 26 | } 27 | if (!config.region) { 28 | const region = parts[1].slice(1).split('.')[0]; 29 | if (region === 'amazonaws') { 30 | config.region = 'us-east-1'; 31 | } else { 32 | config.region = region; 33 | } 34 | } 35 | } 36 | }; 37 | 38 | module.exports.get_s3 = function(config) { 39 | 40 | if (process.env.node_pre_gyp_mock_s3) { 41 | // here we're mocking. node_pre_gyp_mock_s3 is the scratch directory 42 | // for the mock code. 43 | const AWSMock = require('mock-aws-s3'); 44 | const os = require('os'); 45 | 46 | AWSMock.config.basePath = `${os.tmpdir()}/mock`; 47 | 48 | const s3 = AWSMock.S3(); 49 | 50 | // wrapped callback maker. fs calls return code of ENOENT but AWS.S3 returns 51 | // NotFound. 52 | const wcb = (fn) => (err, ...args) => { 53 | if (err && err.code === 'ENOENT') { 54 | err.code = 'NotFound'; 55 | } 56 | return fn(err, ...args); 57 | }; 58 | 59 | return { 60 | listObjects(params, callback) { 61 | return s3.listObjects(params, wcb(callback)); 62 | }, 63 | headObject(params, callback) { 64 | return s3.headObject(params, wcb(callback)); 65 | }, 66 | deleteObject(params, callback) { 67 | return s3.deleteObject(params, wcb(callback)); 68 | }, 69 | putObject(params, callback) { 70 | return s3.putObject(params, wcb(callback)); 71 | } 72 | }; 73 | } 74 | 75 | // if not mocking then setup real s3. 76 | const AWS = require('aws-sdk'); 77 | 78 | AWS.config.update(config); 79 | const s3 = new AWS.S3(); 80 | 81 | // need to change if additional options need to be specified. 82 | return { 83 | listObjects(params, callback) { 84 | return s3.listObjects(params, callback); 85 | }, 86 | headObject(params, callback) { 87 | return s3.headObject(params, callback); 88 | }, 89 | deleteObject(params, callback) { 90 | return s3.deleteObject(params, callback); 91 | }, 92 | putObject(params, callback) { 93 | return s3.putObject(params, callback); 94 | } 95 | }; 96 | 97 | 98 | 99 | }; 100 | 101 | // 102 | // function to get the mocking control function. if not mocking it returns a no-op. 103 | // 104 | // if mocking it sets up the mock http interceptors that use the mocked s3 file system 105 | // to fulfill reponses. 106 | module.exports.get_mockS3Http = function() { 107 | let mock_s3 = false; 108 | if (!process.env.node_pre_gyp_mock_s3) { 109 | return () => mock_s3; 110 | } 111 | 112 | const nock = require('nock'); 113 | // the bucket used for testing, as addressed by https. 114 | const host = 'https://mapbox-node-pre-gyp-public-testing-bucket.s3.us-east-1.amazonaws.com'; 115 | const mockDir = process.env.node_pre_gyp_mock_s3 + '/mapbox-node-pre-gyp-public-testing-bucket'; 116 | 117 | // function to setup interceptors. they are "turned off" by setting mock_s3 to false. 118 | const mock_http = () => { 119 | // eslint-disable-next-line no-unused-vars 120 | function get(uri, requestBody) { 121 | const filepath = path.join(mockDir, uri.replace('%2B', '+')); 122 | 123 | try { 124 | fs.accessSync(filepath, fs.constants.R_OK); 125 | } catch (e) { 126 | return [404, 'not found\n']; 127 | } 128 | 129 | // the mock s3 functions just write to disk, so just read from it. 130 | return [200, fs.createReadStream(filepath)]; 131 | } 132 | 133 | // eslint-disable-next-line no-unused-vars 134 | return nock(host) 135 | .persist() 136 | .get(() => mock_s3) // mock any uri for s3 when true 137 | .reply(get); 138 | }; 139 | 140 | // setup interceptors. they check the mock_s3 flag to determine whether to intercept. 141 | mock_http(nock, host, mockDir); 142 | // function to turn matching all requests to s3 on/off. 143 | const mockS3Http = (action) => { 144 | const previous = mock_s3; 145 | if (action === 'off') { 146 | mock_s3 = false; 147 | } else if (action === 'on') { 148 | mock_s3 = true; 149 | } else if (action !== 'get') { 150 | throw new Error(`illegal action for setMockHttp ${action}`); 151 | } 152 | return previous; 153 | }; 154 | 155 | // call mockS3Http with the argument 156 | // - 'on' - turn it on 157 | // - 'off' - turn it off (used by fetch.test.js so it doesn't interfere with redirects) 158 | // - 'get' - return true or false for 'on' or 'off' 159 | return mockS3Http; 160 | }; 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /helpers/product-helpers.js: -------------------------------------------------------------------------------- 1 | var db=require('../confiq/connection') 2 | var collection=require('../confiq/collection'); 3 | var bcrypt=require('bcrypt'); 4 | var objectId=require('mongodb').ObjectId 5 | 6 | var promise=require('promise'); 7 | const async = require('hbs/lib/async'); 8 | const { resolve, reject } = require('promise'); 9 | const { response } = require('express'); 10 | const userHepers = require('./user-hepers'); 11 | module.exports={ 12 | addproduct:(product,callback)=>{ 13 | console.log(product); 14 | db.get().collection('product').insertOne(product).then((data)=>{ 15 | console.log(data); 16 | callback(data.insertedId) 17 | }) 18 | 19 | }, 20 | getAllproducts:()=>{ 21 | return new Promise(async(resolve,reject)=>{ 22 | let products= await db.get().collection(collection.PRODUCT_COLLECTION).find().toArray() 23 | resolve(products) 24 | }) 25 | }, 26 | getAllcategory:()=>{ 27 | return new promise(async(resolve,reject)=>{ 28 | let category=await db.get().collection(collection.PRODUCT_CATEGORY).find().toArray() 29 | resolve(category) 30 | }) 31 | }, 32 | 33 | 34 | deleteProduct:(proid)=>{ 35 | return new promise((resolve,reject)=>{ 36 | console.log(objectId(proid)) 37 | db.get().collection(collection.PRODUCT_COLLECTION).deleteOne({_id:objectId(proid)}).then((response)=>{ 38 | console.log(response); 39 | resolve(response) 40 | }) 41 | }) 42 | }, 43 | getAllproductsDetails:(proid)=>{ 44 | return new promise((resolve,reject)=>{ 45 | db.get().collection(collection.PRODUCT_COLLECTION).findOne({_id:objectId(proid)}).then((product)=>{ 46 | resolve(product) 47 | }) 48 | }) 49 | }, 50 | 51 | 52 | updateProduct:(proid,prodetails)=>{ 53 | console.log(prodetails); 54 | return new promise((resolve,reject)=>{ 55 | db.get().collection(collection.PRODUCT_COLLECTION).updateOne({_id:objectId(proid)},{$set:{ 56 | brand:prodetails.brand, 57 | description:prodetails.description, 58 | category:prodetails.category, 59 | orginalPrice:prodetails. orginalPrice, 60 | offerPrice:prodetails.offerPrice, 61 | offerpercentage:prodetails. offerpercentage 62 | 63 | } 64 | }).then((response)=>{ 65 | resolve(response) 66 | }) 67 | 68 | }) 69 | 70 | }, 71 | 72 | addcategory:(category)=>{ 73 | 74 | return new promise((resolve,reject)=>{ 75 | db.get().collection('category').insertOne(category).then((data)=>{ 76 | resolve(data.insertedId); 77 | }) 78 | }) 79 | }, 80 | 81 | deleteCategory:(cateId)=>{ 82 | return new promise((resolve,reject)=>{ 83 | db.get().collection(collection.PRODUCT_CATEGORY).deleteOne({_id:objectId(cateId)}).then((response)=>{ 84 | console.log(response); 85 | resolve(response) 86 | 87 | }) 88 | }) 89 | }, 90 | getAllcategoryDetails:(cateId)=>{ 91 | return new promise((resolve,reject)=>{ 92 | db.get().collection(collection.PRODUCT_CATEGORY).findOne({_id:objectId(cateId)}).then((category)=>{ 93 | resolve(category) 94 | }) 95 | }) 96 | }, 97 | updateCategory:(catId,catDetails)=>{ 98 | console.log(catId); 99 | console.log(catDetails); 100 | return new promise((resolve,reject)=>{ 101 | db.get().collection(collection.PRODUCT_CATEGORY).updateOne({_id:objectId(catId)},{$set:{ 102 | brand:catDetails.brand, 103 | category:catDetails.category 104 | } 105 | }) 106 | .then((response)=>{ 107 | console.log(response); 108 | resolve(response) 109 | 110 | }) 111 | }) 112 | }, 113 | getAllUsers:()=>{ 114 | return new promise(async(resolve,reject)=>{ 115 | let users=await db.get().collection(collection.USER_COLLECTION).find().toArray() 116 | resolve(users) 117 | }) 118 | }, 119 | blockUsers:(id)=>{ 120 | console.log(id); 121 | return new promise((resolve,reject)=>{ 122 | db.get().collection(collection.USER_COLLECTION).updateOne({_id:objectId(id)},{$set:{ 123 | userBlock:true 124 | }}).then((data)=>{ 125 | resolve(data) 126 | }) 127 | }) 128 | }, 129 | unblockUser:(id)=>{ 130 | return new promise((resolve,reject)=>{ 131 | db. get().collection(collection.USER_COLLECTION).updateOne({_id:objectId(id)},{$set:{ 132 | userBlock:false 133 | 134 | }}).then((data)=>{ 135 | resolve(data) 136 | }) 137 | }) 138 | 139 | }, 140 | deleteUsers:(id)=>{ 141 | return new promise((resolve,reject)=>{ 142 | db.get().collection(collection.USER_COLLECTION).deleteOne({_id:objectId(id)}).then((response)=>{ 143 | resolve(response) 144 | }) 145 | }) 146 | } 147 | 148 | } -------------------------------------------------------------------------------- /E-project/helpers/product-helpers.js: -------------------------------------------------------------------------------- 1 | var db=require('../confiq/connection') 2 | var collection=require('../confiq/collection'); 3 | var bcrypt=require('bcrypt'); 4 | var objectId=require('mongodb').ObjectId 5 | 6 | var promise=require('promise'); 7 | const async = require('hbs/lib/async'); 8 | const { resolve, reject } = require('promise'); 9 | const { response } = require('express'); 10 | const userHepers = require('./user-hepers'); 11 | module.exports={ 12 | addproduct:(product,callback)=>{ 13 | console.log(product); 14 | db.get().collection('product').insertOne(product).then((data)=>{ 15 | console.log(data); 16 | callback(data.insertedId) 17 | }) 18 | 19 | }, 20 | getAllproducts:()=>{ 21 | return new Promise(async(resolve,reject)=>{ 22 | let products= await db.get().collection(collection.PRODUCT_COLLECTION).find().toArray() 23 | resolve(products) 24 | }) 25 | }, 26 | getAllcategory:()=>{ 27 | return new promise(async(resolve,reject)=>{ 28 | let category=await db.get().collection(collection.PRODUCT_CATEGORY).find().toArray() 29 | resolve(category) 30 | }) 31 | }, 32 | 33 | 34 | deleteProduct:(proid)=>{ 35 | return new promise((resolve,reject)=>{ 36 | console.log(objectId(proid)) 37 | db.get().collection(collection.PRODUCT_COLLECTION).deleteOne({_id:objectId(proid)}).then((response)=>{ 38 | console.log(response); 39 | resolve(response) 40 | }) 41 | }) 42 | }, 43 | getAllproductsDetails:(proid)=>{ 44 | return new promise((resolve,reject)=>{ 45 | db.get().collection(collection.PRODUCT_COLLECTION).findOne({_id:objectId(proid)}).then((product)=>{ 46 | resolve(product) 47 | }) 48 | }) 49 | }, 50 | 51 | 52 | updateProduct:(proid,prodetails)=>{ 53 | console.log(prodetails); 54 | return new promise((resolve,reject)=>{ 55 | db.get().collection(collection.PRODUCT_COLLECTION).updateOne({_id:objectId(proid)},{$set:{ 56 | brand:prodetails.brand, 57 | description:prodetails.description, 58 | category:prodetails.category, 59 | orginalPrice:prodetails. orginalPrice, 60 | offerPrice:prodetails.offerPrice, 61 | offerpercentage:prodetails. offerpercentage 62 | 63 | } 64 | }).then((response)=>{ 65 | resolve(response) 66 | }) 67 | 68 | }) 69 | 70 | }, 71 | 72 | addcategory:(category)=>{ 73 | 74 | return new promise((resolve,reject)=>{ 75 | db.get().collection('category').insertOne(category).then((data)=>{ 76 | resolve(data.insertedId); 77 | }) 78 | }) 79 | }, 80 | 81 | deleteCategory:(cateId)=>{ 82 | return new promise((resolve,reject)=>{ 83 | db.get().collection(collection.PRODUCT_CATEGORY).deleteOne({_id:objectId(cateId)}).then((response)=>{ 84 | console.log(response); 85 | resolve(response) 86 | 87 | }) 88 | }) 89 | }, 90 | getAllcategoryDetails:(cateId)=>{ 91 | return new promise((resolve,reject)=>{ 92 | db.get().collection(collection.PRODUCT_CATEGORY).findOne({_id:objectId(cateId)}).then((category)=>{ 93 | resolve(category) 94 | }) 95 | }) 96 | }, 97 | updateCategory:(catId,catDetails)=>{ 98 | console.log(catId); 99 | console.log(catDetails); 100 | return new promise((resolve,reject)=>{ 101 | db.get().collection(collection.PRODUCT_CATEGORY).updateOne({_id:objectId(catId)},{$set:{ 102 | brand:catDetails.brand, 103 | category:catDetails.category 104 | } 105 | }) 106 | .then((response)=>{ 107 | console.log(response); 108 | resolve(response) 109 | 110 | }) 111 | }) 112 | }, 113 | getAllUsers:()=>{ 114 | return new promise(async(resolve,reject)=>{ 115 | let users=await db.get().collection(collection.USER_COLLECTION).find().toArray() 116 | resolve(users) 117 | }) 118 | }, 119 | blockUsers:(id)=>{ 120 | console.log(id); 121 | return new promise((resolve,reject)=>{ 122 | db.get().collection(collection.USER_COLLECTION).updateOne({_id:objectId(id)},{$set:{ 123 | userBlock:true 124 | }}).then((data)=>{ 125 | resolve(data) 126 | }) 127 | }) 128 | }, 129 | unblockUser:(id)=>{ 130 | return new promise((resolve,reject)=>{ 131 | db. get().collection(collection.USER_COLLECTION).updateOne({_id:objectId(id)},{$set:{ 132 | userBlock:false 133 | 134 | }}).then((data)=>{ 135 | resolve(data) 136 | }) 137 | }) 138 | 139 | }, 140 | deleteUsers:(id)=>{ 141 | return new promise((resolve,reject)=>{ 142 | db.get().collection(collection.USER_COLLECTION).deleteOne({_id:objectId(id)}).then((response)=>{ 143 | resolve(response) 144 | }) 145 | }) 146 | } 147 | 148 | } -------------------------------------------------------------------------------- /routes/admin.js: -------------------------------------------------------------------------------- 1 | const { response } = require('express'); 2 | var express = require('express'); 3 | const async = require('hbs/lib/async'); 4 | 5 | const productHelpers = require('../helpers/product-helpers'); 6 | var router = express.Router(); 7 | var productHelper=require('../helpers/product-helpers') 8 | 9 | /* GET users listing. */ 10 | 11 | const cridential={ 12 | email:"asifsaheer7034@gmail.com", 13 | password:1234 14 | } 15 | 16 | 17 | 18 | const verifylogin=(req,res,next)=>{ 19 | if(req.session.admin){ 20 | next() 21 | }else{ 22 | res.render('admin/admin-login',{login:false,admin:true}) 23 | } 24 | } 25 | 26 | router.post('/admin-login',(req,res)=>{ 27 | if(req.body.email==cridential.email && req.body.password==cridential.password){ 28 | 29 | req.session.admin=true 30 | 31 | res.redirect('/admin') 32 | }else{ 33 | res.render('admin/admin-login',{loginadminErr:true}) 34 | } 35 | loginadminErr=false 36 | 37 | }) 38 | 39 | router.get('/admin-logout',verifylogin,(req,res)=>{ 40 | req.session.admin=false 41 | res.redirect('/admin') 42 | }) 43 | 44 | 45 | router.get('/',verifylogin,function(req, res, next) { 46 | 47 | res.render('admin/admin-home',{home:true}) 48 | 49 | }); 50 | router.get('/products',verifylogin,(req,res)=>{ 51 | productHelpers.getAllproducts().then((products)=>{ 52 | res.render('admin/view-products',{products,admin:true}) 53 | }) 54 | }) 55 | router.get('/add-product',verifylogin,(req,res)=>{ 56 | res.render('admin/add-product',{admin:true}) 57 | }) 58 | router.post('/add-product',(req,res)=>{ 59 | productHelper.addproduct(req.body,(id)=>{ 60 | let image=req.files.image 61 | image.mv('./public/product-images/'+id+'.jpg',(err,done)=>{ 62 | if(!err){ 63 | res.render("admin/add-product",{admin:true}) 64 | }else{ 65 | console.log(err); 66 | } 67 | }) 68 | res.render("admin/add-product") 69 | }) 70 | 71 | }) 72 | 73 | 74 | 75 | router.get('/edit-product/:id',verifylogin,async(req,res)=>{ 76 | let product=await productHelper.getAllproductsDetails(req.params.id) 77 | console.log(product); 78 | res.render('admin/edit-product',{product,admin:true}) 79 | }) 80 | router.post('/edit-product/:id',(req,res)=>{ 81 | productHelpers.updateProduct(req.params.id,req.body).then(()=>{ 82 | let id=req.params.id 83 | res.redirect('/admin/') 84 | if(req.files.image){ 85 | let image=req.files.image 86 | image.mv('./public/product-images/'+id+'.jpg',(err,done)=>{ 87 | 88 | }) 89 | 90 | } 91 | }) 92 | }) 93 | router.get('/delete-product/:id',verifylogin,(req,res)=>{ 94 | let proId=req.params.id 95 | console.log(proId); 96 | 97 | productHelpers.deleteProduct(proId).then((response)=>{ 98 | res.redirect('/admin') 99 | }) 100 | 101 | }) 102 | router.get('/view-category',verifylogin,(req,res)=>{ 103 | 104 | productHelper.getAllcategory().then((category)=>{ 105 | console.log(category); 106 | res.render('admin/view-category',{category,admin:true}) 107 | }) 108 | 109 | 110 | }) 111 | router.get('/add-category',verifylogin,(req,res)=>{ 112 | res.render('admin/add-category',{admin:true}) 113 | 114 | }) 115 | router.post('/add-category',(req,res)=>{ 116 | productHelper.addcategory(req.body).then((id)=>{ 117 | let categoryImage=req.files.image 118 | categoryImage.mv('./public/category-image/'+id+'.jpg',(err,done)=>{ 119 | if(err){ 120 | console.log(err); 121 | }else{ 122 | res.render('admin/add-category',{admin:true}) 123 | } 124 | }) 125 | res.render('admin/add-category') 126 | 127 | }) 128 | 129 | }) 130 | router.get('/delete-category/:id',verifylogin,(req,res)=>{ 131 | let cateId=req.params.id 132 | console.log(cateId); 133 | productHelper.deleteCategory(cateId).then((response)=>{ 134 | res.redirect('/admin/view-category') 135 | }) 136 | 137 | }) 138 | 139 | router.get('/edit-category/:id',verifylogin,async(req,res)=>{ 140 | let category= await productHelper.getAllcategoryDetails(req.params.id) 141 | res.render('admin/edit-category',{category,admin:true}) 142 | }) 143 | 144 | router.post('/edit-category/:id',(req,res)=>{ 145 | productHelper.updateCategory(req.params.id,req.body).then((response)=>{ 146 | console.log(response); 147 | let id=req.params.id 148 | let images=req.files.image 149 | if(req.files.image){ 150 | images.mv('./public/category-image/'+id+'.jpg',(err,done)=>{ 151 | }) 152 | } 153 | res.redirect('/admin/view-category') 154 | 155 | }) 156 | 157 | }) 158 | router.get('/all-users',(req,res)=>{ 159 | productHelper.getAllUsers().then((users)=>{ 160 | res.render('admin/all-users',{users,admin:true}) 161 | }) 162 | 163 | }) 164 | 165 | //admin 166 | 167 | router.get('/block-user/:id',(req,res)=>{ 168 | let id= req.params.id 169 | console.log(id); 170 | req.session.destroy() 171 | productHelpers.blockUsers(id).then((resp)=>{ 172 | if(resp){ 173 | res.redirect('/admin/all-users') 174 | }else{ 175 | console.log('failed'); 176 | } 177 | }) 178 | }) 179 | router.get('/unblock-user/:id',(req,res)=>{ 180 | const id=req.params.id 181 | productHelper.unblockUser(id).then((resp)=>{ 182 | if(resp){ 183 | res.redirect('/admin/all-users') 184 | console.log(resp); 185 | }else{ 186 | console.log("failed"); 187 | } 188 | }) 189 | }) 190 | router.get('/delete-users/:id',(req,res)=>{ 191 | let id=req.params.id 192 | productHelper.deleteUsers(id).then((response)=>{ 193 | res.redirect('/admin/all-users') 194 | }) 195 | 196 | }) 197 | 198 | 199 | module.exports = router; 200 | -------------------------------------------------------------------------------- /views/user/orders.hbs: -------------------------------------------------------------------------------- 1 | 2 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
Thanks for your Order, {{user.name}}!
21 |
22 |
23 |
24 |

Receipt

25 | {{#each orders}} 26 |
27 |
28 |
29 |
30 | 31 |
32 |

Address:
{{this.deliveryDetails.address}}, 33 | {{this.deliveryDetails.state}}
34 | {{this.deliveryDetails.city}}, 35 | {{this.deliveryDetails.pincode}}
36 | {{this.deliveryDetails.mobile}}
37 | 38 | 39 | 40 | 41 |

42 |
43 |
44 |

White

45 |
46 |
47 |

{{this.Date}}

48 |
49 |
50 |

Status: {{this.status}}

51 |
52 |
53 |

Payment:{{this.paymentMethode}}

54 |
55 | 56 |
57 |

₹{{this.totalAmount}}

58 |
59 | 60 | 61 |
62 | view product 63 |
64 |
65 | {{/each}} 66 |
67 |
68 |
69 |

Track Order

70 |
71 |
72 |
73 |
76 |
77 |
78 |

Out for delivary

79 |

Delivered

80 |
81 |
82 |
83 |
84 |
85 | 86 |
87 |

Order Details

88 |

Total $898.00

89 |
90 | 91 |
92 |

Invoice Number : 788152

93 |

Discount $19.00

94 |
95 | 96 |
97 |

Invoice Date : 22 Dec,2019

98 |

GST 18% 123

99 |
100 | 101 |
102 |

Recepits Voucher : 18KU-62IIK

103 |

Delivery Charges Free

104 |
105 | 106 |
107 | 108 |
109 |
110 |
111 |
112 |
-------------------------------------------------------------------------------- /views/user/Add-address.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
ADD ADDRESS
8 |
9 |
10 | 11 | 12 |
13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |
22 | 23 | 24 |
25 |
26 |
27 | 28 | 29 |
30 |
31 |
32 | 33 | 34 |
35 |
36 | 37 | 38 |
39 |
40 | 41 | 42 |
43 |
44 |
45 | 46 | 47 |
48 |
49 |
50 | 51 | 52 |
53 |
54 | 55 |
56 |
57 | 58 | 59 |
60 |
61 |
62 | 63 | 64 |
65 | 66 | 67 |
68 | 69 | 70 | 71 |
72 |
73 |
74 | 75 |
76 |
77 |
78 |
Amount
79 |
80 |
81 |
    82 |
  • 83 | Products items: 84 | $53.98 85 |
  • 86 |
  • 87 | Shipping 88 | free 89 |
  • 90 |
  • 91 | Delivery charge 92 | free 93 |
  • 94 |
  • 95 |
    96 | Total amount 97 | 98 |

    (including GST)

    99 |
    100 |
    101 | ${{total}} 102 |
  • 103 |
104 | 105 | 106 |
107 | 108 | 109 |
110 |
Payment Method
111 |
112 |
113 | 114 |
115 | Cash On Delivery 116 | 117 |
118 | 119 |
120 | Online Pyment 121 | 122 |
123 | 124 | 127 |
128 | 129 |
130 |
131 |
132 |
133 |
134 | -------------------------------------------------------------------------------- /views/user/signup.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 | 8 | 9 |
10 |
11 | 12 | 13 |

Create New Account?

14 |

15 |

Please enter your Details!

16 | 17 |

{{#if phoneAll}}Phone Number Already Exist {{/if}}{{#if email}}Email Already Exist{{/if}}

18 | 19 | 20 | 21 |
22 | 23 |

24 | 25 |
26 | 27 |
28 | 29 |

30 |
31 | 32 | 33 |
34 | 35 |

36 |
37 | 38 | 39 |
40 | 41 |

42 |
43 | 44 | 45 |
46 | 47 |

48 |
49 | 50 |

Forgot password?

51 | 52 | 53 | 54 |
55 | 56 | 57 | 58 |
59 | 60 |
61 | 62 |
63 |

yoou have an account? Login 64 |

65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | 74 | 75 | -------------------------------------------------------------------------------- /views/user/cart.hbs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
Cart - {{cartCount}} items
8 |
9 |
10 | 11 |
12 | {{#each products}} 13 | 14 |
15 | 16 |
17 | Blue Jeans Jacket 19 | 20 |
21 |
22 |
23 | 24 |
25 | 26 |
27 | 28 |

{{this.product.description}}

29 |

Color: blue

30 |

Size: M

31 | 35 | 39 | 40 |
41 | 42 | 43 |
44 | 45 |
46 | 47 | {{this.quantity}} 48 | 49 | {{!-- + 50 |
51 | 52 | 53 |
--}} 54 | {{!-- - --}} 55 | 56 |
57 | 58 | 59 | 60 | 61 |

62 | ${{this.product.offerPrice}} 63 |

64 | 65 | 66 | 67 |
68 | {{/each}} 69 |
70 | 71 | 72 |
73 |
74 |
75 |
76 |

Expected shipping delivery

77 |

12.10.2020 - 14.10.2020

78 |
79 |
80 |
81 |
82 |

We accept

83 | Visa 86 | American Express 89 | Mastercard 92 | PayPal acceptance mark 95 |
96 |
97 |
98 |
99 |
100 |
101 |
Summary
102 |
103 |
104 |
    105 |
  • 107 | Products 108 | $53.98 109 |
  • 110 |
  • 111 | Shipping 112 | Gratis 113 |
  • 114 |
  • 116 |
    117 | Total amount 118 | 119 |

    (including VAT)

    120 |
    121 |
    122 | ${{totalValue}} 123 |
  • 124 |
125 | 126 | 129 |
130 |
131 |
132 |
133 |
134 |
135 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/node_modules/nopt/README.md: -------------------------------------------------------------------------------- 1 | If you want to write an option parser, and have it be good, there are 2 | two ways to do it. The Right Way, and the Wrong Way. 3 | 4 | The Wrong Way is to sit down and write an option parser. We've all done 5 | that. 6 | 7 | The Right Way is to write some complex configurable program with so many 8 | options that you hit the limit of your frustration just trying to 9 | manage them all, and defer it with duct-tape solutions until you see 10 | exactly to the core of the problem, and finally snap and write an 11 | awesome option parser. 12 | 13 | If you want to write an option parser, don't write an option parser. 14 | Write a package manager, or a source control system, or a service 15 | restarter, or an operating system. You probably won't end up with a 16 | good one of those, but if you don't give up, and you are relentless and 17 | diligent enough in your procrastination, you may just end up with a very 18 | nice option parser. 19 | 20 | ## USAGE 21 | 22 | ```javascript 23 | // my-program.js 24 | var nopt = require("nopt") 25 | , Stream = require("stream").Stream 26 | , path = require("path") 27 | , knownOpts = { "foo" : [String, null] 28 | , "bar" : [Stream, Number] 29 | , "baz" : path 30 | , "bloo" : [ "big", "medium", "small" ] 31 | , "flag" : Boolean 32 | , "pick" : Boolean 33 | , "many1" : [String, Array] 34 | , "many2" : [path, Array] 35 | } 36 | , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] 37 | , "b7" : ["--bar", "7"] 38 | , "m" : ["--bloo", "medium"] 39 | , "p" : ["--pick"] 40 | , "f" : ["--flag"] 41 | } 42 | // everything is optional. 43 | // knownOpts and shorthands default to {} 44 | // arg list defaults to process.argv 45 | // slice defaults to 2 46 | , parsed = nopt(knownOpts, shortHands, process.argv, 2) 47 | console.log(parsed) 48 | ``` 49 | 50 | This would give you support for any of the following: 51 | 52 | ```console 53 | $ node my-program.js --foo "blerp" --no-flag 54 | { "foo" : "blerp", "flag" : false } 55 | 56 | $ node my-program.js ---bar 7 --foo "Mr. Hand" --flag 57 | { bar: 7, foo: "Mr. Hand", flag: true } 58 | 59 | $ node my-program.js --foo "blerp" -f -----p 60 | { foo: "blerp", flag: true, pick: true } 61 | 62 | $ node my-program.js -fp --foofoo 63 | { foo: "Mr. Foo", flag: true, pick: true } 64 | 65 | $ node my-program.js --foofoo -- -fp # -- stops the flag parsing. 66 | { foo: "Mr. Foo", argv: { remain: ["-fp"] } } 67 | 68 | $ node my-program.js --blatzk -fp # unknown opts are ok. 69 | { blatzk: true, flag: true, pick: true } 70 | 71 | $ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value 72 | { blatzk: 1000, flag: true, pick: true } 73 | 74 | $ node my-program.js --no-blatzk -fp # unless they start with "no-" 75 | { blatzk: false, flag: true, pick: true } 76 | 77 | $ node my-program.js --baz b/a/z # known paths are resolved. 78 | { baz: "/Users/isaacs/b/a/z" } 79 | 80 | # if Array is one of the types, then it can take many 81 | # values, and will always be an array. The other types provided 82 | # specify what types are allowed in the list. 83 | 84 | $ node my-program.js --many1 5 --many1 null --many1 foo 85 | { many1: ["5", "null", "foo"] } 86 | 87 | $ node my-program.js --many2 foo --many2 bar 88 | { many2: ["/path/to/foo", "path/to/bar"] } 89 | ``` 90 | 91 | Read the tests at the bottom of `lib/nopt.js` for more examples of 92 | what this puppy can do. 93 | 94 | ## Types 95 | 96 | The following types are supported, and defined on `nopt.typeDefs` 97 | 98 | * String: A normal string. No parsing is done. 99 | * path: A file system path. Gets resolved against cwd if not absolute. 100 | * url: A url. If it doesn't parse, it isn't accepted. 101 | * Number: Must be numeric. 102 | * Date: Must parse as a date. If it does, and `Date` is one of the options, 103 | then it will return a Date object, not a string. 104 | * Boolean: Must be either `true` or `false`. If an option is a boolean, 105 | then it does not need a value, and its presence will imply `true` as 106 | the value. To negate boolean flags, do `--no-whatever` or `--whatever 107 | false` 108 | * NaN: Means that the option is strictly not allowed. Any value will 109 | fail. 110 | * Stream: An object matching the "Stream" class in node. Valuable 111 | for use when validating programmatically. (npm uses this to let you 112 | supply any WriteStream on the `outfd` and `logfd` config options.) 113 | * Array: If `Array` is specified as one of the types, then the value 114 | will be parsed as a list of options. This means that multiple values 115 | can be specified, and that the value will always be an array. 116 | 117 | If a type is an array of values not on this list, then those are 118 | considered valid values. For instance, in the example above, the 119 | `--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`, 120 | and any other value will be rejected. 121 | 122 | When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be 123 | interpreted as their JavaScript equivalents. 124 | 125 | You can also mix types and values, or multiple types, in a list. For 126 | instance `{ blah: [Number, null] }` would allow a value to be set to 127 | either a Number or null. When types are ordered, this implies a 128 | preference, and the first type that can be used to properly interpret 129 | the value will be used. 130 | 131 | To define a new type, add it to `nopt.typeDefs`. Each item in that 132 | hash is an object with a `type` member and a `validate` method. The 133 | `type` member is an object that matches what goes in the type list. The 134 | `validate` method is a function that gets called with `validate(data, 135 | key, val)`. Validate methods should assign `data[key]` to the valid 136 | value of `val` if it can be handled properly, or return boolean 137 | `false` if it cannot. 138 | 139 | You can also call `nopt.clean(data, types, typeDefs)` to clean up a 140 | config object and remove its invalid properties. 141 | 142 | ## Error Handling 143 | 144 | By default, nopt outputs a warning to standard error when invalid values for 145 | known options are found. You can change this behavior by assigning a method 146 | to `nopt.invalidHandler`. This method will be called with 147 | the offending `nopt.invalidHandler(key, val, types)`. 148 | 149 | If no `nopt.invalidHandler` is assigned, then it will console.error 150 | its whining. If it is assigned to boolean `false` then the warning is 151 | suppressed. 152 | 153 | ## Abbreviations 154 | 155 | Yes, they are supported. If you define options like this: 156 | 157 | ```javascript 158 | { "foolhardyelephants" : Boolean 159 | , "pileofmonkeys" : Boolean } 160 | ``` 161 | 162 | Then this will work: 163 | 164 | ```bash 165 | node program.js --foolhar --pil 166 | node program.js --no-f --pileofmon 167 | # etc. 168 | ``` 169 | 170 | ## Shorthands 171 | 172 | Shorthands are a hash of shorter option names to a snippet of args that 173 | they expand to. 174 | 175 | If multiple one-character shorthands are all combined, and the 176 | combination does not unambiguously match any other option or shorthand, 177 | then they will be broken up into their constituent parts. For example: 178 | 179 | ```json 180 | { "s" : ["--loglevel", "silent"] 181 | , "g" : "--global" 182 | , "f" : "--force" 183 | , "p" : "--parseable" 184 | , "l" : "--long" 185 | } 186 | ``` 187 | 188 | ```bash 189 | npm ls -sgflp 190 | # just like doing this: 191 | npm ls --loglevel silent --global --force --long --parseable 192 | ``` 193 | 194 | ## The Rest of the args 195 | 196 | The config object returned by nopt is given a special member called 197 | `argv`, which is an object with the following fields: 198 | 199 | * `remain`: The remaining args after all the parsing has occurred. 200 | * `original`: The args as they originally appeared. 201 | * `cooked`: The args after flags and shorthands are expanded. 202 | 203 | ## Slicing 204 | 205 | Node programs are called with more or less the exact argv as it appears 206 | in C land, after the v8 and node-specific options have been plucked off. 207 | As such, `argv[0]` is always `node` and `argv[1]` is always the 208 | JavaScript program being run. 209 | 210 | That's usually not very useful to you. So they're sliced off by 211 | default. If you want them, then you can pass in `0` as the last 212 | argument, or any other number that you'd like to slice off the start of 213 | the list. 214 | -------------------------------------------------------------------------------- /routes/user.js: -------------------------------------------------------------------------------- 1 | const { response } = require("express"); 2 | var express = require("express"); 3 | const async = require("hbs/lib/async"); 4 | const { Db } = require("mongodb"); 5 | var router = express.Router(); 6 | const productHelpers = require("../helpers/product-helpers"); 7 | const userHelpers = require("../helpers/user-hepers"); 8 | 9 | const serviceSsid = "VA98b9df7b42468c8f8da13751cdc6a0a0"; 10 | const AccountSsid = "AC2728becad37498ecfe6a709051743861"; 11 | const token = "247ea5b054004a7619abcf06fe7f649f"; 12 | const client = require("twilio")(AccountSsid, token); 13 | 14 | const verifylogin = (req, res, next) => { 15 | if (req.session.user) { 16 | next(); 17 | } else { 18 | res.redirect("/login"); 19 | } 20 | }; 21 | 22 | /* GET home page. */ 23 | router.get("/", async function (req, res, next) { 24 | let user = req.session.user; 25 | console.log(user?.user?.name); 26 | cartCount=null 27 | if (req.session.user) { 28 | var cartCount=await userHelpers.getCarCount(req.session.user._id) 29 | } 30 | 31 | productHelpers.getAllproducts().then((products) => { 32 | productHelpers.getAllcategory().then((category) => { 33 | res.render("user/view-products", { products, user, category ,cartCount}); 34 | }); 35 | }); 36 | }); 37 | router.get("/login", (req, res) => { 38 | if (req.session.loggedIn) { 39 | res.redirect("/"); 40 | } else { 41 | res.render("user/login", { loginErr: req.session.loginErr }); 42 | req.session.loginErr = false; 43 | } 44 | }); 45 | router.get("/signup", (req, res) => { 46 | res.render("user/signup"); 47 | }); 48 | 49 | router.post("/signup", (req, res) => { 50 | let email = req.body.email; 51 | let phone = req.body.phoneNumber; 52 | console.log(email); 53 | console.log(phone); 54 | userHelpers.emailCheck(email, phone).then((resolve) => { 55 | if (resolve) { 56 | if (resolve.phoneNumber == phone) { 57 | res.render("user/signup", { phone: true, phoneAll: "phone invaid" }); 58 | phoneAll = false; 59 | } else { 60 | res.render("user/signup", { email: true }); 61 | email = false; 62 | } 63 | } else { 64 | userHelpers.doSignup(req.body).then((response) => { 65 | console.log(response); 66 | res.redirect("/login"); 67 | }); 68 | } 69 | }); 70 | }); 71 | 72 | router.post("/login", (req, res) => { 73 | userHelpers.doLogin(req.body).then((response) => { 74 | console.log(response.userBlock); 75 | if (response.userBlock) { 76 | res.render("user/login", { userBlock: true }); 77 | } else { 78 | if (response.status) { 79 | req.session.loggedIn = true; 80 | req.session.user = response.user; 81 | console.log(req.session.user._id); 82 | res.redirect("/"); 83 | } else { 84 | req.session.loginErr = true; 85 | res.redirect("/login"); 86 | } 87 | } 88 | }); 89 | }); 90 | router.get("/logout", (req, res) => { 91 | req.session.destroy(); 92 | res.redirect("/"); 93 | }); 94 | 95 | 96 | //cart routes 97 | router.get("/cart", verifylogin, async (req, res) => { 98 | let products=await userHelpers.getCartProducts(req.session.user._id) 99 | let totalValue=await userHelpers.getTotalAmount(req.session.user._id) 100 | 101 | cartCount=null 102 | if (req.session.user) { 103 | var cartCount=await userHelpers.getCarCount(req.session.user._id) 104 | } 105 | 106 | res.render("user/cart",{products,'user':req.session.user,cartCount,totalValue}); 107 | }); 108 | router.get('/add-to-cart/:id',(req,res)=>{ 109 | console.log(req.params.id); 110 | console.log("hi"); 111 | console.log(req.session.user._id); 112 | 113 | userHelpers.addToCart(req.params.id,req.session.user._id).then(()=>{ 114 | res.json({status:true}) 115 | 116 | }) 117 | 118 | 119 | }) 120 | 121 | 122 | 123 | 124 | 125 | 126 | router.get("/view-image/:id", async (req, res) => { 127 | var imgId = req.params.id; 128 | let product = await userHelpers.imageDetails(imgId); 129 | res.render("user/view-image", { product }); 130 | }); 131 | 132 | //otp verfication 133 | 134 | router.get("/verify-phone", (req, res) => { 135 | res.render("user/verify-phone"); 136 | }); 137 | router.post("/verify-phone", (req, res) => { 138 | let phone = req.body.phoneVerify; 139 | userHelpers.checkPhone(phone).then((number) => { 140 | // console.log(number); 141 | // console.log(number.userBlock) 142 | 143 | if (number) { 144 | if (number.userBlock) { 145 | res.render("user/verify-phone", { userBlock: true }); 146 | } else { 147 | if (number) { 148 | let phone = number.phoneNumber; 149 | console.log(phone); 150 | client.verify 151 | .services(serviceSsid) 152 | .verifications.create({ to: `+91${phone}`, channel: "sms" }) 153 | .then((resp) => { 154 | console.log(resp); 155 | }); 156 | res.render("user/verify-otp", { phone }); 157 | } else { 158 | res.render("user/verify-phone", { number: true }); 159 | number = false; 160 | } 161 | } 162 | } else { 163 | res.render("user/verify-phone", { number: true }); 164 | number = false; 165 | } 166 | }); 167 | }); 168 | 169 | router.post("/verify-otp/:phone", (req, res) => { 170 | let phone = req.params.phone; 171 | let otp = req.body.phoneVerify; 172 | console.log(phone); 173 | 174 | client.verify 175 | .services(serviceSsid) 176 | .verificationChecks.create({ 177 | to: `+91${phone}`, 178 | code: otp, 179 | }) 180 | .then((resp) => { 181 | console.log("otp res", resp); 182 | const user = resp.valid; 183 | 184 | if (user) { 185 | userHelpers.doLoginOtp(phone).then((response) => { 186 | if (response) { 187 | console.log(response.name); 188 | req.session.loggedIn = true; 189 | req.session.user = response; 190 | res.redirect("/"); 191 | } else { 192 | req.session.loginErr = true; 193 | res.redirect("/login"); 194 | } 195 | }); 196 | console.log("success"); 197 | req.session.loggedIn = true; 198 | req.session.user = response.user; 199 | } else { 200 | console.log("failed"); 201 | 202 | res.render("user/verify-otp", { phone, number: true }); 203 | number = false; 204 | } 205 | }); 206 | }); 207 | 208 | router.get('/resent-otp/:phone',(req,res)=>{ 209 | let phone=req.params.phone 210 | console.log("my"+phone); 211 | client.verify 212 | .services(serviceSsid) 213 | .verifications.create({ to: `+91${phone}`, channel: "sms" }) 214 | .then((resp) => { 215 | console.log(resp); 216 | }); 217 | res.render("user/verify-otp",{phone}); 218 | 219 | 220 | 221 | }) 222 | 223 | //category view 224 | router.get('/category-view/:id',(req,res)=>{ 225 | let category=req.params.id 226 | userHelpers. categoryView(category).then((products)=>{ 227 | console.log(products); 228 | res.render('user/view-category',{products}) 229 | }) 230 | 231 | }) 232 | 233 | // quantity 234 | router.post('/change-product-quantity',(req,res,next)=>{ 235 | console.log(req.body); 236 | console.log("PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP"); 237 | userHelpers.changeProductQuantity(req.body).then(async(response)=>{ 238 | 239 | console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>"); 240 | response.total=await userHelpers.getTotalAmount(req.body.user) 241 | 242 | res.json(response) 243 | }) 244 | }) 245 | router.post('/remove-product-cart',(req,res)=>{ 246 | userHelpers.removeCartProduct(req.body).then((response)=>{ 247 | res.json(response) 248 | }) 249 | }) 250 | 251 | 252 | 253 | 254 | //product orders 255 | 256 | router.get('/place-order',verifylogin,async(req,res)=>{ 257 | let total=await userHelpers.getTotalAmount(req.session.user._id) 258 | 259 | res.render('user/Add-address',{total,user:req.session.user}) 260 | }) 261 | router.post('/place-order',async(req,res)=>{ 262 | let products=await userHelpers.getCartProductList(req.body.userId) 263 | let totalPrice=await userHelpers.getTotalAmount(req.body.userId) 264 | 265 | userHelpers.placeOrder(req.body,products,totalPrice).then((response)=>{ 266 | res.json({status:true}) 267 | 268 | }) 269 | 270 | router.get('/order-success',(req,res)=>{ 271 | res.render('user/order-success',{user:req.session.user}) 272 | }) 273 | console.log(req.body); 274 | }) 275 | 276 | 277 | router.get('/orders',async(req,res)=>{ 278 | console.log(req.session.user?._id); 279 | let orders=await userHelpers.getUserOrders(req.session.user?._id) 280 | res.render('user/orders',{user:req.session.user,orders}) 281 | }) 282 | 283 | module.exports = router; 284 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/install.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = exports = install; 4 | 5 | exports.usage = 'Attempts to install pre-built binary for module'; 6 | 7 | const fs = require('fs'); 8 | const path = require('path'); 9 | const log = require('npmlog'); 10 | const existsAsync = fs.exists || path.exists; 11 | const versioning = require('./util/versioning.js'); 12 | const napi = require('./util/napi.js'); 13 | const makeDir = require('make-dir'); 14 | // for fetching binaries 15 | const fetch = require('node-fetch'); 16 | const tar = require('tar'); 17 | 18 | let npgVersion = 'unknown'; 19 | try { 20 | // Read own package.json to get the current node-pre-pyp version. 21 | const ownPackageJSON = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'); 22 | npgVersion = JSON.parse(ownPackageJSON).version; 23 | } catch (e) { 24 | // do nothing 25 | } 26 | 27 | function place_binary(uri, targetDir, opts, callback) { 28 | log.http('GET', uri); 29 | 30 | // Try getting version info from the currently running npm. 31 | const envVersionInfo = process.env.npm_config_user_agent || 32 | 'node ' + process.version; 33 | 34 | const sanitized = uri.replace('+', '%2B'); 35 | const requestOpts = { 36 | uri: sanitized, 37 | headers: { 38 | 'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')' 39 | }, 40 | follow_max: 10 41 | }; 42 | 43 | if (opts.cafile) { 44 | try { 45 | requestOpts.ca = fs.readFileSync(opts.cafile); 46 | } catch (e) { 47 | return callback(e); 48 | } 49 | } else if (opts.ca) { 50 | requestOpts.ca = opts.ca; 51 | } 52 | 53 | const proxyUrl = opts.proxy || 54 | process.env.http_proxy || 55 | process.env.HTTP_PROXY || 56 | process.env.npm_config_proxy; 57 | let agent; 58 | if (proxyUrl) { 59 | const ProxyAgent = require('https-proxy-agent'); 60 | agent = new ProxyAgent(proxyUrl); 61 | log.http('download', 'proxy agent configured using: "%s"', proxyUrl); 62 | } 63 | 64 | fetch(sanitized, { agent }) 65 | .then((res) => { 66 | if (!res.ok) { 67 | throw new Error(`response status ${res.status} ${res.statusText} on ${sanitized}`); 68 | } 69 | const dataStream = res.body; 70 | 71 | return new Promise((resolve, reject) => { 72 | let extractions = 0; 73 | const countExtractions = (entry) => { 74 | extractions += 1; 75 | log.info('install', 'unpacking %s', entry.path); 76 | }; 77 | 78 | dataStream.pipe(extract(targetDir, countExtractions)) 79 | .on('error', (e) => { 80 | reject(e); 81 | }); 82 | dataStream.on('end', () => { 83 | resolve(`extracted file count: ${extractions}`); 84 | }); 85 | dataStream.on('error', (e) => { 86 | reject(e); 87 | }); 88 | }); 89 | }) 90 | .then((text) => { 91 | log.info(text); 92 | callback(); 93 | }) 94 | .catch((e) => { 95 | log.error(`install ${e.message}`); 96 | callback(e); 97 | }); 98 | } 99 | 100 | function extract(to, onentry) { 101 | return tar.extract({ 102 | cwd: to, 103 | strip: 1, 104 | onentry 105 | }); 106 | } 107 | 108 | function extract_from_local(from, targetDir, callback) { 109 | if (!fs.existsSync(from)) { 110 | return callback(new Error('Cannot find file ' + from)); 111 | } 112 | log.info('Found local file to extract from ' + from); 113 | 114 | // extract helpers 115 | let extractCount = 0; 116 | function countExtractions(entry) { 117 | extractCount += 1; 118 | log.info('install', 'unpacking ' + entry.path); 119 | } 120 | function afterExtract(err) { 121 | if (err) return callback(err); 122 | if (extractCount === 0) { 123 | return callback(new Error('There was a fatal problem while extracting the tarball')); 124 | } 125 | log.info('tarball', 'done parsing tarball'); 126 | callback(); 127 | } 128 | 129 | fs.createReadStream(from).pipe(extract(targetDir, countExtractions)) 130 | .on('close', afterExtract) 131 | .on('error', afterExtract); 132 | } 133 | 134 | function do_build(gyp, argv, callback) { 135 | const args = ['rebuild'].concat(argv); 136 | gyp.todo.push({ name: 'build', args: args }); 137 | process.nextTick(callback); 138 | } 139 | 140 | function print_fallback_error(err, opts, package_json) { 141 | const fallback_message = ' (falling back to source compile with node-gyp)'; 142 | let full_message = ''; 143 | if (err.statusCode !== undefined) { 144 | // If we got a network response it but failed to download 145 | // it means remote binaries are not available, so let's try to help 146 | // the user/developer with the info to debug why 147 | full_message = 'Pre-built binaries not found for ' + package_json.name + '@' + package_json.version; 148 | full_message += ' and ' + opts.runtime + '@' + (opts.target || process.versions.node) + ' (' + opts.node_abi + ' ABI, ' + opts.libc + ')'; 149 | full_message += fallback_message; 150 | log.warn('Tried to download(' + err.statusCode + '): ' + opts.hosted_tarball); 151 | log.warn(full_message); 152 | log.http(err.message); 153 | } else { 154 | // If we do not have a statusCode that means an unexpected error 155 | // happened and prevented an http response, so we output the exact error 156 | full_message = 'Pre-built binaries not installable for ' + package_json.name + '@' + package_json.version; 157 | full_message += ' and ' + opts.runtime + '@' + (opts.target || process.versions.node) + ' (' + opts.node_abi + ' ABI, ' + opts.libc + ')'; 158 | full_message += fallback_message; 159 | log.warn(full_message); 160 | log.warn('Hit error ' + err.message); 161 | } 162 | } 163 | 164 | // 165 | // install 166 | // 167 | function install(gyp, argv, callback) { 168 | const package_json = gyp.package_json; 169 | const napi_build_version = napi.get_napi_build_version_from_command_args(argv); 170 | const source_build = gyp.opts['build-from-source'] || gyp.opts.build_from_source; 171 | const update_binary = gyp.opts['update-binary'] || gyp.opts.update_binary; 172 | const should_do_source_build = source_build === package_json.name || (source_build === true || source_build === 'true'); 173 | if (should_do_source_build) { 174 | log.info('build', 'requesting source compile'); 175 | return do_build(gyp, argv, callback); 176 | } else { 177 | const fallback_to_build = gyp.opts['fallback-to-build'] || gyp.opts.fallback_to_build; 178 | let should_do_fallback_build = fallback_to_build === package_json.name || (fallback_to_build === true || fallback_to_build === 'true'); 179 | // but allow override from npm 180 | if (process.env.npm_config_argv) { 181 | const cooked = JSON.parse(process.env.npm_config_argv).cooked; 182 | const match = cooked.indexOf('--fallback-to-build'); 183 | if (match > -1 && cooked.length > match && cooked[match + 1] === 'false') { 184 | should_do_fallback_build = false; 185 | log.info('install', 'Build fallback disabled via npm flag: --fallback-to-build=false'); 186 | } 187 | } 188 | let opts; 189 | try { 190 | opts = versioning.evaluate(package_json, gyp.opts, napi_build_version); 191 | } catch (err) { 192 | return callback(err); 193 | } 194 | 195 | opts.ca = gyp.opts.ca; 196 | opts.cafile = gyp.opts.cafile; 197 | 198 | const from = opts.hosted_tarball; 199 | const to = opts.module_path; 200 | const binary_module = path.join(to, opts.module_name + '.node'); 201 | existsAsync(binary_module, (found) => { 202 | if (!update_binary) { 203 | if (found) { 204 | console.log('[' + package_json.name + '] Success: "' + binary_module + '" already installed'); 205 | console.log('Pass --update-binary to reinstall or --build-from-source to recompile'); 206 | return callback(); 207 | } 208 | log.info('check', 'checked for "' + binary_module + '" (not found)'); 209 | } 210 | 211 | makeDir(to).then(() => { 212 | const fileName = from.startsWith('file://') && from.slice('file://'.length); 213 | if (fileName) { 214 | extract_from_local(fileName, to, after_place); 215 | } else { 216 | place_binary(from, to, opts, after_place); 217 | } 218 | }).catch((err) => { 219 | after_place(err); 220 | }); 221 | 222 | function after_place(err) { 223 | if (err && should_do_fallback_build) { 224 | print_fallback_error(err, opts, package_json); 225 | return do_build(gyp, argv, callback); 226 | } else if (err) { 227 | return callback(err); 228 | } else { 229 | console.log('[' + package_json.name + '] Success: "' + binary_module + '" is installed via remote'); 230 | return callback(); 231 | } 232 | } 233 | }); 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/util/napi.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | 5 | module.exports = exports; 6 | 7 | const versionArray = process.version 8 | .substr(1) 9 | .replace(/-.*$/, '') 10 | .split('.') 11 | .map((item) => { 12 | return +item; 13 | }); 14 | 15 | const napi_multiple_commands = [ 16 | 'build', 17 | 'clean', 18 | 'configure', 19 | 'package', 20 | 'publish', 21 | 'reveal', 22 | 'testbinary', 23 | 'testpackage', 24 | 'unpublish' 25 | ]; 26 | 27 | const napi_build_version_tag = 'napi_build_version='; 28 | 29 | module.exports.get_napi_version = function() { 30 | // returns the non-zero numeric napi version or undefined if napi is not supported. 31 | // correctly supporting target requires an updated cross-walk 32 | let version = process.versions.napi; // can be undefined 33 | if (!version) { // this code should never need to be updated 34 | if (versionArray[0] === 9 && versionArray[1] >= 3) version = 2; // 9.3.0+ 35 | else if (versionArray[0] === 8) version = 1; // 8.0.0+ 36 | } 37 | return version; 38 | }; 39 | 40 | module.exports.get_napi_version_as_string = function(target) { 41 | // returns the napi version as a string or an empty string if napi is not supported. 42 | const version = module.exports.get_napi_version(target); 43 | return version ? '' + version : ''; 44 | }; 45 | 46 | module.exports.validate_package_json = function(package_json, opts) { // throws Error 47 | 48 | const binary = package_json.binary; 49 | const module_path_ok = pathOK(binary.module_path); 50 | const remote_path_ok = pathOK(binary.remote_path); 51 | const package_name_ok = pathOK(binary.package_name); 52 | const napi_build_versions = module.exports.get_napi_build_versions(package_json, opts, true); 53 | const napi_build_versions_raw = module.exports.get_napi_build_versions_raw(package_json); 54 | 55 | if (napi_build_versions) { 56 | napi_build_versions.forEach((napi_build_version)=> { 57 | if (!(parseInt(napi_build_version, 10) === napi_build_version && napi_build_version > 0)) { 58 | throw new Error('All values specified in napi_versions must be positive integers.'); 59 | } 60 | }); 61 | } 62 | 63 | if (napi_build_versions && (!module_path_ok || (!remote_path_ok && !package_name_ok))) { 64 | throw new Error('When napi_versions is specified; module_path and either remote_path or ' + 65 | "package_name must contain the substitution string '{napi_build_version}`."); 66 | } 67 | 68 | if ((module_path_ok || remote_path_ok || package_name_ok) && !napi_build_versions_raw) { 69 | throw new Error("When the substitution string '{napi_build_version}` is specified in " + 70 | 'module_path, remote_path, or package_name; napi_versions must also be specified.'); 71 | } 72 | 73 | if (napi_build_versions && !module.exports.get_best_napi_build_version(package_json, opts) && 74 | module.exports.build_napi_only(package_json)) { 75 | throw new Error( 76 | 'The Node-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' + 77 | 'This module supports Node-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' + 78 | 'This Node instance cannot run this module.'); 79 | } 80 | 81 | if (napi_build_versions_raw && !napi_build_versions && module.exports.build_napi_only(package_json)) { 82 | throw new Error( 83 | 'The Node-API version of this Node instance is ' + module.exports.get_napi_version(opts ? opts.target : undefined) + '. ' + 84 | 'This module supports Node-API version(s) ' + module.exports.get_napi_build_versions_raw(package_json) + '. ' + 85 | 'This Node instance cannot run this module.'); 86 | } 87 | 88 | }; 89 | 90 | function pathOK(path) { 91 | return path && (path.indexOf('{napi_build_version}') !== -1 || path.indexOf('{node_napi_label}') !== -1); 92 | } 93 | 94 | module.exports.expand_commands = function(package_json, opts, commands) { 95 | const expanded_commands = []; 96 | const napi_build_versions = module.exports.get_napi_build_versions(package_json, opts); 97 | commands.forEach((command)=> { 98 | if (napi_build_versions && command.name === 'install') { 99 | const napi_build_version = module.exports.get_best_napi_build_version(package_json, opts); 100 | const args = napi_build_version ? [napi_build_version_tag + napi_build_version] : []; 101 | expanded_commands.push({ name: command.name, args: args }); 102 | } else if (napi_build_versions && napi_multiple_commands.indexOf(command.name) !== -1) { 103 | napi_build_versions.forEach((napi_build_version)=> { 104 | const args = command.args.slice(); 105 | args.push(napi_build_version_tag + napi_build_version); 106 | expanded_commands.push({ name: command.name, args: args }); 107 | }); 108 | } else { 109 | expanded_commands.push(command); 110 | } 111 | }); 112 | return expanded_commands; 113 | }; 114 | 115 | module.exports.get_napi_build_versions = function(package_json, opts, warnings) { // opts may be undefined 116 | const log = require('npmlog'); 117 | let napi_build_versions = []; 118 | const supported_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined); 119 | // remove duplicates, verify each napi version can actaully be built 120 | if (package_json.binary && package_json.binary.napi_versions) { 121 | package_json.binary.napi_versions.forEach((napi_version) => { 122 | const duplicated = napi_build_versions.indexOf(napi_version) !== -1; 123 | if (!duplicated && supported_napi_version && napi_version <= supported_napi_version) { 124 | napi_build_versions.push(napi_version); 125 | } else if (warnings && !duplicated && supported_napi_version) { 126 | log.info('This Node instance does not support builds for Node-API version', napi_version); 127 | } 128 | }); 129 | } 130 | if (opts && opts['build-latest-napi-version-only']) { 131 | let latest_version = 0; 132 | napi_build_versions.forEach((napi_version) => { 133 | if (napi_version > latest_version) latest_version = napi_version; 134 | }); 135 | napi_build_versions = latest_version ? [latest_version] : []; 136 | } 137 | return napi_build_versions.length ? napi_build_versions : undefined; 138 | }; 139 | 140 | module.exports.get_napi_build_versions_raw = function(package_json) { 141 | const napi_build_versions = []; 142 | // remove duplicates 143 | if (package_json.binary && package_json.binary.napi_versions) { 144 | package_json.binary.napi_versions.forEach((napi_version) => { 145 | if (napi_build_versions.indexOf(napi_version) === -1) { 146 | napi_build_versions.push(napi_version); 147 | } 148 | }); 149 | } 150 | return napi_build_versions.length ? napi_build_versions : undefined; 151 | }; 152 | 153 | module.exports.get_command_arg = function(napi_build_version) { 154 | return napi_build_version_tag + napi_build_version; 155 | }; 156 | 157 | module.exports.get_napi_build_version_from_command_args = function(command_args) { 158 | for (let i = 0; i < command_args.length; i++) { 159 | const arg = command_args[i]; 160 | if (arg.indexOf(napi_build_version_tag) === 0) { 161 | return parseInt(arg.substr(napi_build_version_tag.length), 10); 162 | } 163 | } 164 | return undefined; 165 | }; 166 | 167 | module.exports.swap_build_dir_out = function(napi_build_version) { 168 | if (napi_build_version) { 169 | const rm = require('rimraf'); 170 | rm.sync(module.exports.get_build_dir(napi_build_version)); 171 | fs.renameSync('build', module.exports.get_build_dir(napi_build_version)); 172 | } 173 | }; 174 | 175 | module.exports.swap_build_dir_in = function(napi_build_version) { 176 | if (napi_build_version) { 177 | const rm = require('rimraf'); 178 | rm.sync('build'); 179 | fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build'); 180 | } 181 | }; 182 | 183 | module.exports.get_build_dir = function(napi_build_version) { 184 | return 'build-tmp-napi-v' + napi_build_version; 185 | }; 186 | 187 | module.exports.get_best_napi_build_version = function(package_json, opts) { 188 | let best_napi_build_version = 0; 189 | const napi_build_versions = module.exports.get_napi_build_versions(package_json, opts); 190 | if (napi_build_versions) { 191 | const our_napi_version = module.exports.get_napi_version(opts ? opts.target : undefined); 192 | napi_build_versions.forEach((napi_build_version)=> { 193 | if (napi_build_version > best_napi_build_version && 194 | napi_build_version <= our_napi_version) { 195 | best_napi_build_version = napi_build_version; 196 | } 197 | }); 198 | } 199 | return best_napi_build_version === 0 ? undefined : best_napi_build_version; 200 | }; 201 | 202 | module.exports.build_napi_only = function(package_json) { 203 | return package_json.binary && package_json.binary.package_name && 204 | package_json.binary.package_name.indexOf('{node_napi_label}') === -1; 205 | }; 206 | -------------------------------------------------------------------------------- /E-project/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Module exports. 5 | */ 6 | 7 | module.exports = exports; 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | // load mocking control function for accessing s3 via https. the function is a noop always returning 14 | // false if not mocking. 15 | exports.mockS3Http = require('./util/s3_setup').get_mockS3Http(); 16 | exports.mockS3Http('on'); 17 | const mocking = exports.mockS3Http('get'); 18 | 19 | 20 | const fs = require('fs'); 21 | const path = require('path'); 22 | const nopt = require('nopt'); 23 | const log = require('npmlog'); 24 | log.disableProgress(); 25 | const napi = require('./util/napi.js'); 26 | 27 | const EE = require('events').EventEmitter; 28 | const inherits = require('util').inherits; 29 | const cli_commands = [ 30 | 'clean', 31 | 'install', 32 | 'reinstall', 33 | 'build', 34 | 'rebuild', 35 | 'package', 36 | 'testpackage', 37 | 'publish', 38 | 'unpublish', 39 | 'info', 40 | 'testbinary', 41 | 'reveal', 42 | 'configure' 43 | ]; 44 | const aliases = {}; 45 | 46 | // differentiate node-pre-gyp's logs from npm's 47 | log.heading = 'node-pre-gyp'; 48 | 49 | if (mocking) { 50 | log.warn(`mocking s3 to ${process.env.node_pre_gyp_mock_s3}`); 51 | } 52 | 53 | // this is a getter to avoid circular reference warnings with node v14. 54 | Object.defineProperty(exports, 'find', { 55 | get: function() { 56 | return require('./pre-binding').find; 57 | }, 58 | enumerable: true 59 | }); 60 | 61 | // in the following, "my_module" is using node-pre-gyp to 62 | // prebuild and install pre-built binaries. "main_module" 63 | // is using "my_module". 64 | // 65 | // "bin/node-pre-gyp" invokes Run() without a path. the 66 | // expectation is that the working directory is the package 67 | // root "my_module". this is true because in all cases npm is 68 | // executing a script in the context of "my_module". 69 | // 70 | // "pre-binding.find()" is executed by "my_module" but in the 71 | // context of "main_module". this is because "main_module" is 72 | // executing and requires "my_module" which is then executing 73 | // "pre-binding.find()" via "node-pre-gyp.find()", so the working 74 | // directory is that of "main_module". 75 | // 76 | // that's why "find()" must pass the path to package.json. 77 | // 78 | function Run({ package_json_path = './package.json', argv }) { 79 | this.package_json_path = package_json_path; 80 | this.commands = {}; 81 | 82 | const self = this; 83 | cli_commands.forEach((command) => { 84 | self.commands[command] = function(argvx, callback) { 85 | log.verbose('command', command, argvx); 86 | return require('./' + command)(self, argvx, callback); 87 | }; 88 | }); 89 | 90 | this.parseArgv(argv); 91 | 92 | // this is set to true after the binary.host property was set to 93 | // either staging_host or production_host. 94 | this.binaryHostSet = false; 95 | } 96 | inherits(Run, EE); 97 | exports.Run = Run; 98 | const proto = Run.prototype; 99 | 100 | /** 101 | * Export the contents of the package.json. 102 | */ 103 | 104 | proto.package = require('../package.json'); 105 | 106 | /** 107 | * nopt configuration definitions 108 | */ 109 | 110 | proto.configDefs = { 111 | help: Boolean, // everywhere 112 | arch: String, // 'configure' 113 | debug: Boolean, // 'build' 114 | directory: String, // bin 115 | proxy: String, // 'install' 116 | loglevel: String // everywhere 117 | }; 118 | 119 | /** 120 | * nopt shorthands 121 | */ 122 | 123 | proto.shorthands = { 124 | release: '--no-debug', 125 | C: '--directory', 126 | debug: '--debug', 127 | j: '--jobs', 128 | silent: '--loglevel=silent', 129 | silly: '--loglevel=silly', 130 | verbose: '--loglevel=verbose' 131 | }; 132 | 133 | /** 134 | * expose the command aliases for the bin file to use. 135 | */ 136 | 137 | proto.aliases = aliases; 138 | 139 | /** 140 | * Parses the given argv array and sets the 'opts', 'argv', 141 | * 'command', and 'package_json' properties. 142 | */ 143 | 144 | proto.parseArgv = function parseOpts(argv) { 145 | this.opts = nopt(this.configDefs, this.shorthands, argv); 146 | this.argv = this.opts.argv.remain.slice(); 147 | const commands = this.todo = []; 148 | 149 | // create a copy of the argv array with aliases mapped 150 | argv = this.argv.map((arg) => { 151 | // is this an alias? 152 | if (arg in this.aliases) { 153 | arg = this.aliases[arg]; 154 | } 155 | return arg; 156 | }); 157 | 158 | // process the mapped args into "command" objects ("name" and "args" props) 159 | argv.slice().forEach((arg) => { 160 | if (arg in this.commands) { 161 | const args = argv.splice(0, argv.indexOf(arg)); 162 | argv.shift(); 163 | if (commands.length > 0) { 164 | commands[commands.length - 1].args = args; 165 | } 166 | commands.push({ name: arg, args: [] }); 167 | } 168 | }); 169 | if (commands.length > 0) { 170 | commands[commands.length - 1].args = argv.splice(0); 171 | } 172 | 173 | 174 | // if a directory was specified package.json is assumed to be relative 175 | // to it. 176 | let package_json_path = this.package_json_path; 177 | if (this.opts.directory) { 178 | package_json_path = path.join(this.opts.directory, package_json_path); 179 | } 180 | 181 | this.package_json = JSON.parse(fs.readFileSync(package_json_path)); 182 | 183 | // expand commands entries for multiple napi builds 184 | this.todo = napi.expand_commands(this.package_json, this.opts, commands); 185 | 186 | // support for inheriting config env variables from npm 187 | const npm_config_prefix = 'npm_config_'; 188 | Object.keys(process.env).forEach((name) => { 189 | if (name.indexOf(npm_config_prefix) !== 0) return; 190 | const val = process.env[name]; 191 | if (name === npm_config_prefix + 'loglevel') { 192 | log.level = val; 193 | } else { 194 | // add the user-defined options to the config 195 | name = name.substring(npm_config_prefix.length); 196 | // avoid npm argv clobber already present args 197 | // which avoids problem of 'npm test' calling 198 | // script that runs unique npm install commands 199 | if (name === 'argv') { 200 | if (this.opts.argv && 201 | this.opts.argv.remain && 202 | this.opts.argv.remain.length) { 203 | // do nothing 204 | } else { 205 | this.opts[name] = val; 206 | } 207 | } else { 208 | this.opts[name] = val; 209 | } 210 | } 211 | }); 212 | 213 | if (this.opts.loglevel) { 214 | log.level = this.opts.loglevel; 215 | } 216 | log.resume(); 217 | }; 218 | 219 | /** 220 | * allow the binary.host property to be set at execution time. 221 | * 222 | * for this to take effect requires all the following to be true. 223 | * - binary is a property in package.json 224 | * - binary.host is falsey 225 | * - binary.staging_host is not empty 226 | * - binary.production_host is not empty 227 | * 228 | * if any of the previous checks fail then the function returns an empty string 229 | * and makes no changes to package.json's binary property. 230 | * 231 | * 232 | * if command is "publish" then the default is set to "binary.staging_host" 233 | * if command is not "publish" the the default is set to "binary.production_host" 234 | * 235 | * if the command-line option '--s3_host' is set to "staging" or "production" then 236 | * "binary.host" is set to the specified "staging_host" or "production_host". if 237 | * '--s3_host' is any other value an exception is thrown. 238 | * 239 | * if '--s3_host' is not present then "binary.host" is set to the default as above. 240 | * 241 | * this strategy was chosen so that any command other than "publish" or "unpublish" uses "production" 242 | * as the default without requiring any command-line options but that "publish" and "unpublish" require 243 | * '--s3_host production_host' to be specified in order to *really* publish (or unpublish). publishing 244 | * to staging can be done freely without worrying about disturbing any production releases. 245 | */ 246 | proto.setBinaryHostProperty = function(command) { 247 | if (this.binaryHostSet) { 248 | return this.package_json.binary.host; 249 | } 250 | const p = this.package_json; 251 | // don't set anything if host is present. it must be left blank to trigger this. 252 | if (!p || !p.binary || p.binary.host) { 253 | return ''; 254 | } 255 | // and both staging and production must be present. errors will be reported later. 256 | if (!p.binary.staging_host || !p.binary.production_host) { 257 | return ''; 258 | } 259 | let target = 'production_host'; 260 | if (command === 'publish' || command === 'unpublish') { 261 | target = 'staging_host'; 262 | } 263 | // the environment variable has priority over the default or the command line. if 264 | // either the env var or the command line option are invalid throw an error. 265 | const npg_s3_host = process.env.node_pre_gyp_s3_host; 266 | if (npg_s3_host === 'staging' || npg_s3_host === 'production') { 267 | target = `${npg_s3_host}_host`; 268 | } else if (this.opts['s3_host'] === 'staging' || this.opts['s3_host'] === 'production') { 269 | target = `${this.opts['s3_host']}_host`; 270 | } else if (this.opts['s3_host'] || npg_s3_host) { 271 | throw new Error(`invalid s3_host ${this.opts['s3_host'] || npg_s3_host}`); 272 | } 273 | 274 | p.binary.host = p.binary[target]; 275 | this.binaryHostSet = true; 276 | 277 | return p.binary.host; 278 | }; 279 | 280 | /** 281 | * Returns the usage instructions for node-pre-gyp. 282 | */ 283 | 284 | proto.usage = function usage() { 285 | const str = [ 286 | '', 287 | ' Usage: node-pre-gyp [options]', 288 | '', 289 | ' where is one of:', 290 | cli_commands.map((c) => { 291 | return ' - ' + c + ' - ' + require('./' + c).usage; 292 | }).join('\n'), 293 | '', 294 | 'node-pre-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'), 295 | 'node@' + process.versions.node 296 | ].join('\n'); 297 | return str; 298 | }; 299 | 300 | /** 301 | * Version number getter. 302 | */ 303 | 304 | Object.defineProperty(proto, 'version', { 305 | get: function() { 306 | return this.package.version; 307 | }, 308 | enumerable: true 309 | }); 310 | --------------------------------------------------------------------------------