Skip to content

Commit 8e79230

Browse files
committed
chore: fix link issue; improve env links/assets
1 parent 5c4dde0 commit 8e79230

File tree

16 files changed

+66
-44
lines changed

16 files changed

+66
-44
lines changed

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ SYNC_LIFECYCLE_DOCS=
22
GITHUB_TOKEN=
33
UI_BRANCH=main
44
CORE_BRANCH=main
5-
LC_DOCS_PUBLISH=
5+
LC_DOCS_PUBLISH=
6+
NEXT_PUBLIC_DEV_ENV=local
7+
DEV_ENV=local

next-env.d.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/**
2-
* Copyright 2025 GoodRx, Inc.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
171
/// <reference types="next" />
182
/// <reference types="next/image-types/global" />
193

next.config.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

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

2022
/** @type {import('codehike/mdx').CodeHikeConfig} */
2123
export const chConfig = {
@@ -45,8 +47,8 @@ const nextConfig = {
4547
output: 'export',
4648
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx", "css"],
4749
reactStrictMode: true,
48-
assetPrefix: '/lifecycle-docs',
49-
basePath: '/lifecycle-docs',
50+
assetPrefix: !isLocal ? '/lifecycle-docs' : '',
51+
basePath: !isLocal ? '/lifecycle-docs' : '',
5052
eslint: {
5153
dirs: ["src"],
5254
ignoreDuringBuilds: true,

scripts/generateJsonSchema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const octokit = new Octokit({ auth });
3535
export const fetchFileFromRepo = async ({
3636
owner = "goodrxoss",
3737
repo = "lifecycle",
38-
path = "docs/schema/yaml/2.3.0.yaml",
38+
path = "docs/schema/yaml/1.0.0.yaml",
3939
branch = "main",
4040
debug = false,
4141
}: FetchFileOptions): Promise<string> => {
@@ -87,7 +87,7 @@ export const syncYamlFile = async (options: SyncOptions) => {
8787
owner = "goodrxoss",
8888
repo = "lifecycle",
8989
// docs/schema/yaml/2.3.0.yaml
90-
path = "docs/schema/yaml/2.3.0.yaml",
90+
path = "docs/schema/yaml/1.0.0.yaml",
9191
dest = "src/lib/data/lifecycle-schema",
9292
name = "lifecycle",
9393
debug = false,

scripts/generateMeta.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ import { join } from "node:path";
2525
import matter from "gray-matter";
2626
import { Command } from "commander";
2727

28+
const year = new Date().getFullYear();
29+
const licenseString = `/*!
30+
* @license
31+
* Copyright ${year} GoodRx, Inc.
32+
*
33+
* Licensed under the Apache License, Version 2.0 (the "License");
34+
* you may not use this file except in compliance with the License.
35+
* You may obtain a copy of the License at
36+
*
37+
* http://www.apache.org/licenses/LICENSE-2.0
38+
*
39+
* Unless required by applicable law or agreed to in writing, software
40+
* distributed under the License is distributed on an "AS IS" BASIS,
41+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42+
* See the License for the specific language governing permissions and
43+
* limitations under the License.
44+
*/
45+
`;
46+
2847
const program = new Command();
2948

3049
export async function generateMetaFiles(directoryPath, isDebugging) {
@@ -66,8 +85,11 @@ export async function generateMetaFiles(directoryPath, isDebugging) {
6685
const mergedMetaData = { ...existingMetaData, ...metaData };
6786
if (isDebugging)
6887
console.log("merged data", { existingMetaData, metaData, mergedMetaData });
88+
6989
const metaContent = `export default ${JSON.stringify(mergedMetaData, null, 2)};`;
70-
writeFileSync(metaFilePath, metaContent);
90+
const content = licenseString + "\n" + metaContent + "\n";
91+
92+
writeFileSync(metaFilePath, content);
7193
}
7294

7395
program

src/components/home/main/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const Main = () => {
3838
<div className="my-6 flex justify-center md:mb-0 md:justify-end">
3939
<Link
4040
className={`${buttonVariants()} col-span-1 col-end-3`}
41-
href="/docs/getting-started"
41+
href="/docs/getting-started/create-environment"
4242
>
4343
Get Started
4444
</Link>

src/components/image/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ export const DefinedImage = ({
5151
alt = "",
5252
width = 800,
5353
height = 500,
54-
}: DefinedImageProps) =>
55-
width && height ? (
54+
}: DefinedImageProps) => {
55+
const isLocal = process.env.NEXT_PUBLIC_DEV_ENV === "local";
56+
const currentSrc = !isLocal ? `/lifecycle-docs${src}` : src;
57+
return width && height ? (
5658
<Image
57-
src={`/lifecycle-docs${src}`}
59+
src={currentSrc}
5860
className="absolute inset-0 h-full w-full"
5961
alt={alt}
6062
width={width}
@@ -63,6 +65,7 @@ export const DefinedImage = ({
6365
) : (
6466
<img src={src} className="absolute inset-0 h-full w-full" alt={alt} />
6567
);
68+
};
6669

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

src/pages/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,4 +38,4 @@ export default {
3738
"title": "Tags",
3839
"type": "page"
3940
}
40-
};
41+
};

src/pages/articles/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,4 +19,4 @@ export default {
1819
"introduction": {
1920
"title": "Introducing Lifecycle"
2021
}
21-
};
22+
};

src/pages/docs/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -48,4 +49,4 @@ export default {
4849
"----": {
4950
"type": "separator"
5051
}
51-
};
52+
};

src/pages/docs/features/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,4 +28,4 @@ export default {
2728
"service-dependencies": {
2829
"title": "Service Dependencies"
2930
}
30-
};
31+
};

src/pages/docs/getting-started/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,4 +34,4 @@ export default {
3334
"terminology": {
3435
"title": "Terminology"
3536
}
36-
};
37+
};

src/pages/docs/schema/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,4 +22,4 @@ export default {
2122
"full": {
2223
"title": "All at once"
2324
}
24-
};
25+
};

src/pages/docs/setup/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,4 +31,4 @@ export default {
3031
"configure-lifecycle": {
3132
"title": "Additional Configuration"
3233
}
33-
};
34+
};

src/pages/docs/tips/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,4 +22,4 @@ export default {
2122
"telemetry": {
2223
"title": "Telemetry"
2324
}
24-
};
25+
};

src/pages/docs/troubleshooting/_meta.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/**
1+
/*!
2+
* @license
23
* Copyright 2025 GoodRx, Inc.
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,4 +25,4 @@ export default {
2425
"github-app-webhooks": {
2526
"title": "Missing PR comment"
2627
}
27-
};
28+
};

0 commit comments

Comments
 (0)