npm package: @fnd-platform/core
Description: Core Projen project classes for fnd-platform monorepo scaffolding
Latest version: 1.0.0-alpha.7

# @fnd-platform/core

Core package for the fnd-platform toolkit, providing Projen project classes for scaffolding production-ready monorepo projects.

## Installation

```bash
npm install -D @fnd-platform/core projen
# or
pnpm add -D @fnd-platform/core projen
```

## Quick Start

Create a `.projenrc.ts` file in your project root:

```typescript
import { FndMonorepoProject } from '@fnd-platform/core';

const project = new FndMonorepoProject({
  name: 'my-app',
  defaultReleaseBranch: 'main',
});

project.synth();
```

Run Projen to generate all configuration files:

```bash
npx projen
```

## What Gets Generated

Running synthesis with `FndMonorepoProject` generates:

- `package.json` - Root package with workspace scripts
- `pnpm-workspace.yaml` - pnpm workspace configuration
- `nx.json` - NX build orchestration with caching
- `tsconfig.base.json` - Shared TypeScript configuration
- `.eslintrc.js` - Shared ESLint configuration
- `.prettierrc` - Shared Prettier configuration
- `vitest.config.ts` - Vitest test configuration
- `.gitignore` - Standard git ignores
- `packages/` - Directory for workspace packages

## Configuration Options

```typescript
interface FndMonorepoProjectOptions {
  // Required
  name: string; // Project name
  defaultReleaseBranch: string; // Default branch for releases

  // Optional
  workspacePackages?: string[]; // Package directories (default: ['packages/*'])
  nxCache?: boolean; // Enable NX caching (default: true)
  nxCacheableOperations?: string[]; // Operations to cache (default: ['build', 'test', 'lint'])
  description?: string; // Project description
  repository?: string; // Git repository URL
  authorName?: string; // Author name
  authorEmail?: string; // Author email
}
```

## Examples

### Custom Workspace Layout

```typescript
const project = new FndMonorepoProject({
  name: 'my-app',
  defaultReleaseBranch: 'main',
  workspacePackages: ['packages/*', 'apps/*', 'tools/*'],
});
```

### Disable NX Caching

```typescript
const project = new FndMonorepoProject({
  name: 'my-app',
  defaultReleaseBranch: 'main',
  nxCache: false,
});
```

### Add Custom Cacheable Operations

```typescript
const project = new FndMonorepoProject({
  name: 'my-app',
  defaultReleaseBranch: 'main',
  nxCacheableOperations: ['build', 'test', 'lint', 'e2e'],
});
```

## API Reference

See the [full API documentation](../../docs/api/modules/core_src.html) for detailed type definitions and examples.

### Project Classes

- `FndMonorepoProject` - Main project class for creating monorepos

### Types

```typescript
import type { FndMonorepoProjectOptions, NxTargetConfig } from '@fnd-platform/core';
```

### Components

The package also exports individual components for advanced usage:

```typescript
import {
  PnpmWorkspace,
  NxConfig,
  SharedTypeScript,
  SharedEslint,
  SharedPrettier,
  SharedVitest,
} from '@fnd-platform/core';

// Component options types
import type {
  PnpmWorkspaceOptions,
  NxConfigOptions,
  SharedTypescriptOptions,
  SharedEslintOptions,
  SharedPrettierOptions,
  SharedVitestOptions,
} from '@fnd-platform/core';
```

Each component can be used independently with any Projen project.

## Generated Scripts

The following npm scripts are added to the root `package.json`:

| Script          | Description                      |
| --------------- | -------------------------------- |
| `build`         | Build all packages with NX       |
| `test`          | Run tests across all packages    |
| `test:coverage` | Run tests with coverage          |
| `lint`          | Lint all packages                |
| `format`        | Format all files with Prettier   |
| `format:check`  | Check formatting without changes |

## Requirements

- Node.js 20+
- pnpm 8+
- Projen 0.80+

## Related

- [fnd-platform documentation](../../docs/README.md)
- [Projen documentation](https://projen.io/docs/)

## License

MIT