Skip to content

Commit 57a43d9

Browse files
Merge pull request #1729 from analogjs/beta
chore: release 1.16.1
2 parents ae01c01 + bc2c2d4 commit 57a43d9

File tree

56 files changed

+2093
-1531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2093
-1531
lines changed

.github/ISSUE_TEMPLATE/01-bug-report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ body:
3232
- platform
3333
- trpc
3434
- astro-angular
35+
- storybook-angular
3536
- Docs
3637
- Don't know / other
3738
validations:

.github/ISSUE_TEMPLATE/02-feature-request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ body:
2323
- platform
2424
- trpc
2525
- astro-angular
26+
- storybook-angular
2627
- Docs
2728
- Don't know / other
2829
validations:

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
env:
1111
NODE_OPTIONS: --max-old-space-size=16384
1212
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
13+
NX_VERBOSE_LOGGING: ${{ vars.NX_VERBOSE_LOGGING }}
1314

1415
concurrency:
1516
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
## [1.16.1-beta.8](https://github.com/analogjs/analog/compare/v1.16.1-beta.7...v1.16.1-beta.8) (2025-05-12)
2+
3+
### Bug Fixes
4+
5+
- **platform:** add support for Nx 21 release ([#1727](https://github.com/analogjs/analog/issues/1727)) ([ef442a7](https://github.com/analogjs/analog/commit/ef442a7ae2a1292535ea9e22d65998d56f45a4b9))
6+
7+
## [1.16.1-beta.7](https://github.com/analogjs/analog/compare/v1.16.1-beta.6...v1.16.1-beta.7) (2025-05-12)
8+
9+
### Bug Fixes
10+
11+
- **vite-plugin-angular:** adjust output path for library dts files ([#1728](https://github.com/analogjs/analog/issues/1728)) ([54390e0](https://github.com/analogjs/analog/commit/54390e019a0841ad3d538275197b71b8bbc3f60f))
12+
13+
## [1.16.1-beta.6](https://github.com/analogjs/analog/compare/v1.16.1-beta.5...v1.16.1-beta.6) (2025-05-10)
14+
15+
### Bug Fixes
16+
17+
- **vite-plugin-angular:** improve support for building Angular libraries ([#1724](https://github.com/analogjs/analog/issues/1724)) ([a2d9141](https://github.com/analogjs/analog/commit/a2d9141c72cd56575138dcfe9f54e36768b33b30))
18+
19+
## [1.16.1-beta.5](https://github.com/analogjs/analog/compare/v1.16.1-beta.4...v1.16.1-beta.5) (2025-05-10)
20+
21+
### Bug Fixes
22+
23+
- **storybook-angular:** include preset as ESM for Windows support ([#1725](https://github.com/analogjs/analog/issues/1725)) ([c8bace5](https://github.com/analogjs/analog/commit/c8bace5c221e90fcab97c5c25eca8ec92fa6981f))
24+
25+
## [1.16.1-beta.4](https://github.com/analogjs/analog/compare/v1.16.1-beta.3...v1.16.1-beta.4) (2025-05-09)
26+
27+
### Bug Fixes
28+
29+
- **vite-plugin-angular:** defer initial compilation in Vitest VSCode extension ([#1721](https://github.com/analogjs/analog/issues/1721)) ([fc89624](https://github.com/analogjs/analog/commit/fc896241683cc1c74fdb21b5565cf82e0549d522))
30+
31+
## [1.16.1-beta.3](https://github.com/analogjs/analog/compare/v1.16.1-beta.2...v1.16.1-beta.3) (2025-05-09)
32+
33+
### Bug Fixes
34+
35+
- **nx-plugin:** update Angular v19 template files ([#1720](https://github.com/analogjs/analog/issues/1720)) ([9b1e065](https://github.com/analogjs/analog/commit/9b1e06576c491093d18ac03622e12b57cf5aa9d1))
36+
37+
## [1.16.1-beta.2](https://github.com/analogjs/analog/compare/v1.16.1-beta.1...v1.16.1-beta.2) (2025-05-09)
38+
39+
### Performance Improvements
40+
41+
- **vite-plugin-angular:** optimize memory usage for large workspaces ([#1719](https://github.com/analogjs/analog/issues/1719)) ([6364190](https://github.com/analogjs/analog/commit/6364190da3212d1d29fded36fe9d2deea1fa7be5))
42+
43+
## [1.16.1-beta.1](https://github.com/analogjs/analog/compare/v1.16.0...v1.16.1-beta.1) (2025-04-30)
44+
45+
### Bug Fixes
46+
47+
- **vite-plugin-nitro:** check for custom apiPrefix with api directory ([#1715](https://github.com/analogjs/analog/issues/1715)) ([11c4f36](https://github.com/analogjs/analog/commit/11c4f36bb76e74dda2cffa08a6b17dd6cea069c4))
48+
149
# [1.16.0](https://github.com/analogjs/analog/compare/v1.15.1...v1.16.0) (2025-04-29)
250

351
### Bug Fixes
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Component } from '@angular/core';
2+
import { MyPackageComponent } from 'my-package';
3+
4+
@Component({
5+
imports: [MyPackageComponent],
6+
template: ` <lib-my-package /> `,
7+
})
8+
export default class PackagePageComponent {}

apps/analog-app/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default defineConfig(({ mode, isSsrBuild }) => {
4444
supportAnalogFormat: true,
4545
},
4646
},
47-
liveReload: true,
47+
liveReload: false,
4848
nitro: {
4949
routeRules: {
5050
'/cart/**': {
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
import Tabs from '@theme/Tabs';
2+
import TabItem from '@theme/TabItem';
3+
4+
# Building an Angular Library
5+
6+
Angular libraries are built for supporting many different services and functionality. Angular libraries can be built using Vite that can be published to npm.
7+
8+
## Creating a Library
9+
10+
If you are creating a new package, use the `library` schematic:
11+
12+
```sh
13+
ng generate lib my-lib
14+
```
15+
16+
For an existing library, follow the setup instructions.
17+
18+
## Setup
19+
20+
Install the `@analogjs/platform` package:
21+
22+
<Tabs groupId="package-manager">
23+
<TabItem value="npm">
24+
25+
```shell
26+
npm install @analogjs/platform --save-dev
27+
```
28+
29+
</TabItem>
30+
31+
<TabItem label="Yarn" value="yarn">
32+
33+
```shell
34+
yarn add @analogjs/platform --dev
35+
```
36+
37+
</TabItem>
38+
39+
<TabItem value="pnpm">
40+
41+
```shell
42+
pnpm install -w @analogjs/platform
43+
```
44+
45+
</TabItem>
46+
</Tabs>
47+
48+
Next, create a `vite.config.ts` at the root of the project, and configure it to build the library.
49+
50+
> Update the references to `my-lib` to match the library project name.
51+
52+
```ts
53+
import { defineConfig } from 'vite';
54+
import angular from '@analogjs/vite-plugin-angular';
55+
56+
export default defineConfig(({ mode }) => ({
57+
root: __dirname,
58+
cacheDir: '../../node_modules/.vite/libs/my-lib',
59+
plugins: [angular()],
60+
resolve: {
61+
mainFields: ['module'],
62+
},
63+
build: {
64+
target: ['esnext'],
65+
sourcemap: true,
66+
lib: {
67+
// Library entry point
68+
entry: 'src/public-api.ts',
69+
70+
// Package output path, must contain fesm2022
71+
fileName: `fesm2022/my-lib`,
72+
73+
// Publish as ESM package
74+
formats: ['es'],
75+
},
76+
rollupOptions: {
77+
// Add external libraries that should be excluded from the bundle
78+
external: [/^@angular\/.*/, 'rxjs', 'rxjs/operators'],
79+
output: {
80+
// Produce a single file bundle
81+
preserveModules: false,
82+
},
83+
},
84+
minify: false,
85+
},
86+
}));
87+
```
88+
89+
Next, update the project configuration to use the `@analogjs/platform:vite` builder to build the library.
90+
91+
```json
92+
{
93+
"name": "my-lib",
94+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
95+
"sourceRoot": "projects/my-lib/src",
96+
"prefix": "lib",
97+
"projectType": "library",
98+
"architect": {
99+
"build": {
100+
"builder": "@analogjs/platform:vite",
101+
"options": {
102+
"configFile": "projects/my-lib/vite.config.ts",
103+
"outputPath": "dist/projects/my-lib"
104+
},
105+
"defaultConfiguration": "production",
106+
"configurations": {
107+
"development": {
108+
"mode": "development"
109+
},
110+
"production": {
111+
"sourcemap": true,
112+
"mode": "production"
113+
}
114+
}
115+
}
116+
}
117+
}
118+
```
119+
120+
Adjust the `package.json` at the root of the project to point to the built output. Include any necessary `dependencies` or `peerDependencies` that are needed when installing the package.
121+
122+
```json
123+
{
124+
"name": "my-lib",
125+
"description": "A description of the Angular library",
126+
"type": "module",
127+
"peerDependencies": {
128+
"@angular/common": "^19.0.0",
129+
"@angular/core": "^19.0.0"
130+
},
131+
"dependencies": {
132+
"tslib": "^2.0.0"
133+
},
134+
"types": "./src/public-api.d.ts",
135+
"exports": {
136+
"./package.json": {
137+
"default": "./package.json"
138+
},
139+
".": {
140+
"import": "./fesm2022/my-lib.mjs",
141+
"require": "./fesm2022/my-lib.mjs",
142+
"default": "./fesm2022/my-lib.mjs"
143+
}
144+
},
145+
"sideEffects": false,
146+
"publishConfig": {
147+
"access": "public"
148+
}
149+
}
150+
```
151+
152+
## Copying Assets
153+
154+
Static assets in the `public` directory are copied to the build output directory by default. If you want to copy additional assets outside of that directory, use the `nxCopyAssetsPlugin` Vite plugin.
155+
156+
Import the plugin and set it up:
157+
158+
```ts
159+
/// <reference types="vitest" />
160+
161+
import { defineConfig } from 'vite';
162+
import analog from '@analogjs/vite-plugin';
163+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
164+
165+
// https://vitejs.dev/config/
166+
export default defineConfig(({ mode }) => ({
167+
// ...
168+
plugins: [angular(), nxCopyAssetsPlugin(['*.md', 'package.json'])],
169+
}));
170+
```
171+
172+
## Building the Library
173+
174+
Run the build command:
175+
176+
```sh
177+
ng build my-lib
178+
```
179+
180+
## Publishing the Library
181+
182+
After logging using `npm login`, use the `npm publish` command to publish the package.
183+
184+
To see the output without publishing, use the `--dry-run` flag.
185+
186+
```sh
187+
npm publish dist/projects/my-lib --dry-run
188+
```
189+
190+
To publish the library to npm:
191+
192+
```sh
193+
npm publish dist/projects/my-lib
194+
```

apps/docs-app/docs/integrations/angular-material/index.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,22 @@ pnpm install @angular/cdk @angular/material
3939
</TabItem>
4040
</Tabs>
4141

42-
> Make sure you have installed `sass` version 1.85.1 or higher.
43-
4442
## Step 2: Configuring the Angular Material library
4543

46-
1. Rename the file `styles.css` to `styles.scss`.
47-
2. Set the `inlineStylesExtension` property to `'scss'` in the `vite.config.ts` file:
44+
1. Rename the `src/styles.css` file to `src/styles.scss`.
45+
2. If you're using `zone.js`, configure the `scss` preprocessorOptions to use the `legacy` api.
46+
3. Set the `inlineStylesExtension` property to `'scss'` in the `vite.config.ts` file:
4847

4948
```ts
5049
export default defineConfig(({ mode }) => {
5150
return {
51+
css: {
52+
preprocessorOptions: {
53+
scss: {
54+
api: 'legacy',
55+
},
56+
},
57+
},
5258
plugins: [
5359
analog({
5460
vite: {
@@ -60,7 +66,7 @@ export default defineConfig(({ mode }) => {
6066
});
6167
```
6268

63-
3. Update the `index.html` file to reference the SCSS file:
69+
4. Update the `index.html` file to reference the SCSS file:
6470

6571
```html
6672
<head>
@@ -81,7 +87,7 @@ export default defineConfig(({ mode }) => {
8187
</body>
8288
```
8389

84-
4. Update the `styles.scss` file to import the Angular Material styles and define your custom theme:
90+
5. Update the `styles.scss` file to import the Angular Material styles and define your custom theme:
8591

8692
```scss
8793
@use '@angular/material' as mat;

apps/docs-app/sidebars.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ const sidebars = {
185185
id: 'guides/migrating',
186186
label: 'Migrating an Angular app to Analog',
187187
},
188+
{
189+
type: 'doc',
190+
id: 'guides/libraries',
191+
label: 'Building an Angular library',
192+
},
188193
{
189194
type: 'doc',
190195
id: 'guides/compatibility',

libs/my-package/.eslintrc.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"extends": [
8+
"plugin:@nx/angular",
9+
"plugin:@angular-eslint/template/process-inline-templates"
10+
],
11+
"rules": {
12+
"@angular-eslint/directive-selector": [
13+
"error",
14+
{
15+
"type": "attribute",
16+
"prefix": "lib",
17+
"style": "camelCase"
18+
}
19+
],
20+
"@angular-eslint/component-selector": [
21+
"error",
22+
{
23+
"type": "element",
24+
"prefix": "lib",
25+
"style": "kebab-case"
26+
}
27+
]
28+
}
29+
},
30+
{
31+
"files": ["*.html"],
32+
"extends": ["plugin:@nx/angular-template"],
33+
"rules": {}
34+
}
35+
]
36+
}

0 commit comments

Comments
 (0)