Skip to content

Commit 0ffa296

Browse files
committed
refactor: remove outdated test targets and standardize environment setup
- Removed redundant `test` targets from project configurations. - Standardized `local` environment naming across documentation and scripts. - Updated scaffolding templates to reflect changes, ensuring consistency for new projects. - Simplified CI and workflow scripts by eliminating unnecessary steps.
1 parent b214410 commit 0ffa296

File tree

15 files changed

+48
-108
lines changed

15 files changed

+48
-108
lines changed

.github/workflows/nx-optimized-ci.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,9 @@ jobs:
5353
- name: Install dependencies
5454
run: pnpm install --no-frozen-lockfile
5555

56-
- name: Run type checking
57-
run: npx nx affected --target=typecheck --parallel=3
58-
59-
- name: Run linting
60-
run: npx nx affected --target=lint --parallel=3
61-
62-
- name: Build affected projects
56+
- name: Build affected projects for deployment validation
6357
run: npx nx affected --target=build --parallel=3
6458

65-
- name: Validate deployment configuration
66-
run: node scripts/test-site-builds.js --site all --env production --skip-build
59+
- name: Run deployment-critical tests
60+
run: npx nx affected --target=test --parallel=3
6761

.husky/pre-push-optimized

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "dev" ]; then
5757

5858
# 3. Run configuration validation for all sites (fast, no build)
5959
echo "⚙️ Validating all site configurations..."
60-
node scripts/test-site-builds.js --site all --env localhost --skip-build
60+
node scripts/test-site-builds.js --site all --env local --skip-build
6161
if [ $? -ne 0 ]; then
6262
echo "❌ Site configuration validation failed."
6363
exit 1

CLAUDE.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
88
- **Package manager**: Always use `pnpm` (never npm or yarn)
99
- **Build single site**: `pnpm build standards/{name}` or `nx build {name}`
1010
- **Start dev server**: `pnpm start:{site}` (e.g., `pnpm start:portal`, `pnpm start:isbdm`)
11-
- **Test execution**: `pnpm test --skip-nx-cache` (always skip nx cache for tests)
11+
- **Test execution**: `pnpm test` (uses nx cache for performance with nx-affected)
1212
- **Type checking**: `pnpm typecheck`
1313
- **Linting**: `pnpm lint`
1414

@@ -29,7 +29,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
2929
- **Environment-specific**: `nx run standards-dev:e2e:site-validation:production`
3030

3131
#### Build & Configuration Testing
32-
- **Config validation**: `node scripts/test-site-builds.js --site all --env localhost --skip-build`
32+
- **Config validation**: `node scripts/test-site-builds.js --site all --env local --skip-build`
3333
- **Full build tests**: `node scripts/test-site-builds.js --site all --env production`
3434
- **Affected builds**: `nx run standards-dev:build-affected`
3535
- **Build validation**: `nx run standards-dev:validate:builds`
@@ -147,6 +147,12 @@ standards-dev/
147147
- **E2E testing**: Playwright for interface testing when needed
148148
- **Always test before commits**: Tests must pass before offering to commit
149149

150+
### Scaffolding and Templates
151+
- **CRITICAL**: Always check and update scaffolding templates when making configuration changes that affect all sites
152+
- **Template locations**: `scripts/site-template.ts` and `scripts/scaffold-site.ts`
153+
- **Pattern**: When fixing issues in existing sites, verify the scaffold template doesn't propagate the same issue to future sites
154+
- **Example**: If removing test targets from existing sites, also remove from site template
155+
150156
## Test Placement Decision Tree (CRITICAL - Reference When Creating Tests)
151157

152158
**ALWAYS use this decision tree when creating new tests to ensure they run in the correct scenario:**
@@ -261,7 +267,7 @@ const { workspaceRoot, scriptsDir, tmpDir, packagesDir, themeDir } = setupTestPa
261267
### Deployment and Build Management
262268
- **Server coordination**: Ask user to start servers/builds rather than waiting for timeouts
263269
- **Environment awareness**: Warn when environment isn't set to project root
264-
- **Nx optimization**: Use `--skip-nx-cache` for reliable test runs
270+
- **Nx optimization**: Use nx cache for performance; only skip with `--skip-nx-cache` when debugging cache-specific issues
265271

266272
## Vocabulary and Content Management
267273

@@ -391,7 +397,7 @@ nx run standards-dev:validate:builds # Post-build validation
391397

392398
# Script-based testing
393399
node scripts/test-site-builds.js --site all --env production
394-
node scripts/test-site-builds.js --site portal --env localhost --skip-build
400+
node scripts/test-site-builds.js --site portal --env local --skip-build
395401
```
396402

397403
#### Comprehensive Test Suites

TESTING_STRATEGY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ nx affected --target=lint --parallel=3
119119
nx affected --target=test --parallel=3
120120

121121
# Configuration validation only
122-
node scripts/test-site-builds.js --site all --env localhost --skip-build
122+
node scripts/test-site-builds.js --site all --env local --skip-build
123123

124124
# Representative build test (if portal affected)
125125
nx run portal:build
@@ -132,7 +132,7 @@ nx affected --target=test --parallel=3
132132
nx affected --target=build --parallel=3
133133

134134
# Complete configuration validation
135-
node scripts/test-site-builds.js --site all --env localhost --skip-build
135+
node scripts/test-site-builds.js --site all --env local --skip-build
136136

137137
# Critical E2E (if portal affected)
138138
nx run portal:e2e

developer_notes/build-regression-testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pnpm test:builds:production # All sites production build
4848
pnpm test:portal:e2e # Portal end-to-end testing
4949

5050
# Individual site testing
51-
node scripts/test-site-builds.js --site ISBDM --env localhost
51+
node scripts/test-site-builds.js --site ISBDM --env local
5252
./scripts/test-portal-builds.sh
5353
```
5454

@@ -234,7 +234,7 @@ IFLA Standards Site Regression Testing
234234

235235
### 3. Build Process Tests
236236
**Location**: `scripts/test-site-builds.js`
237-
**Command**: `node scripts/test-site-builds.js --site ISBDM --env localhost`
237+
**Command**: `node scripts/test-site-builds.js --site ISBDM --env local`
238238

239239
#### Build Verification:
240240
-**Compilation Success**: All TypeScript/MDX files compile

developer_notes/command-line-scripts/build-with-env.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ pnpm build --env production --site portal
1414
# Build all sites for preview environment with theme rebuild
1515
pnpm build --env preview --site all --clean-theme
1616

