Skip to content

0.32.0#1771

Merged
mattlewis92 merged 31 commits intomainfrom
next
Sep 1, 2025
Merged

0.32.0#1771
mattlewis92 merged 31 commits intomainfrom
next

Conversation

@mattlewis92
Copy link
Copy Markdown
Owner

@mattlewis92 mattlewis92 commented Aug 23, 2025

Tip

Try out the next version before it's marked as stable with npm i angular-calendar@next

To be in the release (aim is just to get everything modernized and working with the latest angular 20 version rather than any new features):

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 23, 2025

Codecov Report

❌ Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.91%. Comparing base (dd1ddec) to head (657a720).
⚠️ Report is 33 commits behind head on main.

Files with missing lines Patch % Lines
...les/common/calendar-a11y/calendar-a11y.provider.ts 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1771      +/-   ##
==========================================
+ Coverage   97.49%   97.91%   +0.41%     
==========================================
  Files          39       42       +3     
  Lines         679      671       -8     
  Branches      143      145       +2     
==========================================
- Hits          662      657       -5     
  Misses          1        1              
+ Partials       16       13       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mattlewis92 and others added 14 commits August 24, 2025 18:32
Co-authored-by: mattlewis92 <6425649+mattlewis92@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
BREAKING CHANGE: The angular-draggable-droppable and angular-resizable-element dependencies should now be installed as dependencies to use this package

Fixes #1761

