-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: use srcRoot for angular build context #25090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
4b0cd8f
191e140
2d7c2c5
44299f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
"version": 1, | ||
"newProjectRoot": "projects", | ||
"projects": { | ||
"angular": { | ||
"projectType": "application", | ||
"root": "", | ||
"sourceRoot": "ui", | ||
"prefix": "app", | ||
"architect": { | ||
"build": { | ||
"builder": "@angular-devkit/build-angular:browser", | ||
"options": { | ||
"outputPath": "dist/angular", | ||
"index": "ui/index.html", | ||
"main": "ui/main.ts", | ||
"tsConfig": "tsconfig.app.json", | ||
"inlineStyleLanguage": "scss", | ||
"assets": [ | ||
"ui/favicon.ico" | ||
], | ||
"styles": [ | ||
"ui/styles.scss" | ||
] | ||
}, | ||
"configurations": { | ||
"production": { | ||
"outputHashing": "all" | ||
}, | ||
"development": { | ||
"buildOptimizer": false, | ||
"optimization": false, | ||
"vendorChunk": true, | ||
"extractLicenses": false, | ||
"sourceMap": true, | ||
"namedChunks": true | ||
} | ||
}, | ||
"defaultConfiguration": "production" | ||
}, | ||
"serve": { | ||
"builder": "@angular-devkit/build-angular:dev-server", | ||
"configurations": { | ||
"production": { | ||
"browserTarget": "angular:build:production" | ||
}, | ||
"development": { | ||
"browserTarget": "angular:build:development" | ||
} | ||
}, | ||
"defaultConfiguration": "development" | ||
}, | ||
"extract-i18n": { | ||
"builder": "@angular-devkit/build-angular:extract-i18n", | ||
"options": { | ||
"browserTarget": "angular:build" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"cli": { | ||
"analytics": false | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'angular', | ||
bundler: 'webpack', | ||
webpackConfig: { | ||
resolve: { | ||
alias: { | ||
'@angular/common': require.resolve('@angular/common'), | ||
'@angular/core/testing': require.resolve('@angular/core/testing'), | ||
'@angular/core': require.resolve('@angular/core'), | ||
'@angular/platform-browser/testing': require.resolve('@angular/platform-browser/testing'), | ||
'@angular/platform-browser': require.resolve('@angular/platform-browser'), | ||
'@angular/platform-browser-dynamic/testing': require.resolve('@angular/platform-browser-dynamic/testing'), | ||
'@angular/platform-browser-dynamic': require.resolve('@angular/platform-browser-dynamic'), | ||
'zone.js/testing': require.resolve('zone.js/dist/zone-testing'), | ||
'zone.js': require.resolve('zone.js'), | ||
}, | ||
}, | ||
}, | ||
}, | ||
specPattern: '**/*.cy.ts', | ||
}, | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<title>Components App</title> | ||
</head> | ||
<body> | ||
<div data-cy-root></div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference types="cypress" /> | ||
import { mount } from 'cypress/angular' | ||
|
||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
mount: typeof mount | ||
} | ||
} | ||
} | ||
|
||
Cypress.Commands.add('mount', mount) | ||
|
||
// Example use: | ||
// cy.mount(MyComponent) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "angular", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"ng": "ng", | ||
"start": "ng serve", | ||
"build": "ng build", | ||
"watch": "ng build --watch --configuration development" | ||
}, | ||
"dependencies": { | ||
"@angular/common": "^15.0.3", | ||
"@angular/compiler": "^15.0.3", | ||
"@angular/core": "^15.0.3", | ||
"@angular/platform-browser": "^15.0.3", | ||
"@angular/platform-browser-dynamic": "^15.0.3", | ||
"rxjs": "~7.5.0", | ||
"tslib": "^2.3.0", | ||
"zone.js": "~0.11.4" | ||
}, | ||
"devDependencies": { | ||
"@angular-devkit/build-angular": "^15.0.3", | ||
"@angular/cli": "~15.0.3", | ||
"@angular/compiler-cli": "^15.0.3", | ||
"typescript": "~4.8.4" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./out-tsc/app", | ||
"types": [] | ||
}, | ||
"files": [ | ||
"ui/main.ts" | ||
], | ||
"include": [ | ||
"ui/**/*.d.ts" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* To learn more about this file see: https://angular.io/config/tsconfig. */ | ||
{ | ||
"compileOnSave": false, | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"outDir": "./dist/out-tsc", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"sourceMap": true, | ||
"declaration": false, | ||
"downlevelIteration": true, | ||
"experimentalDecorators": true, | ||
"moduleResolution": "node", | ||
"importHelpers": true, | ||
"target": "ES2022", | ||
"module": "es2020", | ||
"lib": [ | ||
"es2020", | ||
"dom" | ||
], | ||
"useDefineForClassFields": false | ||
}, | ||
"angularCompilerOptions": { | ||
"enableI18nLegacyMessageIdFormat": false, | ||
"strictInjectionParameters": true, | ||
"strictInputAccessModifiers": true, | ||
"strictTemplates": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { AppComponent } from './app.component' | ||
|
||
describe('AppComponent', () => { | ||
it('should mount', () => { | ||
cy.mount(AppComponent) | ||
cy.contains('h1', 'Hello World!') | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Component } from '@angular/core' | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
template: '<h1>{{message}}</h1>', | ||
styles: [` | ||
h1 { | ||
background-color: blue; | ||
color: white | ||
}`], | ||
}) | ||
export class AppComponent { | ||
message = 'Hello World!' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { NgModule } from '@angular/core' | ||
import { BrowserModule } from '@angular/platform-browser' | ||
|
||
import { AppComponent } from './app.component' | ||
|
||
@NgModule({ | ||
declarations: [AppComponent], | ||
imports: [BrowserModule], | ||
bootstrap: [AppComponent], | ||
}) | ||
export class AppModule {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Angular</title> | ||
<base href="/"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico"> | ||
</head> | ||
<body> | ||
<app-root></app-root> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we need a basic Angular project in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do have one, but this project felt different enough that I thought I'd make a new one. If I was to reuse the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @ZachJW34 that this is worth a different project since the source root is pretty fundamental part of the app. |
||
|
||
import { AppModule } from './app/app.module' | ||
|
||
import 'zone.js' // Included with Angular CLI. | ||
|
||
platformBrowserDynamic().bootstrapModule(AppModule) | ||
.catch((err) => console.error(err)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* { | ||
box-sizing: border-box; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this API change between majors? Should we check
defaultProjectConfig.root ?? defaultProjectConfig.sourceRoot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it didn't change, I believe it was just a mistake on our part.