diff --git a/.env.example b/.env.example index 6694e32..9011070 100644 --- a/.env.example +++ b/.env.example @@ -2,4 +2,6 @@ SYNC_LIFECYCLE_DOCS= GITHUB_TOKEN= UI_BRANCH=main CORE_BRANCH=main -LC_DOCS_PUBLISH= \ No newline at end of file +LC_DOCS_PUBLISH= +NEXT_PUBLIC_DEV_ENV=local +DEV_ENV=local diff --git a/next-env.d.ts b/next-env.d.ts index db94a6f..52e831b 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -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. - */ - /// /// diff --git a/next.config.mjs b/next.config.mjs index 2f23364..6887baa 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -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 = { @@ -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, diff --git a/scripts/generateJsonSchema.ts b/scripts/generateJsonSchema.ts index e88a5c7..831e01f 100755 --- a/scripts/generateJsonSchema.ts +++ b/scripts/generateJsonSchema.ts @@ -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 => { @@ -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, diff --git a/scripts/generateMeta.ts b/scripts/generateMeta.ts index 2b113ac..0f8b35d 100755 --- a/scripts/generateMeta.ts +++ b/scripts/generateMeta.ts @@ -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) { @@ -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 diff --git a/src/components/home/main/index.tsx b/src/components/home/main/index.tsx index eb81388..1bf96ff 100644 --- a/src/components/home/main/index.tsx +++ b/src/components/home/main/index.tsx @@ -38,7 +38,7 @@ export const Main = () => {
Get Started diff --git a/src/components/image/index.tsx b/src/components/image/index.tsx index 7ad999f..7a82c99 100644 --- a/src/components/image/index.tsx +++ b/src/components/image/index.tsx @@ -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 ? ( {alt} ); +}; export default dynamic(() => Promise.resolve(LifecycleDocsImg), { loading: () => ,