@reallukemanning/folio 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/copy-components.js +31 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/core/copy-components.js.html +178 -0
- package/coverage/core/eslint.config.js.html +184 -0
- package/coverage/core/index.html +146 -0
- package/coverage/core/src/__tests__/benchmarks/ProjectCard.bench.tsx.html +364 -0
- package/coverage/core/src/__tests__/benchmarks/ProjectView.bench.tsx.html +484 -0
- package/coverage/core/src/__tests__/benchmarks/github.bench.ts.html +244 -0
- package/coverage/core/src/__tests__/benchmarks/index.html +191 -0
- package/coverage/core/src/__tests__/benchmarks/npm.bench.ts.html +271 -0
- package/coverage/core/src/__tests__/benchmarks/product-hunt.bench.ts.html +259 -0
- package/coverage/core/src/__tests__/benchmarks/utilities.bench.ts.html +478 -0
- package/coverage/core/src/components/FeaturedProject.test.tsx.html +697 -0
- package/coverage/core/src/components/FeaturedProject.tsx.html +163 -0
- package/coverage/core/src/components/ProjectCard/ProjectCard.test.tsx.html +928 -0
- package/coverage/core/src/components/ProjectCard/ProjectCard.tsx.html +379 -0
- package/coverage/core/src/components/ProjectCard/index.html +146 -0
- package/coverage/core/src/components/ProjectCard/index.ts.html +88 -0
- package/coverage/core/src/components/ProjectGrid/ProjectGrid.test.tsx.html +292 -0
- package/coverage/core/src/components/ProjectGrid/ProjectGrid.tsx.html +103 -0
- package/coverage/core/src/components/ProjectGrid/index.html +146 -0
- package/coverage/core/src/components/ProjectGrid/index.ts.html +88 -0
- package/coverage/core/src/components/ProjectList/ProjectList.test.tsx.html +292 -0
- package/coverage/core/src/components/ProjectList/ProjectList.tsx.html +103 -0
- package/coverage/core/src/components/ProjectList/index.html +146 -0
- package/coverage/core/src/components/ProjectList/index.ts.html +88 -0
- package/coverage/core/src/components/ProjectView/ProjectView.test.tsx.html +1108 -0
- package/coverage/core/src/components/ProjectView/ProjectView.tsx.html +589 -0
- package/coverage/core/src/components/ProjectView/index.html +146 -0
- package/coverage/core/src/components/ProjectView/index.ts.html +88 -0
- package/coverage/core/src/components/index.html +146 -0
- package/coverage/core/src/components/index.ts.html +97 -0
- package/coverage/core/src/index.html +116 -0
- package/coverage/core/src/index.ts.html +94 -0
- package/coverage/core/src/lib/__tests__/defineProjects.test.ts.html +421 -0
- package/coverage/core/src/lib/__tests__/filterByFeatured.test.ts.html +523 -0
- package/coverage/core/src/lib/__tests__/filterByStatus.test.ts.html +664 -0
- package/coverage/core/src/lib/__tests__/filterByType.test.ts.html +631 -0
- package/coverage/core/src/lib/__tests__/github.test.ts.html +1783 -0
- package/coverage/core/src/lib/__tests__/hybrid-config.test.ts.html +1345 -0
- package/coverage/core/src/lib/__tests__/index.html +311 -0
- package/coverage/core/src/lib/__tests__/normalise.test.ts.html +1585 -0
- package/coverage/core/src/lib/__tests__/npm-config.test.ts.html +385 -0
- package/coverage/core/src/lib/__tests__/npm.test.ts.html +1135 -0
- package/coverage/core/src/lib/__tests__/product-hunt-config.test.ts.html +397 -0
- package/coverage/core/src/lib/__tests__/product-hunt.test.ts.html +505 -0
- package/coverage/core/src/lib/__tests__/sortByDate.test.ts.html +751 -0
- package/coverage/core/src/lib/__tests__/sortByName.test.ts.html +832 -0
- package/coverage/core/src/lib/__tests__/sortByStars.test.ts.html +703 -0
- package/coverage/core/src/lib/defineProjects.ts.html +100 -0
- package/coverage/core/src/lib/filterByFeatured.ts.html +133 -0
- package/coverage/core/src/lib/filterByStatus.ts.html +145 -0
- package/coverage/core/src/lib/filterByType.ts.html +133 -0
- package/coverage/core/src/lib/github.ts.html +517 -0
- package/coverage/core/src/lib/index.html +281 -0
- package/coverage/core/src/lib/index.ts.html +130 -0
- package/coverage/core/src/lib/normalise.ts.html +868 -0
- package/coverage/core/src/lib/npm.ts.html +199 -0
- package/coverage/core/src/lib/product-hunt.ts.html +256 -0
- package/coverage/core/src/lib/sortByDate.ts.html +175 -0
- package/coverage/core/src/lib/sortByName.ts.html +172 -0
- package/coverage/core/src/lib/sortByStars.ts.html +172 -0
- package/coverage/core/src/types/index.html +116 -0
- package/coverage/core/src/types/index.ts.html +517 -0
- package/coverage/core/vitest.config.ts.html +178 -0
- package/coverage/coverage-final.json +53 -0
- package/coverage/coverage-summary.json +54 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +266 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/dist/cli-components/FeaturedProject/FeaturedProject.d.ts +6 -0
- package/dist/cli-components/FeaturedProject/FeaturedProject.d.ts.map +1 -0
- package/dist/cli-components/FeaturedProject/FeaturedProject.js +9 -0
- package/dist/cli-components/FeaturedProject/FeaturedProject.js.map +1 -0
- package/dist/cli-components/FeaturedProject/FeaturedProject.tsx +54 -0
- package/dist/cli-components/FeaturedProject/index.d.ts +3 -0
- package/dist/cli-components/FeaturedProject/index.d.ts.map +1 -0
- package/dist/cli-components/FeaturedProject/index.js +2 -0
- package/dist/cli-components/FeaturedProject/index.js.map +1 -0
- package/dist/cli-components/FeaturedProject/index.ts +2 -0
- package/dist/cli-components/ProjectCard/ProjectCard.d.ts +26 -0
- package/dist/cli-components/ProjectCard/ProjectCard.d.ts.map +1 -0
- package/dist/cli-components/ProjectCard/ProjectCard.js +33 -0
- package/dist/cli-components/ProjectCard/ProjectCard.js.map +1 -0
- package/dist/cli-components/ProjectCard/ProjectCard.tsx +90 -0
- package/dist/cli-components/ProjectCard/index.d.ts +3 -0
- package/dist/cli-components/ProjectCard/index.d.ts.map +1 -0
- package/dist/cli-components/ProjectCard/index.js +2 -0
- package/dist/cli-components/ProjectCard/index.js.map +1 -0
- package/dist/cli-components/ProjectCard/index.ts +2 -0
- package/dist/cli-components/ProjectGrid/ProjectGrid.d.ts +5 -0
- package/dist/cli-components/ProjectGrid/ProjectGrid.d.ts.map +1 -0
- package/dist/cli-components/ProjectGrid/ProjectGrid.js +8 -0
- package/dist/cli-components/ProjectGrid/ProjectGrid.js.map +1 -0
- package/dist/cli-components/ProjectGrid/ProjectGrid.tsx +6 -0
- package/dist/cli-components/ProjectGrid/index.d.ts +3 -0
- package/dist/cli-components/ProjectGrid/index.d.ts.map +1 -0
- package/dist/cli-components/ProjectGrid/index.js +2 -0
- package/dist/cli-components/ProjectGrid/index.js.map +1 -0
- package/dist/cli-components/ProjectGrid/index.ts +2 -0
- package/dist/cli-components/ProjectList/ProjectList.d.ts +5 -0
- package/dist/cli-components/ProjectList/ProjectList.d.ts.map +1 -0
- package/dist/cli-components/ProjectList/ProjectList.js +8 -0
- package/dist/cli-components/ProjectList/ProjectList.js.map +1 -0
- package/dist/cli-components/ProjectList/ProjectList.tsx +6 -0
- package/dist/cli-components/ProjectList/index.d.ts +3 -0
- package/dist/cli-components/ProjectList/index.d.ts.map +1 -0
- package/dist/cli-components/ProjectList/index.js +2 -0
- package/dist/cli-components/ProjectList/index.js.map +1 -0
- package/dist/cli-components/ProjectList/index.ts +2 -0
- package/dist/cli-components/ProjectView/ProjectView.d.ts +17 -0
- package/dist/cli-components/ProjectView/ProjectView.d.ts.map +1 -0
- package/dist/cli-components/ProjectView/ProjectView.js +39 -0
- package/dist/cli-components/ProjectView/ProjectView.js.map +1 -0
- package/dist/cli-components/ProjectView/ProjectView.tsx +117 -0
- package/dist/cli-components/ProjectView/index.d.ts +3 -0
- package/dist/cli-components/ProjectView/index.d.ts.map +1 -0
- package/dist/cli-components/ProjectView/index.js +2 -0
- package/dist/cli-components/ProjectView/index.js.map +1 -0
- package/dist/cli-components/ProjectView/index.ts +2 -0
- package/dist/cli-components/types.d.ts +52 -0
- package/dist/cli-components/types.d.ts.map +1 -0
- package/dist/cli-components/types.js +2 -0
- package/dist/cli-components/types.js.map +1 -0
- package/dist/cli-components/types.ts +58 -0
- package/dist/cli-types.d.ts +52 -0
- package/dist/cli-types.d.ts.map +1 -0
- package/dist/cli-types.js +2 -0
- package/dist/cli-types.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +21 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +2 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +166 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +231 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/components/FeaturedProject.d.ts +7 -0
- package/dist/components/FeaturedProject.d.ts.map +1 -0
- package/dist/components/FeaturedProject.js +10 -0
- package/dist/components/FeaturedProject.js.map +1 -0
- package/dist/components/FeaturedProject.test.tsx +204 -0
- package/dist/components/FeaturedProject.tsx +26 -0
- package/dist/components/ProjectCard/ProjectCard.d.ts +26 -0
- package/dist/components/ProjectCard/ProjectCard.d.ts.map +1 -0
- package/dist/components/ProjectCard/ProjectCard.js +39 -0
- package/dist/components/ProjectCard/ProjectCard.js.map +1 -0
- package/dist/components/ProjectCard/ProjectCard.test.tsx +281 -0
- package/dist/components/ProjectCard/ProjectCard.tsx +98 -0
- package/dist/components/ProjectCard/index.d.ts +2 -0
- package/dist/components/ProjectCard/index.d.ts.map +1 -0
- package/dist/components/ProjectCard/index.js +2 -0
- package/dist/components/ProjectCard/index.js.map +1 -0
- package/dist/components/ProjectCard/index.ts +1 -0
- package/dist/components/ProjectGrid/ProjectGrid.d.ts +5 -0
- package/dist/components/ProjectGrid/ProjectGrid.d.ts.map +1 -0
- package/dist/components/ProjectGrid/ProjectGrid.js +8 -0
- package/dist/components/ProjectGrid/ProjectGrid.js.map +1 -0
- package/dist/components/ProjectGrid/ProjectGrid.test.tsx +69 -0
- package/dist/components/ProjectGrid/ProjectGrid.tsx +6 -0
- package/dist/components/ProjectGrid/index.d.ts +2 -0
- package/dist/components/ProjectGrid/index.d.ts.map +1 -0
- package/dist/components/ProjectGrid/index.js +2 -0
- package/dist/components/ProjectGrid/index.js.map +1 -0
- package/dist/components/ProjectGrid/index.ts +1 -0
- package/dist/components/ProjectList/ProjectList.d.ts +5 -0
- package/dist/components/ProjectList/ProjectList.d.ts.map +1 -0
- package/dist/components/ProjectList/ProjectList.js +8 -0
- package/dist/components/ProjectList/ProjectList.js.map +1 -0
- package/dist/components/ProjectList/ProjectList.test.tsx +69 -0
- package/dist/components/ProjectList/ProjectList.tsx +6 -0
- package/dist/components/ProjectList/index.d.ts +2 -0
- package/dist/components/ProjectList/index.d.ts.map +1 -0
- package/dist/components/ProjectList/index.js +2 -0
- package/dist/components/ProjectList/index.js.map +1 -0
- package/dist/components/ProjectList/index.ts +1 -0
- package/dist/components/ProjectView/ProjectView.d.ts +20 -0
- package/dist/components/ProjectView/ProjectView.d.ts.map +1 -0
- package/dist/components/ProjectView/ProjectView.js +64 -0
- package/dist/components/ProjectView/ProjectView.js.map +1 -0
- package/dist/components/ProjectView/ProjectView.test.tsx +341 -0
- package/dist/components/ProjectView/ProjectView.tsx +168 -0
- package/dist/components/ProjectView/index.d.ts +2 -0
- package/dist/components/ProjectView/index.d.ts.map +1 -0
- package/dist/components/ProjectView/index.js +2 -0
- package/dist/components/ProjectView/index.js.map +1 -0
- package/dist/components/ProjectView/index.ts +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +5 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.ts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/defineProjects.d.ts +3 -0
- package/dist/lib/defineProjects.d.ts.map +1 -0
- package/dist/lib/defineProjects.js +4 -0
- package/dist/lib/defineProjects.js.map +1 -0
- package/dist/lib/filterByFeatured.d.ts +3 -0
- package/dist/lib/filterByFeatured.d.ts.map +1 -0
- package/dist/lib/filterByFeatured.js +10 -0
- package/dist/lib/filterByFeatured.js.map +1 -0
- package/dist/lib/filterByStatus.d.ts +3 -0
- package/dist/lib/filterByStatus.d.ts.map +1 -0
- package/dist/lib/filterByStatus.js +13 -0
- package/dist/lib/filterByStatus.js.map +1 -0
- package/dist/lib/filterByType.d.ts +3 -0
- package/dist/lib/filterByType.d.ts.map +1 -0
- package/dist/lib/filterByType.js +10 -0
- package/dist/lib/filterByType.js.map +1 -0
- package/dist/lib/github.d.ts +24 -0
- package/dist/lib/github.d.ts.map +1 -0
- package/dist/lib/github.js +107 -0
- package/dist/lib/github.js.map +1 -0
- package/dist/lib/index.d.ts +16 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +12 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/normalise.d.ts +4 -0
- package/dist/lib/normalise.d.ts.map +1 -0
- package/dist/lib/normalise.js +221 -0
- package/dist/lib/normalise.js.map +1 -0
- package/dist/lib/npm.d.ts +7 -0
- package/dist/lib/npm.d.ts.map +1 -0
- package/dist/lib/npm.js +28 -0
- package/dist/lib/npm.js.map +1 -0
- package/dist/lib/product-hunt.d.ts +12 -0
- package/dist/lib/product-hunt.d.ts.map +1 -0
- package/dist/lib/product-hunt.js +40 -0
- package/dist/lib/product-hunt.js.map +1 -0
- package/dist/lib/sortByDate.d.ts +4 -0
- package/dist/lib/sortByDate.d.ts.map +1 -0
- package/dist/lib/sortByDate.js +21 -0
- package/dist/lib/sortByDate.js.map +1 -0
- package/dist/lib/sortByName.d.ts +4 -0
- package/dist/lib/sortByName.d.ts.map +1 -0
- package/dist/lib/sortByName.js +21 -0
- package/dist/lib/sortByName.js.map +1 -0
- package/dist/lib/sortByStars.d.ts +4 -0
- package/dist/lib/sortByStars.d.ts.map +1 -0
- package/dist/lib/sortByStars.js +21 -0
- package/dist/lib/sortByStars.js.map +1 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +2 -0
- package/dist/test-setup.js.map +1 -0
- package/dist/types/index.d.ts +121 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/eslint.config.js +33 -0
- package/package.json +47 -0
- package/playwright-report/index.html +85 -0
- package/src/__tests__/benchmarks/ProjectCard.bench.tsx +93 -0
- package/src/__tests__/benchmarks/ProjectView.bench.tsx +133 -0
- package/src/__tests__/benchmarks/github.bench.ts +53 -0
- package/src/__tests__/benchmarks/npm.bench.ts +62 -0
- package/src/__tests__/benchmarks/product-hunt.bench.ts +58 -0
- package/src/__tests__/benchmarks/utilities.bench.ts +131 -0
- package/src/cli-components/FeaturedProject/FeaturedProject.tsx +54 -0
- package/src/cli-components/FeaturedProject/index.ts +2 -0
- package/src/cli-components/ProjectCard/ProjectCard.tsx +90 -0
- package/src/cli-components/ProjectCard/index.ts +2 -0
- package/src/cli-components/ProjectGrid/ProjectGrid.tsx +6 -0
- package/src/cli-components/ProjectGrid/index.ts +2 -0
- package/src/cli-components/ProjectList/ProjectList.tsx +6 -0
- package/src/cli-components/ProjectList/index.ts +2 -0
- package/src/cli-components/ProjectView/ProjectView.tsx +117 -0
- package/src/cli-components/ProjectView/index.ts +2 -0
- package/src/cli-components/types.ts +58 -0
- package/src/cli-types.ts +58 -0
- package/src/cli.ts +26 -0
- package/src/commands/add.ts +191 -0
- package/src/commands/init.ts +260 -0
- package/src/components/FeaturedProject.test.tsx +204 -0
- package/src/components/FeaturedProject.tsx +26 -0
- package/src/components/ProjectCard/ProjectCard.test.tsx +281 -0
- package/src/components/ProjectCard/ProjectCard.tsx +98 -0
- package/src/components/ProjectCard/index.ts +1 -0
- package/src/components/ProjectGrid/ProjectGrid.test.tsx +69 -0
- package/src/components/ProjectGrid/ProjectGrid.tsx +6 -0
- package/src/components/ProjectGrid/index.ts +1 -0
- package/src/components/ProjectList/ProjectList.test.tsx +69 -0
- package/src/components/ProjectList/ProjectList.tsx +6 -0
- package/src/components/ProjectList/index.ts +1 -0
- package/src/components/ProjectView/ProjectView.test.tsx +341 -0
- package/src/components/ProjectView/ProjectView.tsx +168 -0
- package/src/components/ProjectView/index.ts +1 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +3 -0
- package/src/lib/__tests__/defineProjects.test.ts +112 -0
- package/src/lib/__tests__/filterByFeatured.test.ts +146 -0
- package/src/lib/__tests__/filterByStatus.test.ts +193 -0
- package/src/lib/__tests__/filterByType.test.ts +182 -0
- package/src/lib/__tests__/github.test.ts +566 -0
- package/src/lib/__tests__/hybrid-config.test.ts +420 -0
- package/src/lib/__tests__/normalise.test.ts +500 -0
- package/src/lib/__tests__/npm-config.test.ts +100 -0
- package/src/lib/__tests__/npm.test.ts +350 -0
- package/src/lib/__tests__/product-hunt-config.test.ts +104 -0
- package/src/lib/__tests__/product-hunt.test.ts +140 -0
- package/src/lib/__tests__/sortByDate.test.ts +222 -0
- package/src/lib/__tests__/sortByName.test.ts +249 -0
- package/src/lib/__tests__/sortByStars.test.ts +206 -0
- package/src/lib/defineProjects.ts +5 -0
- package/src/lib/filterByFeatured.ts +16 -0
- package/src/lib/filterByStatus.ts +20 -0
- package/src/lib/filterByType.ts +16 -0
- package/src/lib/github.ts +144 -0
- package/src/lib/index.ts +15 -0
- package/src/lib/normalise.ts +261 -0
- package/src/lib/npm.ts +38 -0
- package/src/lib/product-hunt.ts +57 -0
- package/src/lib/sortByDate.ts +30 -0
- package/src/lib/sortByName.ts +29 -0
- package/src/lib/sortByStars.ts +29 -0
- package/src/test-setup.ts +1 -0
- package/src/types/index.ts +144 -0
- package/test-results/.last-run.json +62 -0
- package/tsconfig.json +29 -0
- package/vitest.config.ts +31 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { readFile, writeFile, access, constants } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { fetchGitHubRepos } from '../lib/github.js';
|
|
6
|
+
const CONFIG_FILE = 'folio.config.ts';
|
|
7
|
+
const PACKAGE_JSON = 'package.json';
|
|
8
|
+
export async function init(options = {}) {
|
|
9
|
+
const workingDir = process.cwd();
|
|
10
|
+
console.log(chalk.bold('🚀 Initializing Folio project...'));
|
|
11
|
+
console.log();
|
|
12
|
+
try {
|
|
13
|
+
await access(CONFIG_FILE, constants.F_OK);
|
|
14
|
+
const { overwrite } = await inquirer.prompt([
|
|
15
|
+
{
|
|
16
|
+
type: 'confirm',
|
|
17
|
+
name: 'overwrite',
|
|
18
|
+
message: `${CONFIG_FILE} already exists. Overwrite?`,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
]);
|
|
22
|
+
if (!overwrite) {
|
|
23
|
+
console.log(chalk.yellow('✖ Init cancelled.'));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
}
|
|
29
|
+
const isNextJs = await detectNextJs(workingDir);
|
|
30
|
+
if (isNextJs) {
|
|
31
|
+
console.log(chalk.green('✓ Next.js project detected'));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(chalk.yellow('⚠ Next.js not detected. Folio is optimized for Next.js projects.'));
|
|
35
|
+
}
|
|
36
|
+
console.log();
|
|
37
|
+
let template;
|
|
38
|
+
if (options.github) {
|
|
39
|
+
template = await generateGitHubConfig();
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
template = generateConfigTemplate();
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const configPath = resolve(workingDir, CONFIG_FILE);
|
|
46
|
+
await writeFile(configPath, template, 'utf-8');
|
|
47
|
+
console.log(chalk.green(`✓ ${CONFIG_FILE} created successfully`));
|
|
48
|
+
console.log();
|
|
49
|
+
console.log(chalk.bold('Next steps:'));
|
|
50
|
+
console.log(chalk.gray('1. Edit folio.config.ts to add your projects'));
|
|
51
|
+
console.log(chalk.gray('2. Import and use the components in your Next.js app'));
|
|
52
|
+
console.log(chalk.gray('3. See https://docs.folio.dev for usage examples'));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (error instanceof Error && 'code' in error && error.code === 'EACCES') {
|
|
56
|
+
console.error(chalk.red(`✖ Permission denied. Cannot write to ${CONFIG_FILE}`));
|
|
57
|
+
console.error(chalk.gray(' Check file permissions and try again.'));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.error(chalk.red('✖ Failed to create folio.config.ts'));
|
|
61
|
+
console.error(chalk.gray(` ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
62
|
+
}
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function detectNextJs(workingDir) {
|
|
67
|
+
const packagePath = resolve(workingDir, PACKAGE_JSON);
|
|
68
|
+
try {
|
|
69
|
+
await access(packagePath, constants.F_OK);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
console.log(chalk.yellow(`⚠ ${PACKAGE_JSON} not found. Proceeding with basic scaffold.`));
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const content = await readFile(packagePath, 'utf-8');
|
|
77
|
+
const pkg = JSON.parse(content);
|
|
78
|
+
if (!pkg || typeof pkg !== 'object') {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
82
|
+
return 'next' in deps;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (error instanceof SyntaxError) {
|
|
86
|
+
console.error(chalk.red(`✖ ${PACKAGE_JSON} is not valid JSON`));
|
|
87
|
+
console.error(chalk.gray(' Check syntax and try again.'));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.error(chalk.red(`✖ Error reading ${PACKAGE_JSON}`));
|
|
91
|
+
console.error(chalk.gray(` ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function generateConfigTemplate() {
|
|
97
|
+
return `import { defineProjects } from '@reallukemanning/folio'
|
|
98
|
+
|
|
99
|
+
export const projects = defineProjects([
|
|
100
|
+
{
|
|
101
|
+
id: 'my-project',
|
|
102
|
+
type: 'github',
|
|
103
|
+
repo: 'username/repo',
|
|
104
|
+
status: 'active',
|
|
105
|
+
featured: true,
|
|
106
|
+
background: 'A brief background of your project...',
|
|
107
|
+
why: 'Why you built this project...',
|
|
108
|
+
stack: ['TypeScript', 'React', 'Next.js'],
|
|
109
|
+
struggles: [],
|
|
110
|
+
timeline: [],
|
|
111
|
+
posts: [],
|
|
112
|
+
},
|
|
113
|
+
])
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
// Optional fields to add context to your project:
|
|
117
|
+
// background: The story behind the project - what problem does it solve?
|
|
118
|
+
// why: Your motivation for building it - why does this matter to you?
|
|
119
|
+
// struggles: Current challenges or technical hurdles faced
|
|
120
|
+
// - type: 'warn' (minor issues) or 'error' (blockers)
|
|
121
|
+
// - text: Description of the challenge
|
|
122
|
+
// timeline: Milestones and important dates in the project's journey
|
|
123
|
+
// - date: Formatted date string (e.g., '2025-01-15')
|
|
124
|
+
// - note: What happened on this date
|
|
125
|
+
// posts: Related blog posts, announcements, or documentation
|
|
126
|
+
// - title: Post title
|
|
127
|
+
// - date: Publication date
|
|
128
|
+
// - url: Link to the post (optional)
|
|
129
|
+
async function generateGitHubConfig() {
|
|
130
|
+
const { username } = await inquirer.prompt([
|
|
131
|
+
{
|
|
132
|
+
type: 'input',
|
|
133
|
+
name: 'username',
|
|
134
|
+
message: 'Enter your GitHub username:',
|
|
135
|
+
validate: (input) => input.trim().length > 0 || 'Username is required',
|
|
136
|
+
},
|
|
137
|
+
]);
|
|
138
|
+
console.log();
|
|
139
|
+
console.log(chalk.gray('Fetching repositories...'));
|
|
140
|
+
const result = await fetchGitHubRepos(username);
|
|
141
|
+
if (result.error) {
|
|
142
|
+
if (result.error === 'rate_limit') {
|
|
143
|
+
console.log(chalk.red('✖ GitHub API rate limit exceeded'));
|
|
144
|
+
if (!process.env.GITHUB_TOKEN) {
|
|
145
|
+
console.log(chalk.yellow(' Rate limit: 60 requests/hour (unauthenticated)'));
|
|
146
|
+
console.log(chalk.yellow(' Recommended: Set GITHUB_TOKEN environment variable for 5000 requests/hour'));
|
|
147
|
+
}
|
|
148
|
+
console.log(chalk.gray(' Run "npx folio init" for a basic scaffold instead.'));
|
|
149
|
+
}
|
|
150
|
+
else if (result.error === 'network') {
|
|
151
|
+
console.log(chalk.red('✖ Failed to fetch repositories from GitHub'));
|
|
152
|
+
console.log(chalk.gray(' Check your network connection and try again.'));
|
|
153
|
+
console.log(chalk.gray(' Run "npx folio init" for a basic scaffold instead.'));
|
|
154
|
+
}
|
|
155
|
+
else if (result.error === 'not_found') {
|
|
156
|
+
console.log(chalk.red(`✖ GitHub user "${username}" not found`));
|
|
157
|
+
console.log(chalk.gray(' Check the username and try again.'));
|
|
158
|
+
console.log(chalk.gray(' Run "npx folio init" for a basic scaffold instead.'));
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
console.log(chalk.red('✖ Failed to fetch repositories from GitHub'));
|
|
162
|
+
console.log(chalk.gray(' Run "npx folio init" for a basic scaffold instead.'));
|
|
163
|
+
}
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
if (!result.data || result.data.length === 0) {
|
|
167
|
+
console.log(chalk.yellow('✖ No repositories found'));
|
|
168
|
+
console.log(chalk.gray(' This could mean:'));
|
|
169
|
+
console.log(chalk.gray(' - You have no public repositories'));
|
|
170
|
+
console.log(chalk.gray(' - Your GITHUB_TOKEN is not set (private repos require auth)'));
|
|
171
|
+
console.log(chalk.gray(' - Rate limit exceeded (60/hr unauthenticated)'));
|
|
172
|
+
console.log();
|
|
173
|
+
console.log(chalk.gray('Suggestions:'));
|
|
174
|
+
console.log(chalk.gray(' 1. Set GITHUB_TOKEN environment variable for private repos'));
|
|
175
|
+
console.log(chalk.gray(' 2. Run "npx folio init" for a basic scaffold instead'));
|
|
176
|
+
console.log(chalk.gray(' 3. Check your GitHub username and try again'));
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
const { includeForks } = await inquirer.prompt([
|
|
180
|
+
{
|
|
181
|
+
type: 'confirm',
|
|
182
|
+
name: 'includeForks',
|
|
183
|
+
message: 'Include forked repositories?',
|
|
184
|
+
default: false,
|
|
185
|
+
},
|
|
186
|
+
]);
|
|
187
|
+
const filteredRepos = result.data.filter((repo) => {
|
|
188
|
+
if (repo.archived) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
if (repo.name.endsWith('.template') || repo.name.endsWith('.github.io')) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (repo.description === null) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
});
|
|
199
|
+
const finalRepos = includeForks
|
|
200
|
+
? filteredRepos
|
|
201
|
+
: filteredRepos.filter((repo) => !repo.fork);
|
|
202
|
+
if (finalRepos.length === 0) {
|
|
203
|
+
console.log(chalk.yellow('✖ No repositories match your criteria'));
|
|
204
|
+
console.log(chalk.gray(' Try including forks or check your repository descriptions.'));
|
|
205
|
+
console.log(chalk.gray(' Run "npx folio init" for a basic scaffold instead.'));
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
const repoEntries = finalRepos
|
|
209
|
+
.map((repo) => ` {
|
|
210
|
+
id: '${repo.name}',
|
|
211
|
+
type: 'github',
|
|
212
|
+
repo: '${username}/${repo.name}',
|
|
213
|
+
status: 'active',
|
|
214
|
+
featured: false,
|
|
215
|
+
description: '${(repo.description || '').replace(/'/g, "\\'").replace(/\n/g, ' ')}',
|
|
216
|
+
background: null,
|
|
217
|
+
why: null,
|
|
218
|
+
stack: ${repo.language ? `['${repo.language}']` : '[]'},
|
|
219
|
+
struggles: [],
|
|
220
|
+
timeline: [],
|
|
221
|
+
posts: [],
|
|
222
|
+
},`)
|
|
223
|
+
.join('\n');
|
|
224
|
+
return `import { defineProjects } from '@reallukemanning/folio'
|
|
225
|
+
|
|
226
|
+
export const projects = defineProjects([
|
|
227
|
+
${repoEntries}
|
|
228
|
+
])
|
|
229
|
+
`;
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,WAAW,GAAG,iBAAiB,CAAA;AACrC,MAAM,YAAY,GAAG,cAAc,CAAA;AAMnC,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,UAAuB,EAAE;IAClD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IAEhC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC,CAAA;IAC3D,OAAO,CAAC,GAAG,EAAE,CAAA;IAEb,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QAEzC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YAC1C;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,GAAG,WAAW,6BAA6B;gBACpD,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAA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,sDAAsD,CAAC,CAAC,CAAA;QAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,WAAW,GAAG,UAAU;SAC3B,GAAG,CACF,CAAC,IAAI,EAAE,EAAE,CAAC;WACL,IAAI,CAAC,IAAI;;aAEP,QAAQ,IAAI,IAAI,CAAC,IAAI;;;oBAGd,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;;;aAGxE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI;;;;KAIrD,CACA;SACA,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,OAAO;;;EAGP,WAAW;;CAEZ,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FolioProject } from '../types';
|
|
2
|
+
interface FeaturedProjectProps {
|
|
3
|
+
project: FolioProject | null | undefined;
|
|
4
|
+
}
|
|
5
|
+
declare function FeaturedProject({ project }: FeaturedProjectProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export { FeaturedProject };
|
|
7
|
+
//# sourceMappingURL=FeaturedProject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeaturedProject.d.ts","sourceRoot":"","sources":["../../src/components/FeaturedProject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAG5C,UAAU,oBAAoB;IAC5B,OAAO,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,CAAA;CACzC;AAED,iBAAS,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE,oBAAoB,kDAgBzD;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ProjectView } from './ProjectView';
|
|
3
|
+
function FeaturedProject({ project }) {
|
|
4
|
+
if (!project) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return (_jsxs("div", { "data-folio-featured": true, children: [project.image && _jsx("img", { "data-folio-featured-image": true, src: project.image, alt: project.name }), _jsxs(ProjectView, { project: project, children: [_jsx(ProjectView.Section, { name: "background", project: project }), _jsx(ProjectView.Section, { name: "why", project: project }), _jsx(ProjectView.Stats, { project: project }), _jsx(ProjectView.Links, { project: project })] })] }));
|
|
8
|
+
}
|
|
9
|
+
export { FeaturedProject };
|
|
10
|
+
//# sourceMappingURL=FeaturedProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeaturedProject.js","sourceRoot":"","sources":["../../src/components/FeaturedProject.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAM3C,SAAS,eAAe,CAAC,EAAE,OAAO,EAAwB;IACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,uDACG,OAAO,CAAC,KAAK,IAAI,iDAA+B,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,GAAI,EAC1F,MAAC,WAAW,IAAC,OAAO,EAAE,OAAO,aAC3B,KAAC,WAAW,CAAC,OAAO,IAAC,IAAI,EAAC,YAAY,EAAC,OAAO,EAAE,OAAO,GAAI,EAC3D,KAAC,WAAW,CAAC,OAAO,IAAC,IAAI,EAAC,KAAK,EAAC,OAAO,EAAE,OAAO,GAAI,EACpD,KAAC,WAAW,CAAC,KAAK,IAAC,OAAO,EAAE,OAAO,GAAI,EACvC,KAAC,WAAW,CAAC,KAAK,IAAC,OAAO,EAAE,OAAO,GAAI,IAC3B,IACV,CACP,CAAA;AACH,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { describe, it, expect, afterEach } from 'vitest'
|
|
2
|
+
import { render, screen, cleanup } from '@testing-library/react'
|
|
3
|
+
import { FeaturedProject } from './FeaturedProject'
|
|
4
|
+
import type { FolioProject } from '../types'
|
|
5
|
+
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
cleanup()
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const createProject = (overrides: Partial<FolioProject> = {}): FolioProject => ({
|
|
11
|
+
id: 'test-project',
|
|
12
|
+
type: 'github',
|
|
13
|
+
status: 'active',
|
|
14
|
+
featured: true,
|
|
15
|
+
name: 'Featured Project',
|
|
16
|
+
tagline: 'A featured project',
|
|
17
|
+
description: 'This is a featured project description',
|
|
18
|
+
background: 'Background of the featured project.',
|
|
19
|
+
why: 'Why this project is featured.',
|
|
20
|
+
image: null,
|
|
21
|
+
struggles: [],
|
|
22
|
+
timeline: [],
|
|
23
|
+
posts: [],
|
|
24
|
+
stack: ['React', 'TypeScript'],
|
|
25
|
+
links: {
|
|
26
|
+
github: 'https://github.com/test/project',
|
|
27
|
+
live: 'https://test-project.com',
|
|
28
|
+
},
|
|
29
|
+
stats: {
|
|
30
|
+
stars: 1000,
|
|
31
|
+
forks: 200,
|
|
32
|
+
},
|
|
33
|
+
language: 'TypeScript',
|
|
34
|
+
languageColor: '#3178c6',
|
|
35
|
+
createdAt: '2024-01-01',
|
|
36
|
+
updatedAt: '2024-06-01',
|
|
37
|
+
...overrides,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
describe('FeaturedProject', () => {
|
|
41
|
+
it('displays project prominently with project data', () => {
|
|
42
|
+
const project = createProject()
|
|
43
|
+
|
|
44
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
45
|
+
|
|
46
|
+
expect(screen.getByRole('heading', { level: 2 })).toHaveTextContent('Featured Project')
|
|
47
|
+
expect(container.querySelector('[data-folio-view-section-name="background"]')).toHaveTextContent(/Background of the featured project/)
|
|
48
|
+
expect(screen.getByText('Why this project is featured.')).toBeInTheDocument()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('renders nothing without project', () => {
|
|
52
|
+
const { container } = render(<FeaturedProject project={undefined} />)
|
|
53
|
+
|
|
54
|
+
expect(container.querySelector('[data-folio-featured]')).not.toBeInTheDocument()
|
|
55
|
+
expect(container.firstChild).toBeNull()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('renders nothing with null project', () => {
|
|
59
|
+
const { container } = render(<FeaturedProject project={null} />)
|
|
60
|
+
|
|
61
|
+
expect(container.querySelector('[data-folio-featured]')).not.toBeInTheDocument()
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('displays image when project has image', () => {
|
|
65
|
+
const project = createProject({ image: 'https://example.com/image.png' })
|
|
66
|
+
|
|
67
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
68
|
+
|
|
69
|
+
const image = container.querySelector('[data-folio-featured-image]')
|
|
70
|
+
expect(image).toBeInTheDocument()
|
|
71
|
+
expect(image).toHaveAttribute('src', 'https://example.com/image.png')
|
|
72
|
+
expect(image).toHaveAttribute('alt', 'Featured Project')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('does not display image when project has no image', () => {
|
|
76
|
+
const project = createProject({ image: null })
|
|
77
|
+
|
|
78
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
79
|
+
|
|
80
|
+
expect(container.querySelector('[data-folio-featured-image]')).not.toBeInTheDocument()
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('displays stats when available', () => {
|
|
84
|
+
const project = createProject()
|
|
85
|
+
|
|
86
|
+
render(<FeaturedProject project={project} />)
|
|
87
|
+
|
|
88
|
+
expect(screen.getByText('1000 stars')).toBeInTheDocument()
|
|
89
|
+
expect(screen.getByText('200 forks')).toBeInTheDocument()
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('displays links when available', () => {
|
|
93
|
+
const project = createProject()
|
|
94
|
+
|
|
95
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
96
|
+
|
|
97
|
+
expect(container.querySelector('[data-folio-link-type="github"]')).toBeInTheDocument()
|
|
98
|
+
expect(container.querySelector('[data-folio-link-type="live"]')).toBeInTheDocument()
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
describe('FeaturedProject data attributes', () => {
|
|
103
|
+
it('has correct data-folio-featured attribute on root', () => {
|
|
104
|
+
const project = createProject()
|
|
105
|
+
|
|
106
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
107
|
+
|
|
108
|
+
expect(container.querySelector('[data-folio-featured]')).toBeInTheDocument()
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('has correct data-folio-featured-image attribute', () => {
|
|
112
|
+
const project = createProject({ image: 'https://example.com/image.png' })
|
|
113
|
+
|
|
114
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
115
|
+
|
|
116
|
+
expect(container.querySelector('[data-folio-featured-image]')).toBeInTheDocument()
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it('has correct data-folio-view attribute from ProjectView', () => {
|
|
120
|
+
const project = createProject()
|
|
121
|
+
|
|
122
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
123
|
+
|
|
124
|
+
expect(container.querySelector('[data-folio-view]')).toBeInTheDocument()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('has correct data-folio-view-section attributes', () => {
|
|
128
|
+
const project = createProject()
|
|
129
|
+
|
|
130
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
131
|
+
|
|
132
|
+
expect(container.querySelector('[data-folio-view-section-name="background"]')).toBeInTheDocument()
|
|
133
|
+
expect(container.querySelector('[data-folio-view-section-name="why"]')).toBeInTheDocument()
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
it('has correct data-folio-view-stats attribute', () => {
|
|
137
|
+
const project = createProject()
|
|
138
|
+
|
|
139
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
140
|
+
|
|
141
|
+
expect(container.querySelector('[data-folio-view-stats]')).toBeInTheDocument()
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
it('has correct data-folio-view-links attribute', () => {
|
|
145
|
+
const project = createProject()
|
|
146
|
+
|
|
147
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
148
|
+
|
|
149
|
+
expect(container.querySelector('[data-folio-view-links]')).toBeInTheDocument()
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
describe('FeaturedProject composition', () => {
|
|
154
|
+
it('uses ProjectView internally for project display', () => {
|
|
155
|
+
const project = createProject()
|
|
156
|
+
|
|
157
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
158
|
+
|
|
159
|
+
expect(container.querySelector('[data-folio-view]')).toBeInTheDocument()
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
it('renders background section via ProjectView.Section', () => {
|
|
163
|
+
const project = createProject({ background: 'Custom background' })
|
|
164
|
+
|
|
165
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
166
|
+
|
|
167
|
+
expect(container.querySelector('[data-folio-view-section-name="background"]')).toHaveTextContent('Custom background')
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('renders why section via ProjectView.Section', () => {
|
|
171
|
+
const project = createProject({ why: 'Custom why' })
|
|
172
|
+
|
|
173
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
174
|
+
|
|
175
|
+
expect(container.querySelector('[data-folio-view-section-name="why"]')).toHaveTextContent('Custom why')
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
it('handles project with no background gracefully', () => {
|
|
179
|
+
const project = createProject({ background: null })
|
|
180
|
+
|
|
181
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
182
|
+
|
|
183
|
+
expect(container.querySelector('[data-folio-featured]')).toBeInTheDocument()
|
|
184
|
+
expect(container.querySelector('[data-folio-view-section-name="background"]')).not.toBeInTheDocument()
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it('handles project with no why gracefully', () => {
|
|
188
|
+
const project = createProject({ why: null })
|
|
189
|
+
|
|
190
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
191
|
+
|
|
192
|
+
expect(container.querySelector('[data-folio-featured]')).toBeInTheDocument()
|
|
193
|
+
expect(container.querySelector('[data-folio-view-section-name="why"]')).not.toBeInTheDocument()
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
it('handles project with no stats gracefully', () => {
|
|
197
|
+
const project = createProject({ stats: null })
|
|
198
|
+
|
|
199
|
+
const { container } = render(<FeaturedProject project={project} />)
|
|
200
|
+
|
|
201
|
+
expect(container.querySelector('[data-folio-featured]')).toBeInTheDocument()
|
|
202
|
+
expect(container.querySelector('[data-folio-view-stats]')).not.toBeInTheDocument()
|
|
203
|
+
})
|
|
204
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FolioProject } from '../types'
|
|
2
|
+
import { ProjectView } from './ProjectView'
|
|
3
|
+
|
|
4
|
+
interface FeaturedProjectProps {
|
|
5
|
+
project: FolioProject | null | undefined
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function FeaturedProject({ project }: FeaturedProjectProps) {
|
|
9
|
+
if (!project) {
|
|
10
|
+
return null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div data-folio-featured>
|
|
15
|
+
{project.image && <img data-folio-featured-image src={project.image} alt={project.name} />}
|
|
16
|
+
<ProjectView project={project}>
|
|
17
|
+
<ProjectView.Section name="background" project={project} />
|
|
18
|
+
<ProjectView.Section name="why" project={project} />
|
|
19
|
+
<ProjectView.Stats project={project} />
|
|
20
|
+
<ProjectView.Links project={project} />
|
|
21
|
+
</ProjectView>
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { FeaturedProject }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FolioProject } from '../../types';
|
|
2
|
+
declare function ProjectCard({ children }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare namespace ProjectCard {
|
|
6
|
+
var Header: ({ project }: {
|
|
7
|
+
project: FolioProject;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
var Description: ({ project }: {
|
|
10
|
+
project: FolioProject;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
var Tags: ({ project }: {
|
|
13
|
+
project: FolioProject;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
var Stats: ({ project }: {
|
|
16
|
+
project: FolioProject;
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
var Status: ({ project }: {
|
|
19
|
+
project: FolioProject;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
var Links: ({ project }: {
|
|
22
|
+
project: FolioProject;
|
|
23
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
}
|
|
25
|
+
export { ProjectCard };
|
|
26
|
+
//# sourceMappingURL=ProjectCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectCard.d.ts","sourceRoot":"","sources":["../../../src/components/ProjectCard/ProjectCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAE/D;kBAFQ,WAAW;8BAIyC;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE;mCAWf;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE;4BAKvC;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE;6BAavB;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE;8BA0BvB;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE;6BAQ3B;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE;;AA4BpF,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
function ProjectCard({ children }) {
|
|
3
|
+
return _jsx("div", { "data-folio-card": true, children: children });
|
|
4
|
+
}
|
|
5
|
+
ProjectCard.Header = function ProjectCardHeader({ project }) {
|
|
6
|
+
return (_jsxs("div", { "data-folio-card-header": true, children: [_jsx("h3", { children: project.name }), _jsx("div", { "data-folio-type": true, "data-folio-type-value": project.type, children: project.type })] }));
|
|
7
|
+
};
|
|
8
|
+
ProjectCard.Description = function ProjectCardDescription({ project }) {
|
|
9
|
+
if (!project.description)
|
|
10
|
+
return null;
|
|
11
|
+
return _jsx("div", { "data-folio-card-description": true, children: project.description });
|
|
12
|
+
};
|
|
13
|
+
ProjectCard.Tags = function ProjectCardTags({ project }) {
|
|
14
|
+
if (!project.stack || project.stack.length === 0)
|
|
15
|
+
return null;
|
|
16
|
+
return (_jsx("div", { "data-folio-card-tags": true, children: project.stack.map((tag) => (_jsx("span", { "data-folio-tag": true, children: tag }, tag))) }));
|
|
17
|
+
};
|
|
18
|
+
ProjectCard.Stats = function ProjectCardStats({ project }) {
|
|
19
|
+
if (!project.stats ||
|
|
20
|
+
(!project.stats.stars &&
|
|
21
|
+
!project.stats.forks &&
|
|
22
|
+
!project.stats.downloads &&
|
|
23
|
+
!project.stats.version &&
|
|
24
|
+
!project.stats.upvotes &&
|
|
25
|
+
!project.stats.comments)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return (_jsxs("div", { "data-folio-card-stats": true, children: [project.stats.stars && _jsxs("span", { "data-folio-stat": "stars", children: [project.stats.stars, " stars"] }), project.stats.forks && _jsxs("span", { "data-folio-stat": "forks", children: [project.stats.forks, " forks"] }), project.stats.downloads && (_jsxs("span", { "data-folio-stat": "downloads", children: [project.stats.downloads, " downloads"] })), project.stats.version && _jsx("span", { "data-folio-stat": "version", children: project.stats.version }), project.stats.upvotes && _jsxs("span", { "data-folio-stat": "upvotes", children: [project.stats.upvotes, " upvotes"] }), project.stats.comments && _jsxs("span", { "data-folio-stat": "comments", children: [project.stats.comments, " comments"] })] }));
|
|
29
|
+
};
|
|
30
|
+
ProjectCard.Status = function ProjectCardStatus({ project }) {
|
|
31
|
+
return (_jsx("div", { "data-folio-status": true, "data-folio-status-value": project.status, children: project.status }));
|
|
32
|
+
};
|
|
33
|
+
ProjectCard.Links = function ProjectCardLinks({ project }) {
|
|
34
|
+
if (!project.links.github && !project.links.live && !project.links.npm && !project.links.productHunt)
|
|
35
|
+
return null;
|
|
36
|
+
return (_jsxs("div", { "data-folio-card-links": true, children: [project.links.github && (_jsx("a", { href: project.links.github, "data-folio-link": true, "data-folio-link-type": "github", children: "GitHub" })), project.links.live && (_jsx("a", { href: project.links.live, "data-folio-link": true, "data-folio-link-type": "live", children: "Live" })), project.links.npm && (_jsx("a", { href: project.links.npm, "data-folio-link": true, "data-folio-link-type": "npm", children: "npm" })), project.links.productHunt && (_jsx("a", { href: project.links.productHunt, "data-folio-link": true, "data-folio-link-type": "product-hunt", children: "Product Hunt" }))] }));
|
|
37
|
+
};
|
|
38
|
+
export { ProjectCard };
|
|
39
|
+
//# sourceMappingURL=ProjectCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectCard.js","sourceRoot":"","sources":["../../../src/components/ProjectCard/ProjectCard.tsx"],"names":[],"mappings":";AAEA,SAAS,WAAW,CAAC,EAAE,QAAQ,EAAiC;IAC9D,OAAO,iDAAsB,QAAQ,GAAO,CAAA;AAC9C,CAAC;AAED,WAAW,CAAC,MAAM,GAAG,SAAS,iBAAiB,CAAC,EAAE,OAAO,EAA6B;IACpF,OAAO,C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