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

Commit 9f60b3d

Browse files
authored
Merge pull request #109 from netlify/dropExcessiveNetlifyDev
just use ◈ instead of overly wordy branding
2 parents d214389 + c959ffe commit 9f60b3d

File tree

10 files changed

+84
-45
lines changed

10 files changed

+84
-45
lines changed

src/cli-logo.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
const chalk = require("chalk");
22

33
module.exports = {
4-
NETLIFYDEV: `${chalk.rgb(40, 180, 170)("Netlify Dev")} ${chalk.greenBright(
5-
"◈"
6-
)}`,
7-
NETLIFYDEVWARN: `${chalk.rgb(40, 180, 170)(
4+
NETLIFYDEV: `${chalk.greenBright("◈")} ${chalk.rgb(40, 180, 170)(
85
"Netlify Dev"
9-
)} ${chalk.yellowBright("◈")}`,
10-
NETLIFYDEVERR: `${chalk.rgb(40, 180, 170)("Netlify Dev")} ${chalk.redBright(
11-
"◈"
12-
)}`
6+
)} ${chalk.greenBright("◈")}`,
7+
NETLIFYDEVLOG: `${chalk.greenBright("◈")}`,
8+
NETLIFYDEVWARN: `${chalk.yellowBright("◈")}`,
9+
NETLIFYDEVERR: `${chalk.redBright("◈")}`
1310
};

src/commands/dev/exec.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
const execa = require("execa");
22
const Command = require("@netlify/cli-utils");
33
const { track } = require("@netlify/cli-utils/src/utils/telemetry");
4-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
4+
const {
5+
NETLIFYDEV,
6+
NETLIFYDEVLOG,
7+
NETLIFYDEVWARN,
8+
NETLIFYDEVERR
9+
} = require("../../cli-logo");
510

