Skip to content

Commit 16035f4

Browse files
committed
feat(angular-rspack): add angular-rspack package
1 parent fb99c3e commit 16035f4

28 files changed

+1749
-498
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,6 @@ tasks/
110110
.upstreamdocs.local.json
111111

112112
astro-docs/.netlify
113+
114+
packages/angular-rspack/coverage
115+
packages/angular-rspack-compiler/coverage

nx.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,15 @@
8484
"projects": [
8585
"packages/*",
8686
"packages/nx/native-packages/*",
87-
"!angular-rspack-compiler"
87+
"!angular-rspack-compiler",
88+
"!angular-rspack"
8889
],
8990
"version": {
9091
"manifestRootsToUpdate": ["dist/packages/{projectName}"]
9192
}
9293
},
9394
"angular-rspack": {
94-
"projects": ["angular-rspack-compiler"],
95+
"projects": ["angular-rspack-compiler", "angular-rspack"],
9596
"version": {
9697
"manifestRootsToUpdate": ["packages/{projectName}"]
9798
}
@@ -220,7 +221,7 @@
220221
"@monodon/rust",
221222
{
222223
"plugin": "@nx/vite/plugin",
223-
"include": ["packages/angular-rspack-compiler/**"],
224+
"include": ["packages/angular-rspack-compiler/**", "packages/angular-rspack/**"],
224225
"options": {
225226
"testTargetName": "test"
226227
}

packages/angular-rspack-compiler/.eslintrc.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@
3838
"error",
3939
{
4040
"ignoredFiles": [
41-
"{projectRoot}/eslint.config.{js,cjs,mjs}",
41+
"{projectRoot}/.eslintrc.json",
4242
"{projectRoot}/vite.config.{js,ts,mjs,mts}"
4343
],
4444
"ignoredDependencies": [
4545
"@angular/core",
46-
"@code-pushup/models",
47-
"@code-pushup/utils",
4846
"jsonc-eslint-parser",
4947
"vitest",
5048
"memfs",

packages/angular-rspack-compiler/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060
],
6161
"targets": {
6262
"build": {},
63+
"test": {
64+
"dependsOn": ["test-native", "build-native", "^build-native"],
65+
"inputs": ["default", "^production", "{projectRoot}/vitest.config.mts"],
66+
"options": {
67+
"args": ["--passWithNoTests"]
68+
}
69+
},
6370
"nx-release-publish": {
6471
"executor": "@nx/js:release-publish",
6572
"options": {

packages/angular-rspack-compiler/src/utils/source-file-cache.spec.ts

Lines changed: 0 additions & 135 deletions
This file was deleted.

packages/angular-rspack-compiler/test-utils/fs-memfs.setup-file.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import {
66
beforeAll,
77
afterAll,
88
} from 'vitest';
9-
import { MEMFS_VOLUME } from '@ng-rspack/testing-utils';
109

1110
/**
1211
* Mocks the fs and fs/promises modules with memfs.
1312
*/
14-
1513
type Memfs = typeof import('memfs');
14+
export const MEMFS_VOLUME = '/memfs';
1615

1716
vi.mock('fs', async () => {
1817
const memfs: Memfs = await vi.importActual('memfs');
@@ -34,7 +33,7 @@ vi.mock('fs/promises', async () => {
3433
* - `readFile(join(process.cwd(), 'file.txt'))` reads MEMFS_VOLUME/file.txt
3534
* - `readFile('file.txt')` reads file.txt
3635
*/
37-
let cwdSpy: MockInstance<[], string>;
36+
let cwdSpy: MockInstance;
3837

3938
// This covers arrange blocks at the top of a "describe" block
4039
beforeAll(() => {

packages/angular-rspack-compiler/vitest.config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ export default defineConfig({
88
watch: false,
99
globals: true,
1010
environment: 'node',
11-
include: ['src/**/*.unit.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
11+
include: ['src/**/*.spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
1212
setupFiles: ['./test-utils/fs-memfs.setup-file.ts'],
1313
reporters: ['default'],
1414
coverage: {
1515
provider: 'v8',
1616
reporter: ['text', 'lcov'],
17-
reportsDirectory: '../../coverage/angular-rspack-compiler/unit',
17+
reportsDirectory: './coverage/angular-rspack-compiler/unit',
1818
exclude: [
1919
'mocks/**',
2020
'**/types.ts',
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
"rules": {},
4+
"ignorePatterns": ["!**/*", "node_modules"],
5+
"overrides": [
6+
{
7+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8+
"rules": {
9+
"no-restricted-imports": [
10+
"error",
11+
{
12+
"name": "chalk",
13+
"message": "Please use `picocolors` in place of `chalk` for rendering terminal colors"
14+
}
15+
]
16+
}
17+
},
18+
{
19+
"files": ["*.ts", "*.tsx"],
20+
"rules": {}
21+
},
22+
{
23+
"files": ["*.js", "*.jsx"],
24+
"rules": {}
25+
},
26+
{
27+
"files": ["./package.json"],
28+
"parser": "jsonc-eslint-parser",
29+
"rules": {
30+
"@nx/nx-plugin-checks": "error"
31+
}
32+
},
33+
{
34+
"files": ["./package.json"],
35+
"parser": "jsonc-eslint-parser",
36+
"rules": {
37+
"@nx/dependency-checks": [
38+
"error",
39+
{
40+
"ignoredFiles": [
41+
"{projectRoot}/.eslintrc.json",
42+
"{projectRoot}/vite.config.{js,ts,mjs,mts}"
43+
],
44+
"ignoredDependencies": [
45+
"@angular/core",
46+
"jsonc-eslint-parser",
47+
"vitest",
48+
"memfs",
49+
"tslib",
50+
// it's only a type import, so it won't be required at runtime
51+
"sass",
52+
// shown as unused because it's required using `createRequire`
53+
"tailwindcss",
54+
// allow following packages to differ as they need to specific to angular
55+
"@babel/core",
56+
"autoprefixer",
57+
"css-loader",
58+
"jsonc-parser",
59+
"less-loader",
60+
"loader-utils",
61+
"open",
62+
"ora",
63+
"parse5-html-rewriting-stream",
64+
"piscina",
65+
"postcss",
66+
"postcss-loader",
67+
"rxjs",
68+
"sass-loader",
69+
"sass-embedded",
70+
"webpack-merge",
71+
"ws"
72+
]
73+
}
74+
]
75+
}
76+
}
77+
]
78+
}

packages/angular-rspack/.npmignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
!dist
22
dist/tsconfig.lib.tsbuildinfo
3-
code-pushup.config.ts
4-
eslint.next.config.js
5-
eslint.config.js
3+
.eslintrc.json
64
project.json
75
tsconfig.json
86
tsconfig.lib.json
@@ -12,4 +10,4 @@ src/**/*.ts
1210
!src/lib/patch
1311
.swcrc
1412
vitest.config.mts
15-
vitest.integration.config.mts
13+
test-utils

packages/angular-rspack/README.md

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
![Nx](https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg)
2-
<div style="text-align: center;">
1+
<p style="text-align: center;">
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4+
<img alt="Nx - Smart Repos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5+
</picture>
6+
</p>
37

4-
# @nx/angular-rspack
8+
{{links}}
59

6-
[![GitHub Actions](https://github.com/nrwl/angular-rspack/actions/workflows/ci.yml/badge.svg)](https://github.com/nrwl/angular-rspack/actions/workflows/ci.yml)
7-
![License](https://img.shields.io/badge/License-MIT-blue)
8-
[![NPM Version](https://img.shields.io/npm/v/%40ng-rspack%2Fbuild?label=%40nx%2Fangular-rspack)](https://www.npmjs.com/package/@ng-rspack/build)
10+
<hr>
911

10-
</div>
12+
# Nx: Smart Repos · Fast Builds
1113

12-
<hr>
14+
An AI-first build platform that connects everything from your editor to CI. Helping you deliver fast, without breaking things.
1315

14-
# Build Angular with Rspack
16+
17+
## Build Angular with Rspack
1518

1619
The goal of `@nx/angular-rspack` is to make easy and straightforward to build Angular applications with [rspack](https://rspack.dev).
1720

18-
## Getting Started
21+
### Getting Started
1922

20-
### Step 1: Create a new Nx Workspace with Angular Rspack Application
23+
#### Step 1: Create a new Nx Workspace with Angular Rspack Application
2124

2225
```bash
2326
npx create-nx-workspace myorg
@@ -36,21 +39,9 @@ NX Let's create a new workspace [[https://nx.dev/getting-started/intro](https:
3639
NX Creating your v20.8.0 workspace.
3740
```
3841
39-
### Step 2: Run Build and Serve commands
42+
#### Step 2: Run Build and Serve commands
4043
4144
```bash
4245
npx nx build myorg
4346
npx nx serve myorg
4447
```
45-
46-
47-
## Documentation and Resources
48-
49-
- [Read the Angular Rspack Documentation](https://nx.dev/recipes/angular/rspack/introduction)
50-
- [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
51-
- [Intro to Nx](https://nx.dev/getting-started/intro)
52-
- [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
53-
- [Blog Posts About Nx](https://nx.dev/blog)
54-
55-
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
56-
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>

0 commit comments

Comments
 (0)