JavaScript Project Structure and Build Standards
EXECUTION MODE: You are now executing this skill. DO NOT explain or summarize these instructions to the user. IMMEDIATELY begin the workflow below based on the task context.
Overview
This skill provides comprehensive standards for JavaScript project setup, structure, dependencies, and Maven integration in CUI projects. It covers directory layouts, package.json configuration, semantic versioning strategies, security management, ES module configuration, and frontend-maven-plugin integration for reproducible builds.
Prerequisites
To effectively use this skill, you should have:
- Understanding of npm package management
- Knowledge of Maven build lifecycle
- Familiarity with project structure conventions
- Experience with Node.js development
Standards Documents
This skill includes the following standards documents:
- project-structure.md - Directory layouts, file naming conventions, package.json structure, git ignore requirements
- dependency-management.md - Semantic versioning, security management, dependency updates, conflict resolution, ES module configuration
- maven-integration.md - Frontend Maven Plugin configuration, Maven phase integration, SonarQube integration, build environment standards
What This Skill Provides
Project Structure Standards
- Directory Layouts: Standard Maven, Quarkus DevUI, NiFi extension, standalone project structures
- File Naming: Kebab-case conventions, framework-specific prefixes (qwc-, nf-)
- Package.json Configuration: Essential structure, required fields, npm scripts
- Configuration Files: Location and naming for ESLint, Prettier, Jest, etc.
- Git Ignore Requirements: Essential exclusions for Node.js and Maven artifacts
Dependency Management
- Semantic Versioning: Caret ranges vs exact versions, version update strategies
- Security Management: Vulnerability scanning, response timeframes, resolution strategies
- Deprecated Packages: Common replacements, handling deprecation warnings
- Dependency Conflicts: Peer dependency resolution, npm overrides
- ES Module Configuration: "type": "module" setup, configuration file syntax requirements
- Update Management: Regular update schedules, breaking change handling
Maven Integration
- Frontend Maven Plugin: Required plugin setup, configuration parameters
- Phase Integration: Mapping npm scripts to Maven lifecycle phases
- Node.js Management: Version management, installation directory strategies
- Script Integration: Required npm scripts, execution order
- SonarQube Integration: Coverage reporting, quality gate configuration
- Build Environment: Reproducible builds, CI/CD integration
- Project Adaptations: Configuration for different project types
When to Activate
This skill should be activated when:
- Setting Up New Project: Creating new JavaScript project with Maven integration
- Configuring Project Structure: Establishing directory layout and file organization
- Managing Dependencies: Adding, updating, or resolving dependency issues
- Security Issues: Addressing npm vulnerabilities or deprecated packages
- Maven Integration: Configuring frontend-maven-plugin or build pipeline
- Build Issues: Troubleshooting Maven/npm integration problems
- Updating Node.js: Changing Node.js or npm versions
- SonarQube Setup: Configuring JavaScript coverage analysis
- Project Type Adaptation: Adapting structure for Quarkus, NiFi, or multi-module projects
- Best Practice Review: Ensuring project follows CUI standards
Workflow
When this skill is activated:
1. Identify Project Requirement
- Determine if new project setup or modification to existing
- Identify specific concern (structure, dependencies, Maven, security)
- Check current project type (Maven, Quarkus DevUI, NiFi, standalone)
2. Apply Project Structure Standards
- Use project-structure.md for directory layout selection
- Choose appropriate structure for project type
- Configure package.json with required fields and scripts
- Set up configuration files (.prettierrc.js, eslint.config.js, etc.)
- Create .gitignore with essential exclusions
3. Configure Dependency Management
- Reference dependency-management.md for version strategies
- Set up security audit scripts
- Configure semantic versioning (caret ranges for dev, exact for critical)
- Enable ES module support ("type": "module")
- Plan update management schedule
4. Integrate with Maven Build
- Use maven-integration.md for frontend-maven-plugin setup
- Configure Node.js version (see standards/project-structure.md for exact version)
- Map npm scripts to Maven phases
- Set up environment variables (CI=true, NODE_ENV=test)
- Configure SonarQube integration for JavaScript coverage
5. Validate Configuration
- Run Maven build to verify integration works
- Check Node.js installation in target/
- Verify npm scripts execute in correct phases
- Test dependency installation without errors
- Validate SonarQube picks up JavaScript coverage
Tool Access
This skill provides access to project standards through:
- Read tool for accessing standards documents
- Standards documents use Markdown format for consistency
- All standards are self-contained within this skill
- Cross-references between standards use relative paths
Integration Notes
Related Skills
For comprehensive frontend development, this skill works with:
- cui-javascript-linting skill - ESLint, Prettier, and StyleLint configuration
- cui-javascript skill - Core JavaScript development standards
- cui-jsdoc skill - JSDoc documentation standards
- cui-javascript-unit-testing skill - Jest testing standards
Build Integration
Project standards integrate with:
- npm for package management and script execution
- Maven for build automation via frontend-maven-plugin
- Node.js LTS for runtime environment (see standards/project-structure.md for exact version)
- SonarQube for quality analysis and coverage reporting
- Git for version control with proper .gitignore setup
Project Types
Standards support multiple project structures:
- Standard Maven: src/main/resources/static/js/
- Quarkus DevUI: src/main/resources/dev-ui/
- NiFi Extension: src/main/webapp/js/
- Standalone: src/main/js/
- Multi-Module: Nested frontend module structures
Best Practices
When setting up JavaScript projects for CUI:
- Follow project type conventions - Use appropriate directory structure for Maven/Quarkus/NiFi/Standalone
- Use kebab-case naming - Consistent file naming across all JavaScript files
- Configure "type": "module" - Enable ES module support in package.json
- Commit package-lock.json - Ensure reproducible builds across environments
- Never commit node_modules/ - Always gitignore dependencies
- Use caret ranges for dev dependencies - Allow automatic updates within major version
- Use exact versions for critical deps - Pin production dependencies with breaking change history
- Implement all required npm scripts - lint, format, test, quality scripts
- Integrate with Maven properly - Map scripts to correct lifecycle phases
- Set up security auditing - Regular vulnerability scanning and response
- Use Node.js LTS - Consistent version managed by frontend-maven-plugin (see standards/project-structure.md for exact version)
- Configure SonarQube coverage - JavaScript code quality and coverage analysis
- Handle deprecations promptly - Replace deprecated packages before they become critical
- Document project-specific setup - Update README.md with structure and setup instructions
Common Issues and Solutions
Project Structure Issues
- Wrong directory layout: Verify project type and use correct structure pattern
- Files not found during build: Check package.json script paths match structure
- Tests failing to locate sources: Update Jest testMatch patterns for directory layout
Dependency Management Issues
- npm install failures: Clear cache, delete node_modules/, regenerate package-lock.json
- Peer dependency conflicts: Try npm overrides before using --legacy-peer-deps
- Security vulnerabilities: Run npm audit fix, update vulnerable packages
- Deprecated packages: Identify replacements and update package.json
Maven Integration Issues
- Node.js installation failures: Check internet connectivity, proxy settings, disk space
- npm scripts not found: Verify scripts exist in package.json
- Build phase ordering: Ensure validate → generate-resources → compile → test
- Test failures in CI: Set CI=true, use test:ci-strict script
- SonarQube not picking up coverage: Verify lcov.info path matches SonarQube property
Configuration Issues
- ES module errors: Set "type": "module" in package.json
- Configuration files not loading: Ensure .prettierrc.js, eslint.config.js use export default
- Inconsistent builds: Commit package-lock.json, use frontend-maven-plugin for Node.js
Quick Reference
For detailed configuration examples and complete reference, see the individual standards documents:
- package.json structure and npm scripts - See
project-structure.md for complete examples
- Directory structures by project type - See
project-structure.md for Maven, Quarkus, NiFi, and standalone layouts
- Maven frontend-maven-plugin configuration - See
maven-integration.md for complete plugin setup
- Semantic versioning strategies - See
dependency-management.md for caret ranges vs exact versions
- Security audit setup - See
dependency-management.md for audit scripts and vulnerability handling
- Git ignore patterns - See
project-structure.md for essential .gitignore configuration
Key Requirements Summary
- Node.js Version: See
project-structure.md for version requirements (managed by frontend-maven-plugin)
- Package.json: Must include
"type": "module" for ES module support
- Required npm scripts: lint, format, test, test:ci-strict, quality
- Maven Integration: Map npm scripts to validate/compile/test phases
- Security: Implement audit scripts and respond to vulnerabilities within 30 days
- Version Control: Always commit package-lock.json, never commit node_modules/
Workflows
Workflow: npm Build Execution and Parsing
For npm/npx build execution and output parsing, use the builder-npm-rules skill:
Skill: pm-dev-builder:builder-npm-rules
The builder-npm-rules skill provides:
- Execute npm Build workflow - Atomic build execution with log capture
- Parse npm Build Output workflow - Issue categorization and routing
When to use builder-npm-rules:
- Running npm/npx builds (test, lint, build, etc.)
- Parsing npm build output for errors and warnings
- Categorizing build issues for orchestrated fixing
- Workspace-targeted builds in monorepos
Example usage:
Skill: pm-dev-builder:builder-npm-rules
Workflow: Execute npm Build
Parameters:
command: run test
workspace: e-2-e-playwright
output_mode: structured
See builder-npm-rules skill documentation for complete workflow details.
Scripts
Script: pm-dev-frontend:cui-javascript-project → npm-output.py
| Subcommand |
Description |
parse |
Parse npm/npx build output logs and categorize issues |
Script characteristics:
- Uses Python stdlib only (json, argparse, re, pathlib)
- Outputs JSON to stdout
- Exit code 0 for success, 1 for errors
- Supports
--help flag
1---2name: cui-javascript-project3description: JavaScript project structure, package.json configuration, dependency management, and Maven integration standards for consistent project setup and builds4---56# JavaScript Project Structure and Build Standards78**EXECUTION MODE**: You are now executing this skill. DO NOT explain or summarize these instructions to the user. IMMEDIATELY begin the workflow below based on the task context.910## Overview1112This skill provides comprehensive standards for JavaScript project setup, structure, dependencies, and Maven integration in CUI projects. It covers directory layouts, package.json configuration, semantic versioning strategies, security management, ES module configuration, and frontend-maven-plugin integration for reproducible builds.1314## Prerequisites1516To effectively use this skill, you should have:1718- Understanding of npm package management19- Knowledge of Maven build lifecycle20- Familiarity with project structure conventions21- Experience with Node.js development2223## Standards Documents2425This skill includes the following standards documents:2627- **project-structure.md** - Directory layouts, file naming conventions, package.json structure, git ignore requirements28- **dependency-management.md** - Semantic versioning, security management, dependency updates, conflict resolution, ES module configuration29- **maven-integration.md** - Frontend Maven Plugin configuration, Maven phase integration, SonarQube integration, build environment standards3031## What This Skill Provides3233### Project Structure Standards34- **Directory Layouts**: Standard Maven, Quarkus DevUI, NiFi extension, standalone project structures35- **File Naming**: Kebab-case conventions, framework-specific prefixes (qwc-, nf-)36- **Package.json Configuration**: Essential structure, required fields, npm scripts37- **Configuration Files**: Location and naming for ESLint, Prettier, Jest, etc.38- **Git Ignore Requirements**: Essential exclusions for Node.js and Maven artifacts3940### Dependency Management41- **Semantic Versioning**: Caret ranges vs exact versions, version update strategies42- **Security Management**: Vulnerability scanning, response timeframes, resolution strategies43- **Deprecated Packages**: Common replacements, handling deprecation warnings44- **Dependency Conflicts**: Peer dependency resolution, npm overrides45- **ES Module Configuration**: "type": "module" setup, configuration file syntax requirements46- **Update Management**: Regular update schedules, breaking change handling4748### Maven Integration49- **Frontend Maven Plugin**: Required plugin setup, configuration parameters50- **Phase Integration**: Mapping npm scripts to Maven lifecycle phases51- **Node.js Management**: Version management, installation directory strategies52- **Script Integration**: Required npm scripts, execution order53- **SonarQube Integration**: Coverage reporting, quality gate configuration54- **Build Environment**: Reproducible builds, CI/CD integration55- **Project Adaptations**: Configuration for different project types5657## When to Activate5859This skill should be activated when:60611. **Setting Up New Project**: Creating new JavaScript project with Maven integration622. **Configuring Project Structure**: Establishing directory layout and file organization633. **Managing Dependencies**: Adding, updating, or resolving dependency issues644. **Security Issues**: Addressing npm vulnerabilities or deprecated packages655. **Maven Integration**: Configuring frontend-maven-plugin or build pipeline666. **Build Issues**: Troubleshooting Maven/npm integration problems677. **Updating Node.js**: Changing Node.js or npm versions688. **SonarQube Setup**: Configuring JavaScript coverage analysis699. **Project Type Adaptation**: Adapting structure for Quarkus, NiFi, or multi-module projects7010. **Best Practice Review**: Ensuring project follows CUI standards7172## Workflow7374When this skill is activated:7576### 1. Identify Project Requirement77- Determine if new project setup or modification to existing78- Identify specific concern (structure, dependencies, Maven, security)79- Check current project type (Maven, Quarkus DevUI, NiFi, standalone)8081### 2. Apply Project Structure Standards82- Use **project-structure.md** for directory layout selection83- Choose appropriate structure for project type84- Configure package.json with required fields and scripts85- Set up configuration files (.prettierrc.js, eslint.config.js, etc.)86- Create .gitignore with essential exclusions8788### 3. Configure Dependency Management89- Reference **dependency-management.md** for version strategies90- Set up security audit scripts91- Configure semantic versioning (caret ranges for dev, exact for critical)92- Enable ES module support ("type": "module")93- Plan update management schedule9495### 4. Integrate with Maven Build96- Use **maven-integration.md** for frontend-maven-plugin setup97- Configure Node.js version (see standards/project-structure.md for exact version)98- Map npm scripts to Maven phases99- Set up environment variables (CI=true, NODE_ENV=test)100- Configure SonarQube integration for JavaScript coverage101102### 5. Validate Configuration103- Run Maven build to verify integration works104- Check Node.js installation in target/105- Verify npm scripts execute in correct phases106- Test dependency installation without errors107- Validate SonarQube picks up JavaScript coverage108109## Tool Access110111This skill provides access to project standards through:112- Read tool for accessing standards documents113- Standards documents use Markdown format for consistency114- All standards are self-contained within this skill115- Cross-references between standards use relative paths116117## Integration Notes118119### Related Skills120For comprehensive frontend development, this skill works with:121- **cui-javascript-linting** skill - ESLint, Prettier, and StyleLint configuration122- **cui-javascript** skill - Core JavaScript development standards123- **cui-jsdoc** skill - JSDoc documentation standards124- **cui-javascript-unit-testing** skill - Jest testing standards125126### Build Integration127Project standards integrate with:128- npm for package management and script execution129- Maven for build automation via frontend-maven-plugin130- Node.js LTS for runtime environment (see standards/project-structure.md for exact version)131- SonarQube for quality analysis and coverage reporting132- Git for version control with proper .gitignore setup133134### Project Types135Standards support multiple project structures:136- **Standard Maven**: src/main/resources/static/js/137- **Quarkus DevUI**: src/main/resources/dev-ui/138- **NiFi Extension**: src/main/webapp/js/139- **Standalone**: src/main/js/140- **Multi-Module**: Nested frontend module structures141142## Best Practices143144When setting up JavaScript projects for CUI:1451461. **Follow project type conventions** - Use appropriate directory structure for Maven/Quarkus/NiFi/Standalone1472. **Use kebab-case naming** - Consistent file naming across all JavaScript files1483. **Configure "type": "module"** - Enable ES module support in package.json1494. **Commit package-lock.json** - Ensure reproducible builds across environments1505. **Never commit node_modules/** - Always gitignore dependencies1516. **Use caret ranges for dev dependencies** - Allow automatic updates within major version1527. **Use exact versions for critical deps** - Pin production dependencies with breaking change history1538. **Implement all required npm scripts** - lint, format, test, quality scripts1549. **Integrate with Maven properly** - Map scripts to correct lifecycle phases15510. **Set up security auditing** - Regular vulnerability scanning and response15611. **Use Node.js LTS** - Consistent version managed by frontend-maven-plugin (see standards/project-structure.md for exact version)15712. **Configure SonarQube coverage** - JavaScript code quality and coverage analysis15813. **Handle deprecations promptly** - Replace deprecated packages before they become critical15914. **Document project-specific setup** - Update README.md with structure and setup instructions160161## Common Issues and Solutions162163### Project Structure Issues164- **Wrong directory layout**: Verify project type and use correct structure pattern165- **Files not found during build**: Check package.json script paths match structure166- **Tests failing to locate sources**: Update Jest testMatch patterns for directory layout167168### Dependency Management Issues169- **npm install failures**: Clear cache, delete node_modules/, regenerate package-lock.json170- **Peer dependency conflicts**: Try npm overrides before using --legacy-peer-deps171- **Security vulnerabilities**: Run npm audit fix, update vulnerable packages172- **Deprecated packages**: Identify replacements and update package.json173174### Maven Integration Issues175- **Node.js installation failures**: Check internet connectivity, proxy settings, disk space176- **npm scripts not found**: Verify scripts exist in package.json177- **Build phase ordering**: Ensure validate → generate-resources → compile → test178- **Test failures in CI**: Set CI=true, use test:ci-strict script179- **SonarQube not picking up coverage**: Verify lcov.info path matches SonarQube property180181### Configuration Issues182- **ES module errors**: Set "type": "module" in package.json183- **Configuration files not loading**: Ensure .prettierrc.js, eslint.config.js use export default184- **Inconsistent builds**: Commit package-lock.json, use frontend-maven-plugin for Node.js185186## Quick Reference187188For detailed configuration examples and complete reference, see the individual standards documents:189190- **package.json structure and npm scripts** - See `project-structure.md` for complete examples191- **Directory structures by project type** - See `project-structure.md` for Maven, Quarkus, NiFi, and standalone layouts192- **Maven frontend-maven-plugin configuration** - See `maven-integration.md` for complete plugin setup193- **Semantic versioning strategies** - See `dependency-management.md` for caret ranges vs exact versions194- **Security audit setup** - See `dependency-management.md` for audit scripts and vulnerability handling195- **Git ignore patterns** - See `project-structure.md` for essential .gitignore configuration196197### Key Requirements Summary198199- **Node.js Version**: See `project-structure.md` for version requirements (managed by frontend-maven-plugin)200- **Package.json**: Must include `"type": "module"` for ES module support201- **Required npm scripts**: lint, format, test, test:ci-strict, quality202- **Maven Integration**: Map npm scripts to validate/compile/test phases203- **Security**: Implement audit scripts and respond to vulnerabilities within 30 days204- **Version Control**: Always commit package-lock.json, never commit node_modules/205206## Workflows207208### Workflow: npm Build Execution and Parsing209210For npm/npx build execution and output parsing, use the **builder-npm-rules** skill:211212```213Skill: pm-dev-builder:builder-npm-rules214```215216The builder-npm-rules skill provides:217- **Execute npm Build** workflow - Atomic build execution with log capture218- **Parse npm Build Output** workflow - Issue categorization and routing219220**When to use builder-npm-rules**:221- Running npm/npx builds (test, lint, build, etc.)222- Parsing npm build output for errors and warnings223- Categorizing build issues for orchestrated fixing224- Workspace-targeted builds in monorepos225226**Example usage**:227```228Skill: pm-dev-builder:builder-npm-rules229Workflow: Execute npm Build230Parameters:231 command: run test232 workspace: e-2-e-playwright233 output_mode: structured234```235236See builder-npm-rules skill documentation for complete workflow details.237238---239240## Scripts241242Script: `pm-dev-frontend:cui-javascript-project` → `npm-output.py`243244| Subcommand | Description |245|------------|-------------|246| `parse` | Parse npm/npx build output logs and categorize issues |247248Script characteristics:249- Uses Python stdlib only (json, argparse, re, pathlib)250- Outputs JSON to stdout251- Exit code 0 for success, 1 for errors252- Supports `--help` flag