From 09b91e8fbba5e0150a4f06c3d53f7b12725919a7 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Thu, 15 Dec 2016 10:37:23 +0100 Subject: [PATCH] Support IDs for auto aliasing --- bin/now-deploy.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/now-deploy.js b/bin/now-deploy.js index 21bfcf1..854d8e4 100755 --- a/bin/now-deploy.js +++ b/bin/now-deploy.js @@ -10,6 +10,7 @@ import bytes from 'bytes' import chalk from 'chalk' import minimist from 'minimist' import ms from 'ms' +import publicSuffixList from 'psl' // Ours import copy from '../lib/copy' @@ -547,6 +548,8 @@ async function sync(token) { } const assignAlias = async (token, deployment) => { + const type = publicSuffixList.isValid(autoAlias) ? 'alias' : 'uid' + const aliases = new NowAlias(apiUrl, token, {debug}) const list = await aliases.ls() @@ -554,7 +557,7 @@ const assignAlias = async (token, deployment) => { // Check if alias even exists for (const alias of list) { - if (alias.alias === autoAlias) { + if (alias[type] === autoAlias) { related = alias break } @@ -566,7 +569,7 @@ const assignAlias = async (token, deployment) => { return } - console.log(`> Assigning alias "${autoAlias}" to deployment...`) + console.log(`> Assigning alias ${chalk.bold.underline(related.alias)} to deployment...`) // Assign alias await aliases.set(String(deployment), String(related.alias))