Skip to content

chore: fix link issue; improve env links/assets #1

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 1 commit into from
Jun 5, 2025
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
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ SYNC_LIFECYCLE_DOCS=
GITHUB_TOKEN=
UI_BRANCH=main
CORE_BRANCH=main
LC_DOCS_PUBLISH=
LC_DOCS_PUBLISH=
NEXT_PUBLIC_DEV_ENV=local
DEV_ENV=local
16 changes: 0 additions & 16 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/**
* Copyright 2025 GoodRx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/// <reference types="next" />
/// <reference types="next/image-types/global" />

Expand Down
6 changes: 4 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

import nextra from "nextra";
import { remarkCodeHike, recmaCodeHike } from "codehike/mdx";
// eslint-disable-next-line no-undef
const isLocal = process.env?.NEXT_PUBLIC_DEV_ENV === 'local';

/** @type {import('codehike/mdx').CodeHikeConfig} */
export const chConfig = {
Expand Down Expand Up @@ -45,8 +47,8 @@ const nextConfig = {
output: 'export',
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx", "css"],
reactStrictMode: true,
assetPrefix: '/lifecycle-docs',
basePath: '/lifecycle-docs',
assetPrefix: !isLocal ? '/lifecycle-docs' : '',
basePath: !isLocal ? '/lifecycle-docs' : '',
eslint: {
dirs: ["src"],
ignoreDuringBuilds: true,
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateJsonSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const octokit = new Octokit({ auth });
export const fetchFileFromRepo = async ({
owner = "goodrxoss",
repo = "lifecycle",
path = "docs/schema/yaml/2.3.0.yaml",
path = "docs/schema/yaml/1.0.0.yaml",
branch = "main",
debug = false,
}: FetchFileOptions): Promise<string> => {
Expand Down Expand Up @@ -87,7 +87,7 @@ export const syncYamlFile = async (options: SyncOptions) => {
owner = "goodrxoss",
repo = "lifecycle",
// docs/schema/yaml/2.3.0.yaml
path = "docs/schema/yaml/2.3.0.yaml",
path = "docs/schema/yaml/1.0.0.yaml",
dest = "src/lib/data/lifecycle-schema",
name = "lifecycle",
debug = false,
Expand Down
23 changes: 22 additions & 1 deletion scripts/generateMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ import { join } from "node:path";
import matter from "gray-matter";
import { Command } from "commander";

const year = new Date().getFullYear();
const licenseString = `/**
* Copyright ${year} GoodRx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
`;

const program = new Command();

export async function generateMetaFiles(directoryPath, isDebugging) {
Expand Down Expand Up @@ -66,8 +84,11 @@ export async function generateMetaFiles(directoryPath, isDebugging) {
const mergedMetaData = { ...existingMetaData, ...metaData };
if (isDebugging)
console.log("merged data", { existingMetaData, metaData, mergedMetaData });

const metaContent = `export default ${JSON.stringify(mergedMetaData, null, 2)};`;
writeFileSync(metaFilePath, metaContent);
const content = licenseString + "\n" + metaContent;

writeFileSync(metaFilePath, content);
}

program
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Main = () => {
<div className="my-6 flex justify-center md:mb-0 md:justify-end">
<Link
className={`${buttonVariants()} col-span-1 col-end-3`}
href="/docs/getting-started"
href="/docs/getting-started/create-environment"
>
Get Started
</Link>
Expand Down
9 changes: 6 additions & 3 deletions src/components/image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ export const DefinedImage = ({
alt = "",
width = 800,
height = 500,
}: DefinedImageProps) =>
width && height ? (
}: DefinedImageProps) => {
const isLocal = process.env.NEXT_PUBLIC_DEV_ENV === "local";
const currentSrc = !isLocal ? `/lifecycle-docs${src}` : src;
return width && height ? (
<Image
src={`/lifecycle-docs${src}`}
src={currentSrc}
className="absolute inset-0 h-full w-full"
alt={alt}
width={width}
Expand All @@ -63,6 +65,7 @@ export const DefinedImage = ({
) : (
<img src={src} className="absolute inset-0 h-full w-full" alt={alt} />
);
};

export default dynamic(() => Promise.resolve(LifecycleDocsImg), {
loading: () => <Loader />,
Expand Down