Browse Source

Inlined version

master
Leo Lamprecht 8 years ago
parent
commit
b239630f7b
No known key found for this signature in database GPG Key ID: B08517883D5E0E10
  1. 2
      bin/now-deploy.js
  2. 25
      bin/now.js
  3. 2
      lib/login.js
  4. 4
      lib/pkg.js
  5. 2
      lib/ua.js
  6. 1
      package.json

2
bin/now-deploy.js

@ -17,7 +17,7 @@ const dotenv = require('dotenv')
const copy = require('../lib/copy') const copy = require('../lib/copy')
const login = require('../lib/login') const login = require('../lib/login')
const cfg = require('../lib/cfg') const cfg = require('../lib/cfg')
const {version} = require('../package') const {version} = require('../lib/pkg')
const Logger = require('../lib/build-logger') const Logger = require('../lib/build-logger')
const Now = require('../lib') const Now = require('../lib')
const toHumanPath = require('../lib/utils/to-human-path') const toHumanPath = require('../lib/utils/to-human-path')

25
bin/now.js

@ -7,10 +7,10 @@ const {resolve} = require('path')
const nodeVersion = require('node-version') const nodeVersion = require('node-version')
const updateNotifier = require('update-notifier') const updateNotifier = require('update-notifier')
const chalk = require('chalk') const chalk = require('chalk')
const pkgUp = require('pkg-up')
// Ours // Ours
const {error} = require('../lib/error') const {error} = require('../lib/error')
const pkg = require('../lib/pkg')
// Throw an error if node version is too low // Throw an error if node version is too low
if (nodeVersion.major < 6) { if (nodeVersion.major < 6) {
@ -18,23 +18,18 @@ if (nodeVersion.major < 6) {
process.exit(1) process.exit(1)
} }
pkgUp().then(packagePath => { if (!process.pkg) {
const pkg = require(packagePath) const notifier = updateNotifier({pkg})
const update = notifier.update
// Only check for updates in the npm version if (update) {
if (!process.pkg && pkg.dist) { let message = `Update available! ${chalk.red(update.current)}${chalk.green(update.latest)} \n`
const notifier = updateNotifier({pkg}) message += `Run ${chalk.magenta('npm i -g now')} to update!\n`
const update = notifier.update message += `${chalk.magenta('Changelog:')} https://github.com/zeit/now-cli/releases/tag/${update.latest}`
if (update) { notifier.notify({message})
let message = `Update available! ${chalk.red(update.current)}${chalk.green(update.latest)} \n`
message += `Run ${chalk.magenta('npm i -g now')} to update!\n`
message += `${chalk.magenta('Changelog:')} https://github.com/zeit/now-cli/releases/tag/${update.latest}`
notifier.notify({message})
}
} }
}) }
// This command will be run if no other sub command is specified // This command will be run if no other sub command is specified
const defaultCommand = 'deploy' const defaultCommand = 'deploy'

2
lib/login.js

@ -10,7 +10,7 @@ const readEmail = require('email-prompt')
const ora = require('ora') const ora = require('ora')
// Ours // Ours
const pkg = require('../package') const pkg = require('../lib/pkg')
const ua = require('./ua') const ua = require('./ua')
const cfg = require('./cfg') const cfg = require('./cfg')

4
lib/pkg.js

@ -0,0 +1,4 @@
module.exports = {
version: '4.5.3',
name: 'now'
}

2
lib/ua.js

@ -2,6 +2,6 @@
const os = require('os') const os = require('os')
// Ours // Ours
const {version} = require('../package') const {version} = require('../lib/pkg')
module.exports = `now ${version} node-${process.version} ${os.platform()} (${os.arch()})` module.exports = `now ${version} node-${process.version} ${os.platform()} (${os.arch()})`

1
package.json

@ -84,7 +84,6 @@
"node-fetch": "1.6.3", "node-fetch": "1.6.3",
"node-version": "1.0.0", "node-version": "1.0.0",
"ora": "1.1.0", "ora": "1.1.0",
"pkg-up": "1.0.0",
"progress": "1.1.8", "progress": "1.1.8",
"psl": "1.1.16", "psl": "1.1.16",
"resumer": "0.0.0", "resumer": "0.0.0",

Loading…
Cancel
Save