Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/generate-llms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Generate LLMs files

on:
workflow_dispatch:

permissions:
contents: write

jobs:
generate:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Copy prod env file
run: |
echo "${{ secrets.ENV_PROD }}" | base64 -d > .env
rm -f .env.local

- name: Generate llms.txt
run: node scripts/generate-llms.mjs
env:
LLMS_MODE: curated

- name: Generate llms-full.txt
run: node scripts/generate-llms.mjs
env:
LLMS_MODE: full

- name: Commit and push generated files
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add public/keepsimple_/
if ! git diff --cached --quiet; then
git commit -m "chore: regenerate llms files"
git push
fi
1 change: 1 addition & 0 deletions cypress/e2e/uxcore/bias-modal.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('UX Core Bias Page: Availability Heuristics', () => {
});
it('Should open the first question and verify URL and content', () => {
cy.get('[data-cy="open-question"]').first().click();
cy.wait(4000);
cy.url().should('include', '/why-our-company-is-having-reputation-issue#0');
});

Expand Down
1 change: 1 addition & 0 deletions cypress/support/commands.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { mount } from 'cypress/react';

import buttonText from '@data/buttonText';

declare global {
Expand Down
66 changes: 66 additions & 0 deletions cypress/support/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { mount } from 'cypress/react';

import buttonText from '@data/buttonText';

declare global {
namespace Cypress {
interface Chainable {
/**
* Custom command to check all external links on the page.
* @param excludedDomains Array of domain strings to skip
* @param selector CSS selector for links (defaults to 'a')
*/
checkExternalLinks(
excludedDomains?: string[],
selector?: string,
): Chainable<void>;

checkH1(expectedText: string): Chainable<void>;

scrollToSection(sectionText: string): Chainable<void>;

validateAllImages(): Chainable<void>;

uxcgTestSearchBehavior(
validWord: string,
invalidWord: string,
): Chainable<void>;

checkSocialMediaLink(title: string, domain: string): Chainable<void>;

showCopiedTooltip(): Chainable<void>;

clickArrowWhenReady(
direction: 'next' | 'prev',
expectedUrlPart: string,
): Chainable<void>;

showMoreAndLess(): Chainable<void>;

uxcoreSearchBehavior: (
validWord: string,
invalidWord: string,
) => Chainable<void>;

playAudio(): Chainable<void>;

checkPyramidChange(
bluePyramidId: string,
orangePyramidId: string,
purplePyramidId: string,
): Chainable<void>;

checkSwiperSlide(prevUrl, nextUrl): Chainable<void>;

uxcpSearchBehavior(
validWord: string,
invalidWord: string,
): Chainable<void>;

uxcpAddBiases: () => Chainable<void>;
checkAllLinks: (routes) => Chainable<void>;
openLoginModalByButtonClick: (buttonLabel: string) => Chainable<void>;
loginBySession: () => Chainable<void>;
}
}
}
54 changes: 51 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FlatCompat } from '@eslint/eslintrc';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand All @@ -9,15 +10,20 @@ const compat = new FlatCompat({
baseDirectory: __dirname,
});

// eslint-disable-next-line import/no-anonymous-default-export
export default [
{
ignores: ['.next/**', 'node_modules/**', 'out/**', 'build/**'],
ignores: ['.next/**', 'out/**', 'build/**', 'next-env.d.ts'],
},

...compat.extends('next/core-web-vitals', 'next/typescript'),

{
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
// ── TypeScript ───────────────────────────────────────────────────────
'@typescript-eslint/ban-ts-comment': [
'warn',
{
Expand All @@ -28,7 +34,49 @@ export default [
},
],
'@typescript-eslint/no-explicit-any': 'off',
'react-hooks/exhaustive-deps': 'off',

// ── Import order ─────────────────────────────────────────────────────
'simple-import-sort/imports': [
'error',
{
groups: [
// 1. Side-effect imports (e.g. `import 'reflect-metadata'`)
['^\\u0000'],
// 2. Node built-ins (e.g. `node:url`, `path`, `fs`)
['^node:'],
// 3. Third-party packages (react, next, classnames, lodash…)
['^@?\\w'],
// 4. Styles alias
['^@styles(?:/.*)?$'],
// 5. Constants alias
['^@constants(?:/.*)?$'],
// 6. Types / local-types aliases
['^@local-types(?:/.*)?$'],
// 7. Hooks alias
['^@hooks(?:/.*)?$'],
// 8. Lib alias
['^@lib(?:/.*)?$'],
// 9. API alias
['^@api(?:/.*)?$'],
// 10. Data alias
['^@data(?:/.*)?$'],
// 11. Icons alias
['^@icons(?:/.*)?$'],
// 12. Components alias
['^@components(?:/.*)?$'],
// 13. Layouts alias
['^@layouts(?:/.*)?$'],
// 14. Catch-all for any other @ aliases (e.g. src/…)
['^@/', '^src/'],
// 15. Relative imports (non-style)
['^\\.(?!.*\\.(?:css|scss|sass|less)$)'],
// 16. Style imports (CSS / SCSS)
['^.+\\.(?:css|scss|sass|less)$'],
],
},
],
'simple-import-sort/exports': 'error',
'import/newline-after-import': 'error',
},
},
];
4 changes: 3 additions & 1 deletion middleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NextRequest, NextResponse } from 'next/server';
import { getRedirectMap } from './lib/getUXCoreRedirects';

