-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🎨 unify component type * 🔥 remove dupplicated lib files * 🔥 remove lastUpdatedDateComponent from multiple categories * ✨ v0.3.2 * 🎨 update slugPreviewFile format in gradientPricingTableComponent * 💄 update header and category title styles for improved readability * 🎨 update component type definitions to allow function components and enhance rendering logic * ✨ add functionality to retrieve the latest changelog date and update info menu to indicate new changes * 🚚 move back the biome config at root * ✨ add sticky footer components * 🎨 rename QR code generator component file and update imports for consistency * 📝 add latest changelog * 🔥 remove sidemenu useless test file * 📦 update pnpm-lock * 🎨 refactor GithubStarsButton component for improved readability and consistency * 🚧 disable changelog date logic in InfoMenuList component * 🚚 remove getLatestChangelogDate function and related logic from InfoMenuList component * 🎨 refactor InfoMenuList component to streamline changelog date logic * 🎨 add "use server" directive to InfoMenuList component * 🎨 add script to generate last changelog date and update InfoMenuList component to use it
- Loading branch information
1 parent
9d41a92
commit ccf7884
Showing
27 changed files
with
1,664 additions
and
1,529 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env node | ||
// chmod +x scripts/generate-latest-changelog-date.js | ||
|
||
import { parseISO } from "date-fns"; | ||
import { promises as fs } from "node:fs"; | ||
import path from "node:path"; | ||
|
||
const changelogDir = path.join(process.cwd(), "src/changelogs"); | ||
const filenames = await fs.readdir(changelogDir); | ||
|
||
let latestChangelogDate = new Date(0); | ||
|
||
for (const file of filenames) { | ||
const filenameWithoutExtension = file.replace(/\.mdx$/, ""); | ||
const isoDate = parseISO(filenameWithoutExtension); | ||
if (isoDate > latestChangelogDate) { | ||
latestChangelogDate = isoDate; | ||
} | ||
} | ||
|
||
// Define the output path for the last-changelog-date.ts file | ||
const outputPath = path.join( | ||
process.cwd(), | ||
"src/changelogs/last-changelog-date.ts", | ||
); | ||
|
||
// Prepare the content to be written to the file | ||
const content = `// This file is generated by the generate-latest-changelog-date script | ||
export const lastChangelogDate = new Date("${latestChangelogDate.toISOString()}");\n`; | ||
|
||
// Write the content to the last-changelog-date.ts file | ||
await fs.writeFile(outputPath, content); | ||
|
||
console.log(`Last changelog date exported to ${outputPath}`); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/env node | ||
// chmod +x scripts/generate-package-list-check.js | ||
|
||
import fs from "node:fs"; | ||
import path from "node:path"; | ||
|
||
// Define the paths to package.json files | ||
const packageJsonPath = path.resolve(process.cwd(), "package.json"); | ||
const cuicuiPackageJsonPath = path.resolve( | ||
process.cwd(), | ||
"../../packages/ui/package.json", | ||
); | ||
|
||
// Define the output TypeScript file path inside ./src/lib/ | ||
const outputDirectory = path.resolve(process.cwd(), "src", "lib"); | ||
const outputTsPath = path.join( | ||
outputDirectory, | ||
"generated-package-check-list-to-install.ts", | ||
); | ||
|
||
const importStatement = `import type { PackageToInstallType } from "#/src/components/steps-to-install/packages";\n`; | ||
const commentStatement = | ||
"// This is an automatically generated file with the ./scripts/generate-package-list-check.ts script\n"; | ||
|
||
// biome-ignore lint/style/noUnusedTemplateLiteral: <We need template literals in the final file> | ||
const exportStatementStart = `export const packageCheckListToInstall: PackageToInstallType[] = [`; | ||
|
||
// biome-ignore lint/style/noUnusedTemplateLiteral: <We need template literals in the final file> | ||
const exportStatementEnd = `];\n`; | ||
|
||
// Function to escape double quotes in strings | ||
const escapeDoubleQuotes = (str) => str.replace(/"/g, '\\"'); | ||
|
||
try { | ||
// Ensure the output directory exists; if not, create it | ||
if (!fs.existsSync(outputDirectory)) { | ||
fs.mkdirSync(outputDirectory, { recursive: true }); | ||
} | ||
|
||
// Read and parse main package.json | ||
const packageJsonData = fs.readFileSync(packageJsonPath, "utf-8"); | ||
const packageJson = JSON.parse(packageJsonData); | ||
|
||
// Read and parse cuicui ui package.json | ||
const cuicuiPackageJsonData = fs.readFileSync(cuicuiPackageJsonPath, "utf-8"); | ||
const cuicuiPackageJson = JSON.parse(cuicuiPackageJsonData); | ||
|
||
// Extract dependencies and devDependencies from main package.json | ||
const dependencies = packageJson.dependencies || {}; | ||
const devDependencies = packageJson.devDependencies || {}; | ||
|
||
// Extract dependencies and devDependencies from cuicui ui package.json | ||
const cuicuiDependencies = cuicuiPackageJson.dependencies || {}; | ||
const cuicuiDevDependencies = cuicuiPackageJson.devDependencies || {}; | ||
|
||
// Combine all dependencies and devDependencies from both package.json files | ||
const allPackages = { | ||
...dependencies, | ||
...devDependencies, | ||
...cuicuiDependencies, | ||
...cuicuiDevDependencies, | ||
}; | ||
|
||
// Generate the checklist array as TypeScript objects | ||
const packageCheckListToInstall = Object.keys(allPackages).map((pkg) => { | ||
return ` { | ||
find: [\`from "${escapeDoubleQuotes(pkg)}"\`], | ||
packageName: "${pkg}", | ||
},`; | ||
}); | ||
|
||
// Combine all parts to form the complete TypeScript file content | ||
const tsFileContent = [ | ||
commentStatement, | ||
importStatement, | ||
exportStatementStart, | ||
...packageCheckListToInstall, | ||
exportStatementEnd, | ||
].join("\n"); | ||
|
||
// Write the TypeScript file | ||
fs.writeFileSync(outputTsPath, tsFileContent, "utf-8"); | ||
} catch (_error) { | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.