Skip to content

Commit

Permalink
feat: angular 11 support (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
schuchard committed Nov 29, 2020
1 parent 58f264a commit 5c27e07
Show file tree
Hide file tree
Showing 31 changed files with 7,643 additions and 7,769 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: 'circleci/node:10.15.3-browsers'
- image: 'circleci/node:14.15.1-browsers'
steps:
- checkout
# Download and cache dependencies
Expand Down
9 changes: 0 additions & 9 deletions README.md
Expand Up @@ -4,7 +4,6 @@ A Schematic that adds prettier and a pre-commit hook for formatting staged files

[![CircleCI](https://circleci.com/gh/schuchard/prettier-schematic.svg?style=svg)](https://circleci.com/gh/schuchard/prettier-schematic)
[![npm](https://img.shields.io/npm/v/@schuchard/prettier.svg)](https://www.npmjs.com/package/@schuchard/prettier)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

## Usage 🚀
Expand Down Expand Up @@ -129,14 +128,6 @@ Reset the sandbox state after running the schematic locally
yarn clean
```

### Committing ✅

This repo uses semantic-release and relies on [formatted](https://github.com/semantic-release/semantic-release#commit-message-format) commit messages for determining the next version. After staging changes, build the commit message with commitizen:

```shell
yarn cm
```

## Documentation

Unsure how to do something with schematics? Check the Angular [schematics](https://github.com/angular/angular-cli/tree/master/packages/schematics/angular) for inspiration.
Expand Down
26 changes: 14 additions & 12 deletions package.json
Expand Up @@ -29,24 +29,26 @@
"bugs": "https://github.com/schuchard/prettier-schematic/issues",
"license": "MIT",
"schematics": "./src/collection.json",
"ng-add": {
"save": "devDependencies"
},
"engines": {
"node": ">=8.11.0"
},
"dependencies": {
"@angular-devkit/core": "^7.0.1",
"@angular-devkit/schematics": "^7.0.1",
"@types/node": "^10.12.0",
"rxjs": "^6.3.3",
"typescript": "^3.1.3"
"@angular-devkit/core": "^11.0.2",
"@angular-devkit/schematics": "^11.0.2",
"@types/node": "^14.14.10",
"rxjs": "^6.6.3",
"typescript": "^4.1.2"
},
"devDependencies": {
"@types/jasmine": "^3.2.0",
"commitizen": "^2.10.1",
"cz-conventional-changelog": "^2.1.0",
"jasmine": "^3.2.0",
"np": "^3.0.4",
"npm-run-all": "^4.1.5",
"semantic-release": "15.10.3"
"@types/jasmine": "^3.6.2",
"commitizen": "^4.2.2",
"cz-conventional-changelog": "^3.3.0",
"jasmine": "^3.6.3",
"np": "^7.0.0",
"npm-run-all": "^4.1.5"
},
"config": {
"commitizen": {
Expand Down
17 changes: 17 additions & 0 deletions sandbox/.browserslistrc
@@ -0,0 +1,17 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
3 changes: 3 additions & 0 deletions sandbox/.editorconfig
Expand Up @@ -8,6 +8,9 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
4 changes: 2 additions & 2 deletions sandbox/.gitignore
Expand Up @@ -11,8 +11,8 @@
/node_modules

# profiling files
chrome-profiler-events.json
speed-measure-plugin.json
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
Expand Down
4 changes: 2 additions & 2 deletions sandbox/README.md
@@ -1,6 +1,6 @@
# Sandbox

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.4.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.2.

## Development server

Expand All @@ -24,4 +24,4 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
67 changes: 29 additions & 38 deletions sandbox/angular.json
Expand Up @@ -4,15 +4,18 @@
"newProjectRoot": "projects",
"projects": {
"sandbox": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"style": "sass"
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
Expand All @@ -21,16 +24,16 @@
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [],
"es5BrowserSupport": true
"scripts": []
},
"configurations": {
"production": {
Expand All @@ -43,17 +46,20 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
}
Expand Down Expand Up @@ -81,37 +87,31 @@
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
]
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"sandbox-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
Expand All @@ -123,18 +123,9 @@
"devServerTarget": "sandbox:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "sandbox"
}
}
17 changes: 13 additions & 4 deletions sandbox/e2e/protractor.conf.js
@@ -1,17 +1,22 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');

/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
browserName: 'chrome'
},
directConnect: true,
SELENIUM_PROMISE_MANAGER: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
Expand All @@ -21,8 +26,12 @@ exports.config = {
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};
6 changes: 3 additions & 3 deletions sandbox/e2e/src/app.e2e-spec.ts
Expand Up @@ -8,9 +8,9 @@ describe('workspace-project App', () => {
page = new AppPage();
});

it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to sandbox!');
it('should display welcome message', async () => {
await page.navigateTo();
expect(await page.getTitleText()).toEqual('sandbox app is running!');
});

afterEach(async () => {
Expand Down
8 changes: 4 additions & 4 deletions sandbox/e2e/src/app.po.ts
@@ -1,11 +1,11 @@
import { browser, by, element } from 'protractor';

export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
async navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl);
}

getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
async getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText();
}
}
8 changes: 4 additions & 4 deletions sandbox/e2e/tsconfig.e2e.json → sandbox/e2e/tsconfig.json
@@ -1,13 +1,13 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
}
16 changes: 11 additions & 5 deletions sandbox/src/karma.conf.js → sandbox/karma.conf.js
Expand Up @@ -9,16 +9,22 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/sandbox'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/sandbox'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand Down

0 comments on commit 5c27e07

Please sign in to comment.