@ -12,6 +12,7 @@ const minimist = require('minimist');
const ms = require ( 'ms' ) ;
const ms = require ( 'ms' ) ;
const flatten = require ( 'arr-flatten' ) ;
const flatten = require ( 'arr-flatten' ) ;
const dotenv = require ( 'dotenv' ) ;
const dotenv = require ( 'dotenv' ) ;
const { eraseLines } = require ( 'ansi-escapes' ) ;
// Ours
// Ours
const copy = require ( '../lib/copy' ) ;
const copy = require ( '../lib/copy' ) ;
@ -30,6 +31,10 @@ const { reAlias, assignAlias } = require('../lib/re-alias');
const exit = require ( '../lib/utils/exit' ) ;
const exit = require ( '../lib/utils/exit' ) ;
const logo = require ( '../lib/utils/output/logo' ) ;
const logo = require ( '../lib/utils/output/logo' ) ;
const cmd = require ( '../lib/utils/output/cmd' ) ;
const cmd = require ( '../lib/utils/output/cmd' ) ;
const info = require ( '../lib/utils/output/info' ) ;
const wait = require ( '../lib/utils/output/wait' ) ;
const NowPlans = require ( '../lib/plans' ) ;
const promptBool = require ( '../lib/utils/input/prompt-bool' ) ;
const argv = minimist ( process . argv . slice ( 2 ) , {
const argv = minimist ( process . argv . slice ( 2 ) , {
string : [ 'config' , 'token' , 'name' , 'alias' ] ,
string : [ 'config' , 'token' , 'name' , 'alias' ] ,
@ -229,6 +234,8 @@ async function sync(token) {
const start = Date . now ( ) ;
const start = Date . now ( ) ;
const rawPath = argv . _ [ 0 ] ;
const rawPath = argv . _ [ 0 ] ;
const planPromise = new NowPlans ( apiUrl , token , { debug } ) . getCurrent ( ) ;
const stopDeployment = msg => {
const stopDeployment = msg => {
error ( msg ) ;
error ( msg ) ;
process . exit ( 1 ) ;
process . exit ( 1 ) ;
@ -597,6 +604,35 @@ async function sync(token) {
printLogs ( now . host , token ) ;
printLogs ( now . host , token ) ;
} ;
} ;
const plan = await planPromise ;
if ( plan . id === 'oss' ) {
info (
` You are on the OSS plan. Your code will be made ${ chalk . bold ( 'public' ) } . `
) ;
let proceed ;
try {
const label = 'Are you sure you want to proceed with the deployment?' ;
proceed = await promptBool ( label , { trailing : eraseLines ( 2 ) } ) ;
} catch ( err ) {
if ( err . message === 'USER_ABORT' ) {
proceed = false ;
} else {
throw err ;
}
}
if ( ! proceed ) {
const stopSpinner = wait ( 'Canceling deployment' ) ;
now . remove ( now . id , { hard : true } ) ;
stopSpinner ( ) ;
info ( 'Deployment aborted. No files were synced.' ) ;
info ( ` You can upgrade by running ${ cmd ( 'now upgrade' ) } . ` ) ;
return exit ( ) ;
}
}
if ( now . syncAmount ) {
if ( now . syncAmount ) {
const bar = new Progress ( '> Upload [:bar] :percent :etas' , {
const bar = new Progress ( '> Upload [:bar] :percent :etas' , {
width : 20 ,
width : 20 ,