Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

just use ◈ instead of overly wordy branding #109

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/cli-logo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
const chalk = require("chalk");

module.exports = {
NETLIFYDEV: `${chalk.rgb(40, 180, 170)("Netlify Dev")} ${chalk.greenBright(
"◈"
)}`,
NETLIFYDEVWARN: `${chalk.rgb(40, 180, 170)(
NETLIFYDEV: `${chalk.greenBright("◈")} ${chalk.rgb(40, 180, 170)(
"Netlify Dev"
)} ${chalk.yellowBright("◈")}`,
NETLIFYDEVERR: `${chalk.rgb(40, 180, 170)("Netlify Dev")} ${chalk.redBright(
"◈"
)}`
)} ${chalk.greenBright("◈")}`,
NETLIFYDEVLOG: `${chalk.greenBright("◈")}`,
NETLIFYDEVWARN: `${chalk.yellowBright("◈")}`,
NETLIFYDEVERR: `${chalk.redBright("◈")}`
};
11 changes: 9 additions & 2 deletions src/commands/dev/exec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
const execa = require("execa");
const Command = require("@netlify/cli-utils");
const { track } = require("@netlify/cli-utils/src/utils/telemetry");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require("../../cli-logo");

class ExecCommand extends Command {
async run() {
const { site, api } = this.netlify;
if (site.id) {
this.log(`${NETLIFYDEV} Checking your site's environment variables...`); // just to show some visual response first
this.log(
`${NETLIFYDEVLOG} Checking your site's environment variables...`
); // just to show some visual response first
const accessToken = api.accessToken;
const { addEnvVariables } = require("../../utils/dev");
await addEnvVariables(api, site, accessToken);
Expand Down
17 changes: 11 additions & 6 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ const Command = require("@netlify/cli-utils");
const { getAddons } = require("netlify/src/addons");
const { track } = require("@netlify/cli-utils/src/utils/telemetry");
const chalk = require("chalk");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require("../../cli-logo");
const boxen = require("boxen");
const { createTunnel, connectTunnel } = require("../../live-tunnel");

Expand Down Expand Up @@ -146,11 +151,11 @@ function startDevServer(settings, log, error) {
});

server.start(function() {
log(`\n${NETLIFYDEV} Server listening to`, settings.proxyPort);
log(`\n${NETLIFYDEVLOG} Server listening to`, settings.proxyPort);
});
return;
}
log(`${NETLIFYDEV} Starting Netlify Dev with ${settings.type}`);
log(`${NETLIFYDEVLOG} Starting Netlify Dev with ${settings.type}`);
const ps = execa(settings.command, settings.args, {
env: settings.env,
stdio: "inherit"
Expand All @@ -162,7 +167,7 @@ function startDevServer(settings, log, error) {

class DevCommand extends Command {
async run() {
this.log(`${NETLIFYDEV} Starting Netlify Dev...`);
this.log(`${NETLIFYDEV} Starting...`);
let { flags } = this.parse(DevCommand);
const { api, site, config } = this.netlify;
const functionsDir =
Expand All @@ -188,7 +193,7 @@ class DevCommand extends Command {
(config.dev && config.dev.publish) ||
(config.build && config.build.publish);
if (!dist) {
console.log(`${NETLIFYDEV} Using current working directory`);
console.log(`${NETLIFYDEVLOG} Using current working directory`);
this.log(
`${NETLIFYDEVWARN} Unable to determine public folder to serve files from.`
);
Expand Down Expand Up @@ -262,7 +267,7 @@ class DevCommand extends Command {

// boxen doesnt support text wrapping yet https://github.com/sindresorhus/boxen/issues/16
const banner = require("wrap-ansi")(
chalk.bold(`${NETLIFYDEV} Server now ready on ${url}`),
chalk.bold(`${NETLIFYDEVLOG} Server now ready on ${url}`),
70
);
this.log(
Expand Down
11 changes: 8 additions & 3 deletions src/commands/functions/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ const fs = require("fs");
const { flags } = require("@oclif/command");
const Command = require("@netlify/cli-utils");
const { zipFunctions } = require("@netlify/zip-it-and-ship-it");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require("../../cli-logo");

class FunctionsBuildCommand extends Command {
async run() {
Expand Down Expand Up @@ -33,9 +38,9 @@ class FunctionsBuildCommand extends Command {

fs.mkdirSync(dst, { recursive: true });

this.log(`${NETLIFYDEV} Building functions`);
this.log(`${NETLIFYDEVLOG} Building functions`);
zipFunctions(src, dst, { skipGo: true });
this.log(`${NETLIFYDEV} Functions built to `, dst);
this.log(`${NETLIFYDEVLOG} Functions built to `, dst);
}
}

Expand Down
38 changes: 24 additions & 14 deletions src/commands/functions/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ const { createAddon } = require("netlify/src/addons");
const ora = require("ora");
const { track } = require("@netlify/cli-utils/src/utils/telemetry");
const chalk = require("chalk");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require("../../cli-logo");

const templatesDir = path.resolve(__dirname, "../../functions-templates");

Expand Down Expand Up @@ -206,19 +211,19 @@ function ensureFunctionDirExists(flags, config) {
flags.functions || (config.build && config.build.functions);
if (!functionsDir) {
this.log(
`${NETLIFYDEV} No functions folder specified in netlify.toml or as an argument`
`${NETLIFYDEVLOG} No functions folder specified in netlify.toml or as an argument`
);
process.exit(1);
}
if (!fs.existsSync(functionsDir)) {
this.log(
`${NETLIFYDEV} functions folder ${chalk.magenta.inverse(
`${NETLIFYDEVLOG} functions folder ${chalk.magenta.inverse(
functionsDir
)} specified in netlify.toml but folder not found, creating it...`
);
fs.mkdirSync(functionsDir);
this.log(
`${NETLIFYDEV} functions folder ${chalk.magenta.inverse(
`${NETLIFYDEVLOG} functions folder ${chalk.magenta.inverse(
functionsDir
)} created`
);
Expand Down Expand Up @@ -264,10 +269,10 @@ async function downloadFromURL(flags, args, functionsDir) {
})
);

this.log(`${NETLIFYDEV} Installing dependencies for ${nameToUse}...`);
this.log(`${NETLIFYDEVLOG} Installing dependencies for ${nameToUse}...`);
cp.exec("npm i", { cwd: path.join(functionsDir, nameToUse) }, () => {
this.log(
`${NETLIFYDEV} Installing dependencies for ${nameToUse} complete `
`${NETLIFYDEVLOG} Installing dependencies for ${nameToUse} complete `
);
});

Expand Down Expand Up @@ -315,13 +320,15 @@ async function scaffoldFromTemplate(flags, args, functionsDir) {
try {
await downloadFromURL.call(this, flags, args, functionsDir);
} catch (err) {
console.error(`$${NETLIFYERR} Error downloading from URL: ` + flags.url);
console.error(
`$${NETLIFYDEVERR} Error downloading from URL: ` + flags.url
);
console.error(err);
process.exit(1);
}
} else if (chosentemplate === "report") {
console.log(
`${NETLIFYDEV} Open in browser: https://github.com/netlify/netlify-dev-plugin/issues/new`
`${NETLIFYDEVLOG} Open in browser: https://github.com/netlify/netlify-dev-plugin/issues/new`
);
} else {
const {
Expand All @@ -339,7 +346,7 @@ async function scaffoldFromTemplate(flags, args, functionsDir) {
}

const name = await getNameFromArgs(args, flags, templateName);
this.log(`${NETLIFYDEV} Creating function ${chalk.cyan.inverse(name)}`);
this.log(`${NETLIFYDEVLOG} Creating function ${chalk.cyan.inverse(name)}`);
const functionPath = ensureFunctionPathIsOk.call(
this,
functionsDir,
Expand All @@ -355,7 +362,9 @@ async function scaffoldFromTemplate(flags, args, functionsDir) {
if (err) throw err;
createdFiles.forEach(filePath => {
if (filePath.endsWith(".netlify-function-template.js")) return;
this.log(`${NETLIFYDEV} ${chalk.greenBright("Created")} ${filePath}`);
this.log(
`${NETLIFYDEVLOG} ${chalk.greenBright("Created")} ${filePath}`
);
require("fs").chmodSync(path.resolve(filePath), 0o777);
if (filePath.includes("package.json")) hasPackageJSON = true;
});
Expand Down Expand Up @@ -401,13 +410,14 @@ async function installAddons(addons = [], fnPath) {
);
return false;
}
console.log(`${NETLIFYDEV} checking Netlify APIs...`);
console.log(`${NETLIFYDEVLOG} checking Netlify APIs...`);

return api.getSite({ siteId }).then(async siteData => {
const accessToken = api.accessToken;
const arr = addons.map(({ addonName, addonDidInstall }) => {
console.log(
`${NETLIFYDEV} installing addon: ` + chalk.yellow.inverse(addonName)
`${NETLIFYDEVLOG} installing addon: ` +
chalk.yellow.inverse(addonName)
);
// will prompt for configs if not supplied - we do not yet allow for addon configs supplied by `netlify functions:create` command and may never do so
return createSiteAddon(
Expand Down Expand Up @@ -436,7 +446,7 @@ async function installAddons(addons = [], fnPath) {
}
})
.catch(err => {
console.error(`${NETLIFYERR} Error installing addon: `, err);
console.error(`${NETLIFYDEVERR} Error installing addon: `, err);
});
});
return Promise.all(arr);
Expand All @@ -450,7 +460,7 @@ function ensureFunctionPathIsOk(functionsDir, flags, name) {
const functionPath = path.join(functionsDir, name);
if (fs.existsSync(functionPath)) {
this.log(
`${NETLIFYDEV} Function ${functionPath} already exists, cancelling...`
`${NETLIFYDEVLOG} Function ${functionPath} already exists, cancelling...`
);
process.exit(1);
}
Expand Down
9 changes: 7 additions & 2 deletions src/commands/functions/serve.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
const { Command, flags } = require("@oclif/command");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require("../../cli-logo");

class FunctionsServeCommand extends Command {
async run() {
this.log(`${NETLIFYDEV} NOT IMPLEMENTED YET: serve a function`);
this.log(`${NETLIFYDEVERR} NOT IMPLEMENTED YET: netlify functions:serve`);
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/commands/functions/update.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
const { Command, flags } = require("@oclif/command");
const chalk = require("chalk");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require("../../cli-logo");

class FunctionsUpdateCommand extends Command {
async run() {
this.log(`${NETLIFYDEV} NOT IMPLEMENTED YET: update a function`);
this.log(`${NETLIFYDEVERR} NOT IMPLEMENTED YET: update a function`);
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/detect-server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const path = require("path");
const chalk = require("chalk");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("./cli-logo");
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require("./cli-logo");
const inquirer = require("inquirer");
const fs = require("fs");
const detectors = fs
Expand Down Expand Up @@ -88,7 +93,7 @@ module.exports.serverSettings = async devConfig => {
/** everything below assumes we have settled on one detector */
const tellUser = settingsField => dV =>
console.log(
`${NETLIFYDEV} Overriding ${chalk.yellow(
`${NETLIFYDEVLOG} Overriding ${chalk.yellow(
settingsField
)} with setting derived from netlify.toml [dev] block: `,
dV
Expand Down
6 changes: 3 additions & 3 deletions src/live-tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const os = require("os");
const path = require("path");
const execa = require("execa");
const { fetchLatest, updateAvailable } = require("gh-release-fetch");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("./cli-logo");
const { NETLIFYDEVLOG, NETLIFYDEVWARN, NETLIFYDEVERR } = require("./cli-logo");

async function createTunnel(siteId, netlifyApiToken, log) {
await installTunnelClient(log);
Expand All @@ -15,7 +15,7 @@ async function createTunnel(siteId, netlifyApiToken, log) {
);
process.exit(1);
}
log(`${NETLIFYDEV} Creating Live Tunnel for ` + siteId);
log(`${NETLIFYDEVLOG} Creating Live Tunnel for ` + siteId);
const url = `https://api.netlify.com/api/v1/live_sessions?site_id=${siteId}`;

const response = await fetch(url, {
Expand Down Expand Up @@ -72,7 +72,7 @@ async function installTunnelClient(log) {
return;
}

log(`${NETLIFYDEV} Installing Live Tunnel Client`);
log(`${NETLIFYDEVLOG} Installing Live Tunnel Client`);

const win = isWindows();
const platform = win ? "windows" : process.platform;
Expand Down
6 changes: 3 additions & 3 deletions src/utils/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// bit of a hasty abstraction but recommended by oclif
const { getAddons } = require("netlify/src/addons");
const chalk = require("chalk");
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../cli-logo");
const { NETLIFYDEVLOG, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../cli-logo");
/**
* inject environment variables from netlify addons and buildbot
* into your local dev process.env
Expand Down Expand Up @@ -38,7 +38,7 @@ async function addEnvVariables(api, site, accessToken) {
for (const key in addon.env) {
const msg = () =>
console.log(
`${NETLIFYDEV} Injected ${chalk.yellow.bold("addon")} env var: `,
`${NETLIFYDEVLOG} Injected ${chalk.yellow.bold("addon")} env var: `,
chalk.yellow(key)
);
process.env[key] = assignLoudly(process.env[key], addon.env[key], msg);
Expand Down Expand Up @@ -77,7 +77,7 @@ async function addEnvVariables(api, site, accessToken) {
for (const key in apiSite.build_settings.env) {
const msg = () =>
console.log(
`${NETLIFYDEV} Injected ${chalk.blue.bold(
`${NETLIFYDEVLOG} Injected ${chalk.blue.bold(
"build setting"
)} env var: `,
chalk.yellow(key)
Expand Down