|
1
|
/* eslint-disable no-console */ |
|
2
|
import { |
|
3
|
generateEditedDates, |
|
4
|
generateSidebar, |
|
5
|
generateSitemapUrls, |
|
6
|
copyMdxToPublic, |
|
7
|
} from "build-scripts" |
|
8
|
import { sidebar } from "../sidebar.mjs" |
|
9
|
import path from "path" |
|
10
|
import { copyFileSync } from "fs" |
|
11
|
import { execSync } from "child_process" |
|
12
|
import { fileURLToPath } from "url" |
|
13
|
import { generateSpecsIndex } from "./generate-specs-index.mjs" |
|
14
|
|
|
15
|
async function main() { |
|
16
|
generateSpecsIndex() |
|
17
|
await generateSidebar(sidebar) |
|
18
|
await generateEditedDates() |
|
19
|
await generateSitemapUrls() |
|
20
|
if (process.env.CLOUDFLARE_ENV) { |
|
21
|
await copyMdxToPublic({ |
|
22
|
srcDir: path.join(process.cwd(), "app"), |
|
23
|
destDir: path.join(process.cwd(), "public", "raw-mdx"), |
|
24
|
}) |
|
25
|
} |
|
26
|
|
|
27
|
// copy colors from the `@medusajs/ui-preset` package |
|
28
|
const resolvedURL = import.meta.resolve("@medusajs/ui-preset") |
|
29
|
const resolvedPath = fileURLToPath(resolvedURL) |
|
30
|
const originalPath = path.join( |
|
31
|
resolvedPath, |
|
32
|
"../..", |
|
33
|
"src/theme/tokens/colors.ts" |
|
34
|
) |
|
35
|
const newPath = path.resolve("config", "colors.ts") |
|
36
|
|
|
37
|
console.info(`Copying file from ${originalPath} to ${newPath}...`) |
|
38
|
|
|
39
|
copyFileSync(originalPath, newPath) |
|
40
|
|
|
41
|
console.info(`File copied successfully`) |
|
42
|
|
|
43
|
// fix possible eslint errors to avoid build errors |
|
44
|
console.info("Running ESLint...") |
|
45
|
|
|
46
|
execSync(`npx eslint ${newPath} --fix`) |
|
47
|
|
|
48
|
console.info("Finished ESLint process") |
|
49
|
} |
|
50
|
|
|
51
|
void main() |