Skip to content

Commit

Permalink
fix: add bold to the Deprecated warning title
Browse files Browse the repository at this point in the history
  • Loading branch information
petebacondarwin committed May 4, 2022
1 parent 8134bdc commit 34a374f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-ducks-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: add bold to the `Deprecated` warning title
28 changes: 14 additions & 14 deletions packages/wrangler/src/__tests__/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe("normalizeAndValidateConfig()", () => {
expect(diagnostics.hasErrors()).toBe(false);
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- 😶 Ignored: \\"miniflare\\":
- [1m😶 Ignored[22m: \\"miniflare\\":
Wrangler does not use configuration in the \`miniflare\` section. Unless you are using Miniflare directly you can remove this section."
`);
});
Expand Down Expand Up @@ -250,7 +250,7 @@ describe("normalizeAndValidateConfig()", () => {
expect(normalizeSlashes(diagnostics.renderWarnings()))
.toMatchInlineSnapshot(`
"Processing wrangler configuration:
- Deprecation: \\"site.entry-point\\":
- [1mDeprecation[22m: \\"site.entry-point\\":
Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
\`\`\`
main = \\"my-site/index.js\\"
Expand Down Expand Up @@ -281,7 +281,7 @@ describe("normalizeAndValidateConfig()", () => {
expect(normalizeSlashes(diagnostics.renderWarnings()))
.toMatchInlineSnapshot(`
"Processing wrangler configuration:
- Deprecation: \\"site.entry-point\\":
- [1mDeprecation[22m: \\"site.entry-point\\":
Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
\`\`\`
main = \\"workers-site/index.js\\"
Expand Down Expand Up @@ -324,7 +324,7 @@ describe("normalizeAndValidateConfig()", () => {
expect(normalizeSlashes(diagnostics.renderWarnings()))
.toMatchInlineSnapshot(`
"Processing wrangler configuration:
- Deprecation: \\"site.entry-point\\":
- [1mDeprecation[22m: \\"site.entry-point\\":
Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
\`\`\`
main = \\"111/index.js\\"
Expand Down Expand Up @@ -358,7 +358,7 @@ describe("normalizeAndValidateConfig()", () => {
expect(normalizeSlashes(diagnostics.renderWarnings()))
.toMatchInlineSnapshot(`
"Processing wrangler configuration:
- Deprecation: \\"site.entry-point\\":
- [1mDeprecation[22m: \\"site.entry-point\\":
Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
\`\`\`
main = \\"some/other/script.js\\"
Expand Down Expand Up @@ -571,9 +571,9 @@ describe("normalizeAndValidateConfig()", () => {
expect(diagnostics.hasWarnings()).toBe(true);
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- 😶 Ignored: \\"type\\":
- [1m😶 Ignored[22m: \\"type\\":
Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build.
- 😶 Ignored: \\"webpack_config\\":
- [1m😶 Ignored[22m: \\"webpack_config\\":
Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build."
`);
});
Expand Down Expand Up @@ -869,15 +869,15 @@ describe("normalizeAndValidateConfig()", () => {
expect(normalizePath(diagnostics.renderWarnings()))
.toMatchInlineSnapshot(`
"Processing project/wrangler.toml configuration:
- Deprecation: \\"build.upload.format\\":
- [1mDeprecation[22m: \\"build.upload.format\\":
The format is inferred automatically from the code.
- Deprecation: \\"build.upload.main\\":
- [1mDeprecation[22m: \\"build.upload.main\\":
Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
Then add the top level \`main\` field to your configuration file:
\`\`\`
main = \\"src/index.ts\\"
\`\`\`
- Deprecation: \\"build.upload.dir\\":
- [1mDeprecation[22m: \\"build.upload.dir\\":
Use the top level \\"main\\" field or a command-line argument to specify the entry-point for the Worker.
- Deprecation: The \`build.upload.rules\` config field is no longer used, the rules should be specified via the \`rules\` config field. Delete the \`build.upload\` field from the configuration file, and add this:
\`\`\`
Expand Down Expand Up @@ -1619,9 +1619,9 @@ describe("normalizeAndValidateConfig()", () => {
expect(diagnostics.hasWarnings()).toBe(true);
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- Deprecation: \\"zone_id\\":
- [1mDeprecation[22m: \\"zone_id\\":
This is unnecessary since we can deduce this from routes directly.
- Deprecation: \\"experimental_services\\":
- [1mDeprecation[22m: \\"experimental_services\\":
The \\"experimental_services\\" field is no longer supported. Instead, use [[unsafe.bindings]] to enable experimental features. Add this to your wrangler.toml:
\`\`\`
[[unsafe.bindings]]
Expand Down Expand Up @@ -2866,9 +2866,9 @@ describe("normalizeAndValidateConfig()", () => {
"Processing wrangler configuration:
- \\"env.ENV1\\" environment configuration
- Deprecation: \\"zone_id\\":
- [1mDeprecation[22m: \\"zone_id\\":
This is unnecessary since we can deduce this from routes directly.
- Deprecation: \\"experimental_services\\":
- [1mDeprecation[22m: \\"experimental_services\\":
The \\"experimental_services\\" field is no longer supported. Instead, use [[unsafe.bindings]] to enable experimental features. Add this to your wrangler.toml:
\`\`\`
[[unsafe.bindings]]
Expand Down
10 changes: 5 additions & 5 deletions packages/wrangler/src/__tests__/publish.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ describe("publish", () => {
expect(std.warn).toMatchInlineSnapshot(`
"▲ [WARNING] Processing wrangler.toml configuration:
- Deprecation: \\"build.upload.main\\":
- [1mDeprecation[22m: \\"build.upload.main\\":
Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
Then add the top level \`main\` field to your configuration file:
\`\`\`
Expand Down Expand Up @@ -618,13 +618,13 @@ describe("publish", () => {
expect(std.warn).toMatchInlineSnapshot(`
"▲ [WARNING] Processing ../wrangler.toml configuration:
- Deprecation: \\"build.upload.main\\":
- [1mDeprecation[22m: \\"build.upload.main\\":
Delete the \`build.upload.main\` and \`build.upload.dir\` fields.
Then add the top level \`main\` field to your configuration file:
\`\`\`
main = \\"foo/index.js\\"
\`\`\`
- Deprecation: \\"build.upload.dir\\":
- [1mDeprecation[22m: \\"build.upload.dir\\":
Use the top level \\"main\\" field or a command-line argument to specify the entry-point for the
Worker.
Expand Down Expand Up @@ -828,7 +828,7 @@ export default{
test-name.test-sub-domain.workers.dev",
"warn": "▲ [WARNING] Processing wrangler.toml configuration:
- Deprecation: \\"site.entry-point\\":
- [1mDeprecation[22m: \\"site.entry-point\\":
Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration
file:
\`\`\`
Expand Down Expand Up @@ -882,7 +882,7 @@ export default{
expect(normalizeSlashes(std.warn)).toMatchInlineSnapshot(`
"▲ [WARNING] Processing my-site/wrangler.toml configuration:
- Deprecation: \\"site.entry-point\\":
- [1mDeprecation[22m: \\"site.entry-point\\":
Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration
file:
\`\`\`
Expand Down
3 changes: 2 additions & 1 deletion packages/wrangler/src/config/validation-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import chalk from "chalk";
import type { RawConfig } from "./config";
import type { Diagnostics } from "./diagnostics";
import type { Environment, RawEnvironment } from "./environment";
Expand All @@ -17,7 +18,7 @@ export function deprecated<T extends object>(
title = "Deprecation",
type: "warning" | "error" = "warning"
): void {
const diagnosticMessage = `${title}: "${fieldPath}":\n${message}`;
const diagnosticMessage = `${chalk.bold(title)}: "${fieldPath}":\n${message}`;
const result = unwindPropertyPath(config, fieldPath);
if (result !== undefined && result.field in result.container) {
diagnostics[`${type}s`].push(diagnosticMessage);
Expand Down

0 comments on commit 34a374f

Please sign in to comment.