Fixes #1547
BREAKING CHANGE: the compiled .css is no longer auto prefixed. If using the angular CLI, it will automatically do this for you when you build your app
… functions (#1774)

BREAKING CHANGE: if extending the `CalendarWeekViewComponent` or `CalendarMonthViewComponent` components, or using custom templates, all track by helper functions have been removed in favor of `@for` and inlining the `track` expression inside the template

Before:
```
<ng-template let-day="day" let-trackByEventId="trackByEventId">
	<div *ngFor="let event of day.events; trackBy: trackByEventId">{{ event.title }}</div>
</ng-template>
```

After:
```
<ng-template let-day="day">
	@for (event of day.events; track event.id ?? event) {
		<div>{{ event.title }}</div>
    }
</ng-template>
```
…tor based DI (#1776)

BREAKING CHANGE: if extending any of the built in classes and you implement a constructor, you no longer need to call `super()` with any injectables
…es instead

BREAKING CHANGE: native Intl.PluralRules is now required to use this library, this should be available in all browsers supported by angular though
@mattlewis92 mattlewis92 requested a review from Copilot August 25, 2025 15:44

This comment was marked as outdated.

mattlewis92 and others added 8 commits August 25, 2025 17:08
BREAKING CHANGE: angular 20.2.0 or higher is now required to use this package

Closes #1769

Closes #1770
… in ng-add schematic (#1783)

Co-authored-by: mattlewis92 <6425649+mattlewis92@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@mattlewis92 mattlewis92 changed the title 0.32.0 WIP 0.32.0 Aug 25, 2025
BREAKING CHANGE: date-fns v4 is now required to use this package
@mattlewis92 mattlewis92 marked this pull request as ready for review August 25, 2025 19:58
@mattlewis92 mattlewis92 requested a review from Copilot August 25, 2025 19:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates angular-calendar from version 0.31.1 to 0.32.0, modernizing the codebase to work with Angular 20+ and implementing several architectural improvements including migrating to standalone components, new control flow syntax, and the inject() pattern.

Key changes:

  • Migration to standalone components and deprecation of NgModule-based CalendarModule
  • Adoption of Angular's new control flow syntax (@if, @for, @switch instead of *ngIf, *ngFor, *ngSwitch)
  • Migration from constructor injection to the inject() function pattern
  • Update from Sass @import to @use syntax for better module system compliance

Reviewed Changes

Copilot reviewed 269 out of 271 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig-date-adapters.json Updates module and target to ES2015 for modern JavaScript support
projects/demos/styles.scss Migrates from @import to @use syntax for Sass imports
projects/demos/main.ts Complete rewrite from NgModule to standalone bootstrapping with provider configuration
projects/demos/index.html Updates title to reflect Angular 20.2+ compatibility
Multiple template files Systematic migration to new Angular control flow syntax
Multiple component files Migration to standalone components with inject() pattern and proper imports
Multiple module files Removal of NgModule files as part of standalone migration
Multiple sources files Updates to new import system with text loader attributes
Comments suppressed due to low confidence (1)

projects/demos/main.ts:1

  • The @ts-expect-error comment is repeated throughout the codebase. Consider adding a more descriptive comment explaining why TypeScript cannot provide types for the 'with { loader: "text" }' syntax and potentially referencing the relevant TypeScript issue or documentation.
import { enableProdMode, importProvidersFrom } from '@angular/core';

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@atsjo
Copy link
Copy Markdown

atsjo commented Aug 26, 2025

everything seems to work fine except my tests, it worked with 31.1, but with next they fail with this error:

SyntaxError: Named export 'getMonthView' not found. The requested module 'calendar-utils' is a CommonJS module, which may not support all module.exports as named exports.

I use nx with vitest via analogjs for testing...

@mattlewis92
Copy link
Copy Markdown
Owner Author

everything seems to work fine except my tests, it worked with 31.1, but with next they fail with this error:

SyntaxError: Named export 'getMonthView' not found. The requested module 'calendar-utils' is a CommonJS module, which may not support all module.exports as named exports.

I use nx with vitest via analogjs for testing...

Any chance you could put together a minimal repro where I can reproduce the issue? I'm not sure what would have changed there to cause this issue (especially as calendar-utils is shipped as dual esm + commonjs so it should be picking up the esm version)

@atsjo
Copy link
Copy Markdown

atsjo commented Aug 26, 2025

I'll see if I get time later today or tomorrow...
Seems very easy to reproduce using latest nx with vitest and creating a custom calendar based on angular-calendar@next

@mattlewis92
Copy link
Copy Markdown
Owner Author

I'll see if I get time later today or tomorrow... Seems very easy to reproduce using latest nx with vitest and creating a custom calendar based on angular-calendar@next

I'm unable to reproduce my end - I made a new project via npx create-nx-workspace vitest-angular-test --unitTestRunner=vitest angular-standalone

Installed these deps:

    "angular-calendar": "^0.32.0-next.5",
    "angular-draggable-droppable": "^9.0.1",
    "angular-resizable-element": "^8.0.0",
    "date-fns": "^4.1.0",

Set the root app to:

import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { NxWelcome } from './nx-welcome';
import {
  provideCalendar,
  DateAdapter,
  CalendarMonthViewComponent,
} from 'angular-calendar';
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';

@Component({
  imports: [NxWelcome, RouterModule, CalendarMonthViewComponent],
  selector: 'app-root',
  template: `
    <mwl-calendar-month-view [viewDate]="viewDate" [events]="events" />
    <app-nx-welcome></app-nx-welcome>
    <router-outlet></router-outlet>
  `,
  styleUrl: './app.scss',
  providers: [
    provideCalendar({
      provide: DateAdapter,
      useFactory: adapterFactory,
    }),
  ],
})
export class App {
  protected title = 'vitest-angular-test';
  viewDate = new Date();
  events = [];
}

and verified vitest was able to run:
CleanShot 2025-08-26 at 17 29 57@2x

@atsjo
Copy link
Copy Markdown

atsjo commented Aug 26, 2025

I'm guessing it's only a problem when using pnpm, I'll try and verify

@atsjo
Copy link
Copy Markdown

atsjo commented Aug 26, 2025

here is a repro: https://github.com/atsjo/repro.git
clone -> pnpm i -> pnpm nx test repro

Basically the same as you did, but stripped some generated setup, used pnpm and running zoneless...
When running vitest I have to use pool: 'thread' in vitest.config.mts , or else all angulat test fail with

Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
Error: module is already linked
 ❯ [kLink] ../../node:internal/vm/module:363:19
 ❯ ../../node:internal/vm/module:354:13

if running with pool: 'thread' as in the repro it fails with

SyntaxError: Named export 'getMonthView' not found. The requested module 'calendar-utils' is a CommonJS module, which may not support all module.exports as named exports.

This setup works fine with the former angular-calendar...

@atsjo
Copy link
Copy Markdown

atsjo commented Aug 26, 2025

tried using your exact description with npm and minimal changes using zonejs... still the same problem, repro here: https://github.com/atsjo/vitest-angular-test.git

clone -> npm i -> npm exec nx test

I have tested this with node 22.18 and node 24.6, but only on windows...
So the problem is not related to pnpm @mattlewis92

@mattlewis92
Copy link
Copy Markdown
Owner Author

tried using your exact description with npm and minimal changes using zonejs... still the same problem, repro here: atsjo/vitest-angular-test.git

clone -> npm i -> npm exec nx test

I have tested this with node 22.18 and node 24.6, but only on windows... So the problem is not related to pnpm @mattlewis92

Thank you, I was able to reproduce! Hacking around locally I was able to fix the issue by adding an exports to the package.json for calendar-utils (the same as we have for the main package). Honestly I'm a bit confused how this was ever working with the previous version or why it just broke 🤷‍♂️ But it's a simple enough fix, I will get a release out later today

@atsjo
Copy link
Copy Markdown

atsjo commented Aug 27, 2025

calendar-utils@0.12.1 fixed the problem with that package, now it fails with the positioning package, requiring the same fix

SyntaxError: Named export 'positionElements' not found. The requested module 'positioning' is a CommonJS module, which may not support all module.exports as named exports.

@mattlewis92
Copy link
Copy Markdown
Owner Author

calendar-utils@0.12.1 fixed the problem with that package, now it fails with the positioning package, requiring the same fix

SyntaxError: Named export 'positionElements' not found. The requested module 'positioning' is a CommonJS module, which may not support all module.exports as named exports.

Thanks, working on it!

@mattlewis92
Copy link
Copy Markdown
Owner Author

@atsjo I just published 0.32.0-next.6 and it now works in your sample project. Thanks for reporting this issue!

@atsjo
Copy link
Copy Markdown

atsjo commented Aug 27, 2025

thanks! new version run tests fine in the project I actually use it as well... When will we see a final release @mattlewis92 ?

@mattlewis92
Copy link
Copy Markdown
Owner Author

thanks! new version run tests fine in the project I actually use it as well... When will we see a final release @mattlewis92 ?

Awesome! I just want to test the new version in my work application where we have a heavy usage of this library as well, just to sanity check everything works OK, and then will release as final once I do that sometime in the next few days

@mattlewis92 mattlewis92 merged commit 657a720 into main Sep 1, 2025
2 checks passed
@mattlewis92 mattlewis92 deleted the next branch September 1, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants