Skip to content

Commit

Permalink
V0.3.3 (#57)
Browse files Browse the repository at this point in the history
* 🎨 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
damien-schneider authored Nov 23, 2024
1 parent 9d41a92 commit ccf7884
Show file tree
Hide file tree
Showing 27 changed files with 1,664 additions and 1,529 deletions.
38 changes: 0 additions & 38 deletions apps/website/__tests__/sidemenu.test.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"private": false,
"publisher": "Damien Schneider",
"scripts": {
"build": "next build",
"build": "pnpm pre-build && next build",
"pre-build": "pnpm scripts/generate-latest-changelog-date.mjs && pnpm scripts/generate-package-list-check.mjs",
"dev": "next dev --turbo",
"start": "next start",
"format:check": "biome format --check ./src",
Expand Down
34 changes: 34 additions & 0 deletions apps/website/scripts/generate-latest-changelog-date.mjs
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}`);
71 changes: 0 additions & 71 deletions apps/website/scripts/generate-package-list-check.js

This file was deleted.

85 changes: 85 additions & 0 deletions apps/website/scripts/generate-package-list-check.mjs
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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function CategoryLayout({ children, params }: Props) {
/>
<meta content="all" name="robots" />
</Head>
<h1 className="bg-gradient-to-br from-sky-400 via-violet-500 to-orange-400 bg-clip-text font-medium text-transparent text-5xl inline tracking-tighter">
<h1 className="bg-gradient-to-b from-black to-black/40 dark:from-white dark:to-white/10 bg-clip-text font-medium text-transparent text-3xl sm:text-5xl inline tracking-tighter">
{category.name} components
</h1>
{children}
Expand Down
Loading

0 comments on commit ccf7884

Please sign in to comment.