Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/typescript-templatePublic template

Template repository containing an Nx Workspace with a TypeScript Library. It uses tsc for building and Vitest for unit testing.

NotificationsYou must be signed in to change notification settings

nrwl/typescript-template

Repository files navigation

✨ A repository showcasing keyNx features for TypeScript monorepos ✨

📦 Project Overview

This repository demonstrates a production-ready TypeScript monorepo with:

  • 3 Publishable Packages - Ready for NPM publishing

    • @org/strings - String manipulation utilities
    • @org/async - Async utility functions with retry logic
    • @org/colors - Color conversion and manipulation utilities
  • 1 Internal Library

    • @org/utils - Shared utilities (private, not published)

🚀 Quick Start

# Clone the repositorygit clone<your-fork-url>cd typescript-template# Install dependenciesnpm install# Build all packagesnpx nx run-many -t build# Run testsnpx nx run-many -ttest# Lint all projectsnpx nx run-many -t lint# Run everything in parallelnpx nx run-many -t linttest build --parallel=3# Visualize the project graphnpx nx graph

⭐ Featured Nx Capabilities

This repository showcases several powerful Nx features:

1. 🔒 Module Boundaries

Enforces architectural constraints using tags. Each package has specific dependencies it can use:

  • scope:shared (utils) - Can be used by all packages
  • scope:strings - Can only depend on shared utilities
  • scope:async - Can only depend on shared utilities
  • scope:colors - Can only depend on shared utilities

Try it out:

# See the current project graph and boundariesnpx nx graph# View a specific project's detailsnpx nx show project strings --web

Learn more about module boundaries →

2. 🛠️ Custom Run Commands

Packages can define custom commands beyond standard build/test/lint:

# Run the custom build-base command for strings packagenpx nx run strings:build-base# See all available targets for a projectnpx nx show project strings

Learn more about custom run commands →

3. 🔧 Self-Healing CI

The CI pipeline includesnx fix-ci which automatically identifies and suggests fixes for common issues. To test it, you can make a change toasync-retry.spec.ts so that it fails, and create a PR.

# Run tests and see the failurenpx nxtest async# In CI, this command provides automated fixesnpx nx fix-ci

Learn more about self-healing CI →

4. 📦 Package Publishing

Manage releases and publishing with Nx Release:

# Dry run to see what would be publishednpx nx release --dry-run# Version and release packagesnpx nx release# Publish only specific packagesnpx nx release publish --projects=strings,colors

Learn more about Nx Release →

📁 Project Structure

├── packages/│   ├── strings/     [scope:strings] - String utilities (publishable)│   ├── async/       [scope:async]   - Async utilities (publishable)│   ├── colors/      [scope:colors]  - Color utilities (publishable)│   └── utils/       [scope:shared]  - Shared utilities (private)├── nx.json          - Nx configuration├── tsconfig.json    - TypeScript configuration└── eslint.config.mjs - ESLint with module boundary rules

🏷️ Understanding Tags

This repository uses tags to enforce module boundaries:

PackageTagCan Import From
@org/utilsscope:sharedNothing (base library)
@org/stringsscope:stringsscope:shared
@org/asyncscope:asyncscope:shared
@org/colorsscope:colorsscope:shared

The ESLint configuration enforces these boundaries, preventing circular dependencies and maintaining clean architecture.

🧪 Testing Module Boundaries

To see module boundary enforcement in action:

  1. Try importing@org/colors into@org/strings
  2. Runnpx nx lint strings
  3. You'll see an error about violating module boundaries

📚 Useful Commands

# Project explorationnpx nx graph# Interactive dependency graphnpx nx list# List installed pluginsnpx nx show project strings --web# View project details# Developmentnpx nx build strings# Build a specific packagenpx nxtest async# Test a specific packagenpx nx lint colors# Lint a specific package# Running multiple tasksnpx nx run-many -t build# Build all projectsnpx nx run-many -ttest --parallel=3# Test in parallelnpx nx run-many -t linttest build# Run multiple targets# Affected commands (great for CI)npx nx affected -t build# Build only affected projectsnpx nx affected -ttest# Test only affected projects# Release managementnpx nx release --dry-run# Preview release changesnpx nx release# Create a new release

Nx Cloud

Nx Cloud ensures afast and scalable CI pipeline. It includes features such as:

🔗 Learn More

💬 Community

Join the Nx community:

About

Template repository containing an Nx Workspace with a TypeScript Library. It uses tsc for building and Vitest for unit testing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp