Skip to content

Commit 5d713a5

Browse files
committed
Release v1.0.0
- Add standalone 'watch' command for continuous compilation - Update all documentation for CLI command parity - Update templates with TypeScript/SCSS, CDN, and areas sections - Remove preview designation from version
1 parent d7b30f6 commit 5d713a5

7 files changed

Lines changed: 87 additions & 33 deletions

File tree

README.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ It wraps `esbuild` behind a simple `.NET + YAML` workflow:
2020

2121
This is for ASP.NET devs who want modern bundling without committing to the full Node toolchain.
2222

23-
> **Status:** v1.0.0-preview.x - Core implementation complete. Production-ready for early adopters. Expect breaking changes until v1.0.
23+
> **Status:** v1.0 - Production-ready.
2424
2525
## Installation
2626

@@ -37,7 +37,7 @@ This is the only package required for both **runtime** and **production builds**
3737

3838
### 2. Install the CLI tool (optional)
3939

40-
The CLI provides commands for development compilation, production builds, and diagnostics (`dev`, `build`, `init`, `check`):
40+
The CLI provides commands for development compilation, production builds, and diagnostics (`dev`, `watch`, `build`, `init`, `check`):
4141

4242
```bash
4343
# Global install (available everywhere)
@@ -49,7 +49,7 @@ dotnet tool install MvcFrontendKit.Cli
4949
```
5050

5151
> **Note:** The CLI is **not required** for production builds. Production bundling is handled automatically by MSBuild targets during `dotnet publish -c Release`. However, the CLI is useful for:
52-
> - Development: Compile TypeScript/SCSS on-the-fly with `dotnet frontend dev`
52+
> - Development: Compile TypeScript/SCSS with `dotnet frontend dev` or `dotnet frontend watch`
5353
> - Standalone builds: Build bundles without running MSBuild with `dotnet frontend build` (useful for CDN workflows)
5454
> - Diagnostics: Validate configuration and assets with `dotnet frontend check`
5555
@@ -111,7 +111,7 @@ Add helpers to your `_Layout.cshtml` or equivalent:
111111
dotnet frontend dev
112112

113113
# Or watch for changes (recommended)
114-
dotnet frontend dev --watch
114+
dotnet frontend watch
115115
```
116116
Then run your app with `dotnet run` or `dotnet watch run`.
117117

@@ -330,14 +330,14 @@ global:
330330

331331
### Development Workflow
332332

333-
For development, use the `dev` command to compile TypeScript and SCSS files:
333+
For development, use the `dev` or `watch` command to compile TypeScript and SCSS files:
334334

335335
```bash
336336
# One-time compilation
337337
dotnet frontend dev
338338
339339
# Watch mode (recommended)
340-
dotnet frontend dev --watch
340+
dotnet frontend watch
341341
```
342342

343343
This compiles your source files to `.js` and `.css` next to the originals, which are then served by the development helpers with cache-busting.
@@ -428,9 +428,12 @@ dotnet frontend init --force # Overwrite existing
428428
429429
# Compile TypeScript/SCSS for development
430430
dotnet frontend dev # One-time compilation
431-
dotnet frontend dev --watch # Watch mode with auto-recompile
432431
dotnet frontend dev --verbose # Show detailed output
433432
433+
# Watch for changes and recompile
434+
dotnet frontend watch # Continuous watch mode
435+
dotnet frontend watch --verbose # Show detailed output
436+
434437
# Validate configuration and assets
435438
dotnet frontend check # Basic check
436439
dotnet frontend check --verbose # Detailed output
@@ -445,15 +448,12 @@ dotnet frontend build --verbose # Show detailed build output
445448

446449
### Development Compilation (`dev`)
447450

448-
The `dev` command compiles TypeScript and SCSS files to JavaScript and CSS for development. This enables you to use TypeScript and SCSS without running production builds during development.
451+
The `dev` command compiles TypeScript and SCSS files to JavaScript and CSS for development (one-time).
449452

450453
```bash
451454
# Compile all TypeScript/SCSS files from frontend.config.yaml
452455
dotnet frontend dev
453456
454-
# Watch for changes and recompile automatically
455-
dotnet frontend dev --watch
456-
457457
# Show compilation details
458458
dotnet frontend dev --verbose
459459
```
@@ -465,10 +465,18 @@ dotnet frontend dev --verbose
465465
- Output files are placed next to source files (e.g., `site.ts` → `site.js`)
466466
- Source maps are generated for debugging
467467

468-
**Watch mode:**
468+
### Watch Mode (`watch`)
469+
470+
The `watch` command compiles and then monitors for changes:
471+
469472
```bash
470-
dotnet frontend dev --watch
473+
# Start watching for changes
474+
dotnet frontend watch
475+
476+
# With detailed output
477+
dotnet frontend watch --verbose
471478
```
479+
472480
- Monitors your `jsRoot` and `cssRoot` directories for changes
473481
- Automatically recompiles when `.ts`, `.tsx`, `.scss`, or `.sass` files change
474482
- Shows compilation results in real-time
@@ -480,12 +488,12 @@ dotnet frontend dev --watch
480488
dotnet watch run
481489
482490
# Terminal 2: Watch and compile frontend assets
483-
dotnet frontend dev --watch
491+
dotnet frontend watch
484492
```
485493

