Skip to content

365: Deprecate evidently #366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 17, 2024
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: 0 additions & 13 deletions app/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,3 @@

# If you deploy to a subpath, change this to the subpath so relative paths work correctly.
NEXT_PUBLIC_BASE_PATH=

# =====================================================
# AWS Evidently feature flagging service
# =====================================================
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
FEATURE_FLAGS_PROJECT=
AWS_REGION=

# When FEATURE_FLAGS_PROJECT isn't set, a mock feature flagging service is used.
# You can mock a feature flag's value by setting it here, using an env var name
# format like NEXT_PUBLIC_FEATURE_<feature_name>=<true|false>
# NEXT_PUBLIC_FEATURE_foo=true
1 change: 0 additions & 1 deletion app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ Optionally, configure your code editor to auto run these tools on file save. Mos
## Other topics

- [Internationalization](../docs/app/internationalization.md)
- [Feature flags](../docs/app/feature-flags.md)
- [Security](../docs/app/security.md)
- [Image optimization](../docs/app/image-optimization.md)
- Refer to the [architecture decision records](../docs/decisions) for more context on technical decisions.
2,072 changes: 3 additions & 2,069 deletions app/package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"ts:check": "tsc --noEmit"
},
"dependencies": {
"@aws-sdk/client-evidently": "^3.465.0",
"@trussworks/react-uswds": "^7.0.0",
"@uswds/uswds": "3.8.1",
"lodash": "^4.17.21",
Expand Down
50 changes: 0 additions & 50 deletions app/src/adapters/feature-flags/EvidentlyAdapter.test.ts

This file was deleted.

57 changes: 0 additions & 57 deletions app/src/adapters/feature-flags/EvidentlyAdapter.ts

This file was deleted.

38 changes: 0 additions & 38 deletions app/src/adapters/feature-flags/MockAdapter.test.ts

This file was deleted.

23 changes: 0 additions & 23 deletions app/src/adapters/feature-flags/MockAdapter.ts

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/adapters/feature-flags/index.ts

This file was deleted.

7 changes: 0 additions & 7 deletions app/src/adapters/feature-flags/setup.ts

This file was deleted.

3 changes: 0 additions & 3 deletions app/src/adapters/feature-flags/types.ts

This file was deleted.

49 changes: 3 additions & 46 deletions app/src/app/[locale]/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,13 @@
import { axe } from "jest-axe";
import { cleanup, render, screen } from "tests/react-utils";
import { mockFeatureFlag } from "tests/server-utils";
import { render, screen } from "tests/react-utils";

import Controller from "./page";
import { View } from "./view";

describe("Index - Controller", () => {
describe("local feature flags", () => {
it("renders correctly based on local feature flag is unset", async () => {
const result = await Controller();
render(result);

expect(await screen.findByText(/flag is disabled/i)).toBeInTheDocument();
});

it("renders correctly based on local feature flag is true", async () => {
mockFeatureFlag("foo", true);

const result = await Controller();
render(result);

expect(await screen.findByText(/flag is enabled/i)).toBeInTheDocument();
});

it("renders correctly based on local feature flag is false", async () => {
mockFeatureFlag("foo", false);

const result = await Controller();
render(result);

expect(await screen.findByText(/flag is disabled/i)).toBeInTheDocument();
});
});
});

describe("Index - View", () => {
// Demonstration of rendering translated text, and asserting the presence of a dynamic value.
// You can delete this test for your own project.
it("renders link to Next.js docs", () => {
render(<View isFooEnabled={false} />);
render(<View />);

const link = screen.getByRole("link", { name: /next\.js/i });

Expand All @@ -48,21 +17,9 @@ describe("Index - View", () => {
});

it("passes accessibility scan", async () => {
const { container } = render(<View isFooEnabled={false} />);
const { container } = render(<View />);
const results = await axe(container);

expect(results).toHaveNoViolations();
});

it("conditionally displays content based on feature flag values", () => {
const enabledFlagTextMatcher = /Flag is enabled/;

render(<View isFooEnabled />);
expect(screen.getByText(enabledFlagTextMatcher)).toBeInTheDocument();

cleanup();

render(<View isFooEnabled={false} />);
expect(screen.queryByText(enabledFlagTextMatcher)).not.toBeInTheDocument();
});
});
7 changes: 2 additions & 5 deletions app/src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Metadata } from "next";
import { isFeatureEnabled } from "src/adapters/feature-flags";

import { getTranslations } from "next-intl/server";

Expand All @@ -18,8 +17,6 @@ export async function generateMetadata({ params }: { params: RouteParams }) {
return meta;
}

export default async function Controller() {
const isFooEnabled = await isFeatureEnabled("foo", "anonymous");

return <View isFooEnabled={isFooEnabled} />;
export default function Controller() {
return <View />;
}
7 changes: 1 addition & 6 deletions app/src/app/[locale]/view.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useTranslations } from "next-intl";

export function View(props: { isFooEnabled: boolean }) {
const { isFooEnabled } = props;
export function View() {
const t = useTranslations("home");

return (
Expand Down Expand Up @@ -29,10 +28,6 @@ export function View(props: { isFooEnabled: boolean }) {
isoDate: new Date("2023-11-29T23:30:00.000Z"),
})}
</p>

{/* Demonstration of feature flagging */}
<p>{t("feature_flagging")}</p>
<p>{isFooEnabled ? t("flag_on") : t("flag_off")}</p>
</div>
</>
);
Expand Down
4 changes: 0 additions & 4 deletions app/src/i18n/messages/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ export const messages = {
intro:
"This is a template for a React web application using the <LinkToNextJs>Next.js framework</LinkToNextJs>.",
body: "This is template includes:<ul><li>Framework for server-side rendered, static, or hybrid React applications</li><li>TypeScript and React testing tools</li><li>U.S. Web Design System for themeable styling and a set of common components</li><li>Type checking, linting, and code formatting tools</li><li>Storybook for a frontend workshop environment</li></ul>",
feature_flagging:
"The template includes AWS Evidently for feature flagging. Toggle flag to see the content below change:",
flag_off: "Flag is disabled",
flag_on: "Flag is enabled",
formatting:
"The template includes an internationalization library with basic formatters built-in. Such as numbers: { amount, number, currency }, and dates: { isoDate, date, long}.",
},
Expand Down
3 changes: 0 additions & 3 deletions app/tests/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ import "@testing-library/jest-dom";
import { toHaveNoViolations } from "jest-axe";

expect.extend(toHaveNoViolations);

// Use the mock feature flag adapter for all tests
process.env.FEATURE_FLAGS_PROJECT = "";
3 changes: 0 additions & 3 deletions app/tests/server-utils.ts

This file was deleted.

Loading
Loading