import { getUXCGRedirects } from './lib/getUXCGRedirects';
import { getRedirectMap } from './lib/getUXCoreRedirects';

const PUBLIC_FILE = /\.(.*)$/;
const supportedLocales = ['en', 'ru', 'hy'];
Expand Down Expand Up @@ -79,5 +80,6 @@ export const config = {
'/:locale/uxcore/:path*',
'/uxcg/:path*',
'/:locale/uxcg/:path*',
'/((?!api|_next/static|_next/image|uxcore_|favicon.ico).*)',
],
};
12 changes: 12 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ module.exports = async () => {
source: '/robots.txt',
destination: '/uxcore_/robots.txt',
},
{
source: '/llms.txt',
destination: '/uxcore_/llms.txt',
},
{
source: '/llms-full.txt',
destination: '/uxcore_/llms-full.txt',
},
{
source: '/llms-full-pages/:path*',
destination: '/uxcore_/llms-full-pages/:path*',
},
];
},
experimental: {
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"test:firefox": "cypress run --browser firefox",
"test:edge": "cypress run --browser edge",
"test:all": "npm run test:chrome && npm run test:firefox && npm run test:edge",
"prepare": "husky install"
"prepare": "husky install",
"generate:llms": "tsx --tsconfig scripts/tsconfig.json scripts/generate-llms.ts",
"generate:llms:full": "tsx --tsconfig scripts/tsconfig.json scripts/generate-llms-full.ts"
},
"lint-staged": {
"**/*.{ts,tsx}": [
Expand All @@ -34,7 +36,8 @@
"cypress-v10-preserve-cookie": "^1.2.1",
"date-fns": "2.30.0",
"dotenv": "^16.4.5",
"geoip-lite": "1.4.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"fast-geoip": "^1.1.88",
"html2canvas": "^1.4.1",
"lodash.debounce": "4.0.8",
"lodash.unescape": "4.0.1",
Expand Down Expand Up @@ -88,6 +91,7 @@
"sass-loader": "13.1.0",
"start-server-and-test": "^2.0.12",
"ts-node": "^10.9.2",
"tsx": "^4.19.2",
"typescript": "5.2.2"
}
}
4 changes: 0 additions & 4 deletions public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ Disallow: /hy/uxcgstory/
Disallow: /hy/uxcgdiy/
Disallow: /hy/uiux/
Disallow: /hy/awareness-test/
Disallow: /hy/table-of-contents/
Disallow: /hy/why-study-management/
Disallow: /hy/what-is-a-project/
Disallow: /hy/project-artifacts-and-their-importance/
Disallow: /hy/project-management-environment/
Disallow: /hy/philosophies-methodologies-and-frameworks/
Disallow: /hy/software-development-life-cycles/
Expand Down
7 changes: 7 additions & 0 deletions scripts/generate-llms-full.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process.env.LLMS_OUTPUT_FILE = 'uxcore_/llms-full.txt';
// Large enough to include all current UXCore (105) and UXCG entries.
process.env.LLMS_DYNAMIC_LIMIT = '1000';
process.env.LLMS_WRITE_SLUG_MDS = 'true';
process.env.LLMS_SLUG_MD_DIR = 'uxcore_/llms-full-pages';

void import('./generate-llms');
Loading
Loading