diff --git a/bin/now-deploy.js b/bin/now-deploy.js index bb7d337..6c52f8f 100755 --- a/bin/now-deploy.js +++ b/bin/now-deploy.js @@ -17,7 +17,7 @@ const dotenv = require('dotenv') const copy = require('../lib/copy') const login = require('../lib/login') const cfg = require('../lib/cfg') -const {version} = require('../pkg') +const {version} = require('../lib/pkg') const Logger = require('../lib/build-logger') const Now = require('../lib') const toHumanPath = require('../lib/utils/to-human-path') diff --git a/bin/now.js b/bin/now.js index 50f1700..362e494 100755 --- a/bin/now.js +++ b/bin/now.js @@ -10,7 +10,7 @@ const chalk = require('chalk') // Ours const {error} = require('../lib/error') -const pkg = require('../pkg') +const pkg = require('../lib/pkg') // Throw an error if node version is too low if (nodeVersion.major < 6) { diff --git a/build.sh b/build.sh index 217793e..7a5d360 100755 --- a/build.sh +++ b/build.sh @@ -8,7 +8,3 @@ find lib/** -type f -exec node_modules/.bin/async-to-gen --out-file build/{} {} find bin/** -type f -exec node_modules/.bin/async-to-gen --out-file build/{} {} \; chmod +x build/bin/now.js cp lib/utils/billing/*.json build/lib/utils/billing/ - -# extracts `name` and `version` from ./package.json -# and ouputs it to build/pkg.json -echo "{`grep -e '\"version\|name\"' ./package.json | sed -e 's/ //g' | tr -d '\n' | sed -e 's/.$//g'`}" > build/pkg.json diff --git a/lib/login.js b/lib/login.js index c7db381..3209022 100644 --- a/lib/login.js +++ b/lib/login.js @@ -10,7 +10,7 @@ const readEmail = require('email-prompt') const ora = require('ora') // Ours -const pkg = require('../pkg') +const pkg = require('./pkg') const ua = require('./ua') const cfg = require('./cfg') diff --git a/lib/pkg.js b/lib/pkg.js index 73d6e7c..fce3a8a 100644 --- a/lib/pkg.js +++ b/lib/pkg.js @@ -1,4 +1,8 @@ -module.exports = { - version: '4.5.6', - name: 'now' +let pkg +try { + pkg = require('../package.json') +} catch (err) { + pkg = require('../../package.json') } + +module.exports = pkg diff --git a/lib/ua.js b/lib/ua.js index 66df019..82468e7 100644 --- a/lib/ua.js +++ b/lib/ua.js @@ -2,6 +2,6 @@ const os = require('os') // Ours -const {version} = require('../pkg') +const {version} = require('./pkg') module.exports = `now ${version} node-${process.version} ${os.platform()} (${os.arch()})`