486494
This gives you:
487495
- Hot reload for C# code (via `dotnet watch`)
488-
- Auto-compilation for TypeScript/SCSS (via `frontend dev --watch`)
496+
- Auto-compilation for TypeScript/SCSS (via `frontend watch`)
489497
- Browser refresh to see changes
490498

491499
### View Diagnostics (`--view` and `--all`)

SPEC.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ A small, .NET-native helper tool named **MvcFrontendKit** that:
2222
- Adds **components** as reusable JS/CSS units for partials, with runtime deduplication.
2323
- Plays nicely with `dotnet run` / `dotnet watch` without introducing HMR or SPA-level complexity.
2424

25-
Out of scope (for this version):
25+
Out of scope:
2626

2727
- Full SPA-style integration for Vue/React (dev servers, HMR).
28-
- CDN base URL for manifest URLs (implemented), SRI hashes and advanced incremental build caching (reserved as future extensions).
28+
- SRI hashes and advanced incremental build caching (reserved as future extensions).
2929

3030
### 1.1 Preprocessor Support (TypeScript & SCSS)
3131

@@ -105,8 +105,11 @@ This is a zero-config feature:
105105
- Subsequent calls to `FrontendInclude("...")` for the same component emit nothing.
106106

107107
5. **CLI helper** (optional but recommended)
108-
- `dotnet frontend init`
109-
- `dotnet frontend check [--verbose]`
108+
- `dotnet frontend init` — scaffold configuration
109+
- `dotnet frontend check [--verbose]` — validate config and assets
110+
- `dotnet frontend dev [--verbose]` — compile TS/SCSS for development (one-time)
111+
- `dotnet frontend watch [--verbose]` — compile and watch for changes
112+
- `dotnet frontend build [--dry-run] [--verbose]` — production build (standalone)
110113

111114
> **No HMR**
112115
> This tool does not provide hot module replacement. JS/CSS changes require a normal browser refresh. It is compatible with `dotnet watch` for Razor recompilation, but does not hook into ASP.NET hot reload semantics.
@@ -774,14 +777,41 @@ This helper is optional and intended for development troubleshooting. It can saf
774777
- `global.js` / `global.css` paths.
775778
- `views.overrides[*].js` / `css` paths.
776779
- `components[*].js` / `css` paths.
780+
- `areas[*].js` / `css` paths.
777781
- Checks CSS files in bundling scope:
778782
- Warns or errors on disallowed `../` URLs based on `cssUrlPolicy`.
779783
- With `--verbose`, additionally:
780784
- Prints mapping of view keys to Dev assets and Prod bundle keys.
781785
- Prints component graph (including `depends`) and warns about cycles.
782-
- May optionally inspect esbuild’s module graph to warn about circular JS imports (while still allowing them).
786+
- Displays CDN and areas configuration.
787+
- May optionally inspect esbuild's module graph to warn about circular JS imports (while still allowing them).
783788
- Optionally warns if any predicted bundle exceeds a configurable size threshold (e.g., 500KB).
784789

