Skip to content

Commit

Permalink
fix: add angular v12 support (#300)
Browse files Browse the repository at this point in the history
* test: upgrade scripts

* test: upgade to latest angular

* fix: add angular v12 support

* test: remove ie11 from browserslist

* test: update build command
  • Loading branch information
kukhariev authored May 13, 2021
1 parent b7713d5 commit aaf1f0d
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 76 deletions.
1 change: 0 additions & 1 deletion integrations/latest/.browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
IE 11
1 change: 0 additions & 1 deletion integrations/latest/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

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

# IDEs and editors
/.idea
Expand Down
64 changes: 25 additions & 39 deletions integrations/latest/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,13 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
Expand All @@ -56,20 +43,37 @@
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"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",
"options": {
"browserTarget": "latest:build"
},
"configurations": {
"production": {
"browserTarget": "latest:build:production"
},
"development": {
"browserTarget": "latest:build:development"
}
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
Expand All @@ -84,29 +88,11 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
"exclude": ["**/node_modules/**"]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "latest:serve"
},
"configurations": {
"production": {
"devServerTarget": "latest:serve:production"
}
}
}
}
}
Expand Down
45 changes: 19 additions & 26 deletions integrations/latest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,38 @@
"name": "latest",
"version": "0.0.0",
"scripts": {
"ng": "ng --version",
"ng": "ng",
"start": "ng serve",
"test:spec": "ng test",
"test": "ng build --prod",
"build": "ng build",
"lint": "ng lint",
"e2e": "ng e2e --prod"
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.2.7",
"@angular/common": "~11.2.7",
"@angular/compiler": "~11.2.7",
"@angular/core": "~11.2.7",
"@angular/forms": "~11.2.7",
"@angular/platform-browser": "~11.2.7",
"@angular/platform-browser-dynamic": "~11.2.7",
"@angular/router": "~11.2.7",
"@angular/animations": "~12.0.0",
"@angular/common": "~12.0.0",
"@angular/compiler": "~12.0.0",
"@angular/core": "~12.0.0",
"@angular/forms": "~12.0.0",
"@angular/platform-browser": "~12.0.0",
"@angular/platform-browser-dynamic": "~12.0.0",
"@angular/router": "~12.0.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
"tslib": "^2.1.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1102.6",
"@angular/cli": "~11.2.6",
"@angular/compiler-cli": "~11.2.7",
"@angular-devkit/build-angular": "~12.0.0",
"@angular/cli": "~12.0.0",
"@angular/compiler-cli": "~12.0.0",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.2.0",
"jasmine-core": "~3.7.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.2"
"typescript": "~4.2.3"
}
}
2 changes: 1 addition & 1 deletion integrations/latest/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'zone.js'; // Included with Angular CLI.

/***************************************************************************************************
* APPLICATION IMPORTS
Expand Down
2 changes: 1 addition & 1 deletion integrations/latest/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/dist/zone-testing';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
Expand Down
2 changes: 1 addition & 1 deletion integrations/latest/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"target": "es2017",
"module": "es2020",
"lib": ["es2018", "dom"]
},
Expand Down
3 changes: 2 additions & 1 deletion integrations/recreate.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
npm install -g @angular/cli
mkdir c:\tmp
Set-Location c:\tmp
ng new latest --style=scss --strict=true --skipInstall=true --skipGit=true --routing=true --legacyBrowsers=true
ng new latest --style=scss --strict=true --skipInstall=true --skipGit=true --routing=true
Set-Location $PSScriptRoot
Copy-Item -r c:\tmp\latest\* latest\
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"prettier": "prettier --write \"**/*.{js,json,scss,md,ts,html}\"",
"test:integration": "run-s -sn build:**",
"build:prod": "ng build --prod",
"build:apps": "node scripts/runner.js \"ng build --prod\"",
"build:apps": "node scripts/runner.js \"ng build --configuration production\"",
"ci": "run-s lint test e2e build test:integration",
"serve:ng7": "angular-http-server --path dist/app",
"serve:latest": "angular-http-server --path integrations/latest/dist/latest",
Expand Down Expand Up @@ -87,7 +87,7 @@
"zone.js": "0.8.26"
},
"peerDependencies": {
"@angular/core": ">=7.0.0 <12.0.0",
"@angular/core": ">=7.0.0 <13.0.0",
"rxjs": "^6.3.0"
},
"lint-staged": {
Expand Down
6 changes: 3 additions & 3 deletions scripts/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const cmd = args[0] && args[0].trim();
const { execSync } = require('child_process');
const { copySync } = require('cpx');
const { writeFileSync, copyFileSync, promises } = require('fs');
const { join, resolve } = require('path');
const { join, resolve, basename } = require('path');

const baseDir = resolve(`${__dirname}/..`);
const integrationsPath = resolve(baseDir, `integrations`);

const testCmd = cmd || 'ng build --prod';
const testCmd = cmd || 'ng build --configuration production';

if (baseDir !== process.cwd()) {
process.chdir(baseDir);
Expand All @@ -30,7 +30,7 @@ function prepareProject(path) {
copyFileSync('src/styles.scss', `${path}/src/styles.scss`);
writeFileSync(
`${path}/src/app/package.json`,
JSON.stringify({ sideEffects: false, name: path, private: true }, undefined, 2)
JSON.stringify({ sideEffects: false, name: basename(path), private: true }, undefined, 2)
);
copySync('e2e/**/*', `${path}/e2e`, { clean: true });
copySync('src/environments/**/*', `${path}/src/environments`, { clean: true });
Expand Down

0 comments on commit aaf1f0d

Please sign in to comment.