611
class ExecCommand extends Command {
712
async run() {
813
const { site, api } = this.netlify;
914
if (site.id) {
10-
this.log(`${NETLIFYDEV} Checking your site's environment variables...`); // just to show some visual response first
15+
this.log(
16+
`${NETLIFYDEVLOG} Checking your site's environment variables...`
17+
); // just to show some visual response first
1118
const accessToken = api.accessToken;
1219
const { addEnvVariables } = require("../../utils/dev");
1320
await addEnvVariables(api, site, accessToken);

src/commands/dev/index.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ const Command = require("@netlify/cli-utils");
1212
const { getAddons } = require("netlify/src/addons");
1313
const { track } = require("@netlify/cli-utils/src/utils/telemetry");
1414
const chalk = require("chalk");
15-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
15+
const {
16+
NETLIFYDEV,
17+
NETLIFYDEVLOG,
18+
NETLIFYDEVWARN,
19+
NETLIFYDEVERR
20+
} = require("../../cli-logo");
1621
const boxen = require("boxen");
1722
const { createTunnel, connectTunnel } = require("../../live-tunnel");
1823

@@ -146,11 +151,11 @@ function startDevServer(settings, log, error) {
146151
});
147152

148153
server.start(function() {
149-
log(`\n${NETLIFYDEV} Server listening to`, settings.proxyPort);
154+
log(`\n${NETLIFYDEVLOG} Server listening to`, settings.proxyPort);
150155
});
151156
return;
152157
}
153-
log(`${NETLIFYDEV} Starting Netlify Dev with ${settings.type}`);
158+
log(`${NETLIFYDEVLOG} Starting Netlify Dev with ${settings.type}`);
154159
const ps = execa(settings.command, settings.args, {
155160
env: settings.env,
156161
stdio: "inherit"
@@ -162,7 +167,7 @@ function startDevServer(settings, log, error) {
162167

163168
class DevCommand extends Command {
164169
async run() {
165-
this.log(`${NETLIFYDEV} Starting Netlify Dev...`);
170+
this.log(`${NETLIFYDEV} Starting...`);
166171
let { flags } = this.parse(DevCommand);
167172
const { api, site, config } = this.netlify;
168173
const functionsDir =
@@ -188,7 +193,7 @@ class DevCommand extends Command {
188193
(config.dev && config.dev.publish) ||
189194
(config.build && config.build.publish);
190195
if (!dist) {
191-
console.log(`${NETLIFYDEV} Using current working directory`);
196+
console.log(`${NETLIFYDEVLOG} Using current working directory`);
192197
this.log(
193198
`${NETLIFYDEVWARN} Unable to determine public folder to serve files from.`
194199
);
@@ -262,7 +267,7 @@ class DevCommand extends Command {
262267

263268
// boxen doesnt support text wrapping yet https://github.com/sindresorhus/boxen/issues/16
264269
const banner = require("wrap-ansi")(
265-
chalk.bold(`${NETLIFYDEV} Server now ready on ${url}`),
270+
chalk.bold(`${NETLIFYDEVLOG} Server now ready on ${url}`),
266271
70
267272
);
268273
this.log(

src/commands/functions/build.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ const fs = require("fs");
22
const { flags } = require("@oclif/command");
33
const Command = require("@netlify/cli-utils");
44
const { zipFunctions } = require("@netlify/zip-it-and-ship-it");
5-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
5+
const {
6+
NETLIFYDEV,
7+
NETLIFYDEVLOG,
8+
NETLIFYDEVWARN,
9+
NETLIFYDEVERR
10+
} = require("../../cli-logo");
611

712
class FunctionsBuildCommand extends Command {
813
async run() {
@@ -33,9 +38,9 @@ class FunctionsBuildCommand extends Command {
3338

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

36-
this.log(`${NETLIFYDEV} Building functions`);
41+
this.log(`${NETLIFYDEVLOG} Building functions`);
3742
zipFunctions(src, dst, { skipGo: true });
38-
this.log(`${NETLIFYDEV} Functions built to `, dst);
43+
this.log(`${NETLIFYDEVLOG} Functions built to `, dst);
3944
}
4045
}
4146

src/commands/functions/create.js

+24-14
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ const { createAddon } = require("netlify/src/addons");
1414
const ora = require("ora");
1515
const { track } = require("@netlify/cli-utils/src/utils/telemetry");
1616
const chalk = require("chalk");
17-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
17+
const {
18+
NETLIFYDEV,
19+
NETLIFYDEVLOG,
20+
NETLIFYDEVWARN,
21+
NETLIFYDEVERR
22+
} = require("../../cli-logo");
1823

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

@@ -206,19 +211,19 @@ function ensureFunctionDirExists(flags, config) {
206211
flags.functions || (config.build && config.build.functions);
207212
if (!functionsDir) {
208213
this.log(
209-
`${NETLIFYDEV} No functions folder specified in netlify.toml or as an argument`
214+
`${NETLIFYDEVLOG} No functions folder specified in netlify.toml or as an argument`
210215
);
211216
process.exit(1);
212217
}
213218
if (!fs.existsSync(functionsDir)) {
214219
this.log(
215-
`${NETLIFYDEV} functions folder ${chalk.magenta.inverse(
220+
`${NETLIFYDEVLOG} functions folder ${chalk.magenta.inverse(
216221
functionsDir
217222
)} specified in netlify.toml but folder not found, creating it...`
218223
);
219224
fs.mkdirSync(functionsDir);
220225
this.log(
221-
`${NETLIFYDEV} functions folder ${chalk.magenta.inverse(
226+
`${NETLIFYDEVLOG} functions folder ${chalk.magenta.inverse(
222227
functionsDir
223228
)} created`
224229
);
@@ -264,10 +269,10 @@ async function downloadFromURL(flags, args, functionsDir) {
264269
})
265270
);
266271

267-
this.log(`${NETLIFYDEV} Installing dependencies for ${nameToUse}...`);
272+
this.log(`${NETLIFYDEVLOG} Installing dependencies for ${nameToUse}...`);
268273
cp.exec("npm i", { cwd: path.join(functionsDir, nameToUse) }, () => {
269274
this.log(
270-
`${NETLIFYDEV} Installing dependencies for ${nameToUse} complete `
275+
`${NETLIFYDEVLOG} Installing dependencies for ${nameToUse} complete `
271276
);
272277
});
273278

@@ -315,13 +320,15 @@ async function scaffoldFromTemplate(flags, args, functionsDir) {
315320
try {
316321
await downloadFromURL.call(this, flags, args, functionsDir);
317322
} catch (err) {
318-
console.error(`$${NETLIFYERR} Error downloading from URL: ` + flags.url);
323+
console.error(
324+
`$${NETLIFYDEVERR} Error downloading from URL: ` + flags.url
325+
);
319326
console.error(err);
320327
process.exit(1);
321328
}
322329
} else if (chosentemplate === "report") {
323330
console.log(
324-
`${NETLIFYDEV} Open in browser: https://github.com/netlify/netlify-dev-plugin/issues/new`
331+
`${NETLIFYDEVLOG} Open in browser: https://github.com/netlify/netlify-dev-plugin/issues/new`
325332
);
326333
} else {
327334
const {
@@ -339,7 +346,7 @@ async function scaffoldFromTemplate(flags, args, functionsDir) {
339346
}
340347

341348
const name = await getNameFromArgs(args, flags, templateName);
342-
this.log(`${NETLIFYDEV} Creating function ${chalk.cyan.inverse(name)}`);
349+
this.log(`${NETLIFYDEVLOG} Creating function ${chalk.cyan.inverse(name)}`);
343350
const functionPath = ensureFunctionPathIsOk.call(
344351
this,
345352
functionsDir,
@@ -355,7 +362,9 @@ async function scaffoldFromTemplate(flags, args, functionsDir) {
355362
if (err) throw err;
356363
createdFiles.forEach(filePath => {
357364
if (filePath.endsWith(".netlify-function-template.js")) return;
358-
this.log(`${NETLIFYDEV} ${chalk.greenBright("Created")} ${filePath}`);
365+
this.log(
366+
`${NETLIFYDEVLOG} ${chalk.greenBright("Created")} ${filePath}`
367+
);
359368
require("fs").chmodSync(path.resolve(filePath), 0o777);
360369
if (filePath.includes("package.json")) hasPackageJSON = true;
361370
});
@@ -401,13 +410,14 @@ async function installAddons(addons = [], fnPath) {
401410
);
402411
return false;
403412
}
404-
console.log(`${NETLIFYDEV} checking Netlify APIs...`);
413+
console.log(`${NETLIFYDEVLOG} checking Netlify APIs...`);
405414

406415
return api.getSite({ siteId }).then(async siteData => {
407416
const accessToken = api.accessToken;
408417
const arr = addons.map(({ addonName, addonDidInstall }) => {
409418
console.log(
410-
`${NETLIFYDEV} installing addon: ` + chalk.yellow.inverse(addonName)
419+
`${NETLIFYDEVLOG} installing addon: ` +
420+
chalk.yellow.inverse(addonName)
411421
);
412422
// 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
413423
return createSiteAddon(
@@ -436,7 +446,7 @@ async function installAddons(addons = [], fnPath) {
436446
}
437447
})
438448
.catch(err => {
439-
console.error(`${NETLIFYERR} Error installing addon: `, err);
449+
console.error(`${NETLIFYDEVERR} Error installing addon: `, err);
440450
});
441451
});
442452
return Promise.all(arr);
@@ -450,7 +460,7 @@ function ensureFunctionPathIsOk(functionsDir, flags, name) {
450460
const functionPath = path.join(functionsDir, name);
451461
if (fs.existsSync(functionPath)) {
452462
this.log(
453-
`${NETLIFYDEV} Function ${functionPath} already exists, cancelling...`
463+
`${NETLIFYDEVLOG} Function ${functionPath} already exists, cancelling...`
454464
);
455465
process.exit(1);
456466
}

src/commands/functions/serve.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
const { Command, flags } = require("@oclif/command");
2-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
2+
const {
3+
NETLIFYDEV,
4+
NETLIFYDEVLOG,
5+
NETLIFYDEVWARN,
6+
NETLIFYDEVERR
7+
} = require("../../cli-logo");
38

49
class FunctionsServeCommand extends Command {
510
async run() {
6-
this.log(`${NETLIFYDEV} NOT IMPLEMENTED YET: serve a function`);
11+
this.log(`${NETLIFYDEVERR} NOT IMPLEMENTED YET: netlify functions:serve`);
712
}
813
}
914

src/commands/functions/update.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
const { Command, flags } = require("@oclif/command");
22
const chalk = require("chalk");
3-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../../cli-logo");
3+
const {
4+
NETLIFYDEV,
5+
NETLIFYDEVLOG,
6+
NETLIFYDEVWARN,
7+
NETLIFYDEVERR
8+
} = require("../../cli-logo");
49

510
class FunctionsUpdateCommand extends Command {
611
async run() {
7-
this.log(`${NETLIFYDEV} NOT IMPLEMENTED YET: update a function`);
12+
this.log(`${NETLIFYDEVERR} NOT IMPLEMENTED YET: update a function`);
813
}
914
}
1015

src/detect-server.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
const path = require("path");
22
const chalk = require("chalk");
3-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("./cli-logo");
3+
const {
4+
NETLIFYDEV,
5+
NETLIFYDEVLOG,
6+
NETLIFYDEVWARN,
7+
NETLIFYDEVERR
8+
} = require("./cli-logo");
49
const inquirer = require("inquirer");
510
const fs = require("fs");
611
const detectors = fs
@@ -88,7 +93,7 @@ module.exports.serverSettings = async devConfig => {
8893
/** everything below assumes we have settled on one detector */
8994
const tellUser = settingsField => dV =>
9095
console.log(
91-
`${NETLIFYDEV} Overriding ${chalk.yellow(
96+
`${NETLIFYDEVLOG} Overriding ${chalk.yellow(
9297
settingsField
9398
)} with setting derived from netlify.toml [dev] block: `,
9499
dV

src/live-tunnel.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const os = require("os");
44
const path = require("path");
55
const execa = require("execa");
66
const { fetchLatest, updateAvailable } = require("gh-release-fetch");
7-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("./cli-logo");
7+
const { NETLIFYDEVLOG, NETLIFYDEVWARN, NETLIFYDEVERR } = require("./cli-logo");
88

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

2121
const response = await fetch(url, {
@@ -72,7 +72,7 @@ async function installTunnelClient(log) {
7272
return;
7373
}
7474

75-
log(`${NETLIFYDEV} Installing Live Tunnel Client`);
75+
log(`${NETLIFYDEVLOG} Installing Live Tunnel Client`);
7676

7777
const win = isWindows();
7878
const platform = win ? "windows" : process.platform;

src/utils/dev.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// bit of a hasty abstraction but recommended by oclif
33
const { getAddons } = require("netlify/src/addons");
44
const chalk = require("chalk");
5-
const { NETLIFYDEV, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../cli-logo");
5+
const { NETLIFYDEVLOG, NETLIFYDEVWARN, NETLIFYDEVERR } = require("../cli-logo");
66
/**
77
* inject environment variables from netlify addons and buildbot
88
* into your local dev process.env
@@ -38,7 +38,7 @@ async function addEnvVariables(api, site, accessToken) {
3838
for (const key in addon.env) {
3939
const msg = () =>
4040
console.log(
41-
`${NETLIFYDEV} Injected ${chalk.yellow.bold("addon")} env var: `,
41+
`${NETLIFYDEVLOG} Injected ${chalk.yellow.bold("addon")} env var: `,
4242
chalk.yellow(key)
4343
);
4444
process.env[key] = assignLoudly(process.env[key], addon.env[key], msg);
@@ -77,7 +77,7 @@ async function addEnvVariables(api, site, accessToken) {
7777
for (const key in apiSite.build_settings.env) {
7878
const msg = () =>
7979
console.log(
80-
`${NETLIFYDEV} Injected ${chalk.blue.bold(
80+
`${NETLIFYDEVLOG} Injected ${chalk.blue.bold(
8181
"build setting"
8282
)} env var: `,
8383
chalk.yellow(key)

0 commit comments

Comments
 (0)