790+
### 10.3 `dotnet frontend dev [--verbose]`
791+
792+
- Compiles TypeScript and SCSS files to JavaScript and CSS for development.
793+
- Reads `frontend.config.yaml` to find all TypeScript (`.ts`, `.tsx`) and SCSS (`.scss`, `.sass`) files.
794+
- Compiles TypeScript using esbuild's native TypeScript loader.
795+
- Compiles SCSS using the bundled Dart Sass compiler.
796+
- Output files are placed next to source files (e.g., `site.ts``site.js`).
797+
- Source maps are generated for debugging.
798+
- With `--verbose`, shows detailed compilation output for each file.
799+
800+
### 10.4 `dotnet frontend watch [--verbose]`
801+
802+
- Same as `dev`, but continues running and monitors for changes.
803+
- Watches `jsRoot` and `cssRoot` directories for file changes.
804+
- Automatically recompiles when `.ts`, `.tsx`, `.scss`, or `.sass` files are modified.
805+
- Shows compilation results in real-time.
806+
- Press `Ctrl+C` to stop watching.
807+
808+
### 10.5 `dotnet frontend build [--dry-run] [--verbose]`
809+
810+
- Performs a production build identical to what MSBuild targets do during `dotnet publish -c Release`.
811+
- Useful for CDN workflows where bundles need to be generated independently of the publish process.
812+
- With `--dry-run`, previews bundles without writing files.
813+
- With `--verbose`, shows detailed build output including bundle sizes.
814+
785815
---
786816

787817
## 11. Migration Guidance (summary)
@@ -853,7 +883,10 @@ The tool ships from v1 as two NuGet packages:
853883
- Strongly recommended for development and CI workflows.
854884
- Exposes the `frontend` command:
855885
- `dotnet frontend init` — scaffold a fully commented `frontend.config.yaml`.
856-
- `dotnet frontend check [--verbose]` — validate config, discover assets, and report problems before a build/publish.
886+
- `dotnet frontend check [--verbose]` — validate config, discover assets, and report problems.
887+
- `dotnet frontend dev [--verbose]` — compile TypeScript/SCSS for development.
888+
- `dotnet frontend watch [--verbose]` — compile and watch for changes.
889+
- `dotnet frontend build [--dry-run] [--verbose]` — production build (standalone).
857890
- Shares the same core parsing / validation logic as the library (via a shared project or internal package) so semantics stay in sync.
858891

859892
Versioning & compatibility:

src/MvcFrontendKit.Cli/MvcFrontendKit.Cli.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Nullable>enable</Nullable>
88
<PackAsTool>true</PackAsTool>
99
<ToolCommandName>dotnet-frontend</ToolCommandName>
10-
<Version>1.0.0-preview.29</Version>
10+
<Version>1.0.0</Version>
1111
<Authors>stef-k</Authors>
1212
<Description>CLI tool for MvcFrontendKit - compile TypeScript/SCSS during development, validate config and check assets. Uses esbuild and Dart Sass.</Description>
1313
<PackageTags>aspnetcore;mvc;razor;bundling;esbuild;sass;scss;typescript;frontend;cli</PackageTags>

src/MvcFrontendKit.Cli/Program.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static int Main(string[] args)
2020
"check" => HandleCheckCommand(args),
2121
"build" => HandleBuildCommand(args),
2222
"dev" => HandleDevCommand(args),
23+
"watch" => HandleWatchCommand(args),
2324
"help" or "--help" or "-h" => ShowHelp(),
2425
"version" or "--version" or "-v" => ShowVersion(),
2526
_ => UnknownCommand(command)
@@ -34,6 +35,12 @@ static int HandleDevCommand(string[] args)
3435
return DevCommand.Execute(verbose, watch);
3536
}
3637