17-
# Build single standard for localhost
18-
pnpm build --env localhost --site isbdm
17+
# Build single standard for local
18+
pnpm build --env local --site isbdm
1919
```
2020

2121
### Options
22-
- `--env` : Environment to build for (localhost, preview, production)
22+
- `--env` : Environment to build for (local, preview, production)
2323
- `--site` : Site to build (all, portal, isbdm, lrm, frbr, isbd, muldicat, unimarc)
2424
- `--clean-theme` : Clean and rebuild theme package before building
2525

@@ -35,7 +35,7 @@ pnpm build --env localhost --site isbdm
3535
1. **Environment Configuration**
3636
- Sets `DOCS_ENV` environment variable before building
3737
- This affects how Docusaurus configures URLs and paths
38-
- Valid environments: `localhost`, `preview`, `production`
38+
- Valid environments: `local`, `preview`, `production`
3939

4040
2. **Interactive Mode**
4141
- Uses `inquirer` to prompt for missing options
@@ -72,7 +72,7 @@ pnpm build --env localhost --site isbdm
7272
### Environment Impact
7373

7474
The `DOCS_ENV` variable affects:
75-
- **localhost**: baseUrl = '/', url = 'http://localhost:3000'
75+
- **local**: baseUrl = '/', url = 'http://local:3000'
7676
- **preview**: baseUrl = '/standards-dev/', url = 'https://iflastandards.github.io'
7777
- **production**: baseUrl = '/', url = 'https://www.iflastandards.info'
7878

@@ -112,7 +112,7 @@ To add new build options:
112112
**Daily Development**
113113
```bash
114114
# Quick build for testing
115-
pnpm build --env localhost --site portal
115+
pnpm build --env local --site portal
116116
```
117117

118118
**Before PR/Deployment**

portal/project.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,6 @@
4343
},
4444
"cache": false
4545
},
46-
"test": {
47-
"executor": "@nx/vite:test",
48-
"options": {
49-
"config": "{workspaceRoot}/vite.config.ts",
50-
"testPathPattern": ["{projectRoot}/src/**/*.{test,spec}.{js,ts,jsx,tsx}"]
51-
},
52-
"outputs": ["{projectRoot}/coverage"],
53-
"cache": true,
54-
"inputs": [
55-
"default",
56-
"{projectRoot}/src/**/*.{test,spec}.{js,ts,jsx,tsx}",
57-
"{workspaceRoot}/vite.config.ts",
58-
"{workspaceRoot}/vitest.config.*"
59-
]
60-
},
6146
"typecheck": {
6247
"executor": "nx:run-commands",
6348
"options": {

scripts/site-template.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,6 @@ export const SITE_TEMPLATE = {
108108
},
109109
cache: false
110110
},
111-
test: {
112-
executor: "@nx/vite:test",
113-
options: {
114-
config: "{workspaceRoot}/vite.config.ts",
115-
testPathPattern: ["{projectRoot}/src/**/*.{test,spec}.{js,ts,jsx,tsx}"]
116-
},
117-
outputs: ["{projectRoot}/coverage"],
118-
cache: true,
119-
inputs: [
120-
"default",
121-
"{projectRoot}/src/**/*.{test,spec}.{js,ts,jsx,tsx}",
122-
"{workspaceRoot}/vite.config.ts",
123-
"{workspaceRoot}/vitest.config.*"
124-
]
125-
},
126111
typecheck: {
127112
executor: "nx:run-commands",
128113
options: {

standards/FRBR/project.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@
4343
},
4444
"cache": false
4545
},
46-
"test": {
47-
"executor": "@nx/vite:test",
48-
"options": {
49-
"config": "{workspaceRoot}/vite.config.ts",
50-
"testPathPattern": ["{projectRoot}/src/**/*.{test,spec}.{js,ts,jsx,tsx}"]
51-
},
52-
"outputs": ["{projectRoot}/coverage"],
53-
"cache": true
54-
},
5546
"e2e": {
5647
"executor": "nx:run-commands",
5748
"options": {

standards/ISBDM/tsconfig.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"paths": {
6+
"@ifla/theme": ["../../packages/theme/src/index.ts"],
7+
"@ifla/theme/*": ["../../packages/theme/src/*"],
8+
"@ifla/theme/components": ["../../packages/theme/src/components/index.ts"],
9+
"@ifla/theme/components/*": ["../../packages/theme/src/components/*"],
10+
"@ifla/theme/config": ["../../packages/theme/src/config/index.ts"],
11+
"@ifla/theme/config/*": ["../../packages/theme/src/config/*"],
12+
"@ifla/theme/styles": ["../../packages/theme/src/styles/index.css"],
13+
"@ifla/theme/utils": ["../../packages/theme/src/utils/index.ts"],
14+
"@ifla/theme/utils/*": ["../../packages/theme/src/utils/*"]
15+
}
16+
},
17+
"include": [
18+
"src/**/*",
19+
"docs/**/*",
20+
"docusaurus.config.ts",
21+
"sidebars.ts",
22+
"navbar.ts"
23+
]
24+
}

0 commit comments

Comments
 (0)