38+
static int HandleWatchCommand(string[] args)
39+
{
40+
var verbose = args.Contains("--verbose") || args.Contains("-v");
41+
return DevCommand.Execute(verbose, watch: true);
42+
}
43+
3744
static int HandleCheckCommand(string[] args)
3845
{
3946
var verbose = args.Contains("--verbose") || args.Contains("-v");
@@ -68,7 +75,8 @@ static void PrintUsage()
6875
Console.WriteLine("Commands:");
6976
Console.WriteLine(" init Create frontend.config.yaml with default settings");
7077
Console.WriteLine(" check Validate config and check if assets exist");
71-
Console.WriteLine(" dev Compile TypeScript/SCSS for development");
78+
Console.WriteLine(" dev Compile TypeScript/SCSS for development (once)");
79+
Console.WriteLine(" watch Compile and watch for changes");
7280
Console.WriteLine(" build Build frontend bundles (production)");
7381
Console.WriteLine(" help Show this help message");
7482
Console.WriteLine(" version Show version information");
@@ -96,10 +104,15 @@ static int ShowHelp()
96104
Console.WriteLine(" --skip-imports Skip import path validation");
97105
Console.WriteLine();
98106
Console.WriteLine(" dev [options]");
99-
Console.WriteLine(" Compile TypeScript and SCSS files for development.");
107+
Console.WriteLine(" Compile TypeScript and SCSS files for development (one-time).");
100108
Console.WriteLine(" Creates .js files alongside .ts files, and .css files alongside .scss files.");
101109
Console.WriteLine(" --verbose Show detailed compilation output");
102110
Console.WriteLine();
111+
Console.WriteLine(" watch [options]");
112+
Console.WriteLine(" Compile and watch for changes (continuous).");
113+
Console.WriteLine(" Same as 'dev' but keeps running and recompiles on file changes.");
114+
Console.WriteLine(" --verbose Show detailed compilation output");
115+
Console.WriteLine();
103116
Console.WriteLine(" build [options]");
104117
Console.WriteLine(" Build frontend bundles (same as 'dotnet publish -c Release' but standalone).");
105118
Console.WriteLine(" Useful for CDN workflows where you need bundles before deploying.");
@@ -108,9 +121,9 @@ static int ShowHelp()
108121
Console.WriteLine();
109122
Console.WriteLine("Workflow:");
110123
Console.WriteLine(" Development:");
111-
Console.WriteLine(" 1. Run 'dotnet frontend dev' to compile TS/SCSS to JS/CSS");
112-
Console.WriteLine(" 2. Run 'dotnet run' to start your app (serves raw JS/CSS files)");
113-
Console.WriteLine(" 3. After changes, re-run 'dotnet frontend dev'");
124+
Console.WriteLine(" 1. Run 'dotnet frontend watch' to compile and watch for changes");
125+
Console.WriteLine(" 2. In another terminal, run 'dotnet run' to start your app");
126+
Console.WriteLine(" Or use 'dotnet frontend dev' for one-time compilation");
114127
Console.WriteLine();
115128
Console.WriteLine(" Production:");
116129
Console.WriteLine(" Run 'dotnet publish -c Release' which automatically:");
@@ -122,7 +135,7 @@ static int ShowHelp()
122135
Console.WriteLine("Examples:");
123136
Console.WriteLine(" dotnet frontend init");
124137
Console.WriteLine(" dotnet frontend dev");
125-
Console.WriteLine(" dotnet frontend dev --verbose");
138+
Console.WriteLine(" dotnet frontend watch");
126139
Console.WriteLine(" dotnet frontend check --all");
127140
Console.WriteLine(" dotnet frontend build --dry-run");
128141
return 0;

src/MvcFrontendKit.Cli/Templates/frontend.config.template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ configVersion: 1
1111
# Just use .ts/.scss extensions in your file paths below - no config needed!
1212
#
1313
# CLI Commands:
14-
# dotnet frontend dev - One-time compile of TS/SCSS for development
14+
# dotnet frontend dev - Compile TS/SCSS for development (once)
15+
# dotnet frontend watch - Compile and watch for changes
1516
# dotnet frontend build - Production build with bundling and hashing
16-
# dotnet frontend watch - Watch mode for continuous compilation
1717
# dotnet frontend check - Validate configuration and assets
1818
# ============================================================================
1919

src/MvcFrontendKit/MvcFrontendKit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<Version>1.0.0-preview.29</Version>
7+
<Version>1.0.0</Version>
88
<Authors>stef-k</Authors>
99
<Description>Node-free frontend bundling toolkit for ASP.NET Core MVC / Razor applications. Uses esbuild for JS/TS bundling and Dart Sass for SCSS compilation.</Description>
1010
<PackageTags>aspnetcore;mvc;razor;bundling;esbuild;sass;scss;typescript;frontend</PackageTags>

src/MvcFrontendKit/Templates/frontend.config.template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ configVersion: 1
1111
# Just use .ts/.scss extensions in your file paths below - no config needed!
1212
#
1313
# CLI Commands:
14-
# dotnet frontend dev - One-time compile of TS/SCSS for development
14+
# dotnet frontend dev - Compile TS/SCSS for development (once)
15+
# dotnet frontend watch - Compile and watch for changes
1516
# dotnet frontend build - Production build with bundling and hashing
16-
# dotnet frontend watch - Watch mode for continuous compilation
1717
# dotnet frontend check - Validate configuration and assets
1818
# ============================================================================
1919

0 commit comments

Comments
 (0)