Skip to content

Commit d07cf39

Browse files
Fixed Angular issues
1 parent 3cfff2d commit d07cf39

27 files changed

+501
-13679
lines changed

.env

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version=3cfff2d58341fadabc281737bb53e3b98712f813
2+
version=3cfff2d58341fadabc281737bb53e3b98712f813
3+
version=3cfff2d58341fadabc281737bb53e3b98712f813
4+
version=3cfff2d58341fadabc281737bb53e3b98712f813
5+
version=3cfff2d58341fadabc281737bb53e3b98712f813
6+
version=3cfff2d58341fadabc281737bb53e3b98712f813
7+
version=3cfff2d58341fadabc281737bb53e3b98712f813
8+
version=3cfff2d58341fadabc281737bb53e3b98712f813
9+
version=3cfff2d58341fadabc281737bb53e3b98712f813

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.10.0
1+
10.13

Makefile

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44

55
SENTRY_ORG=testorg-az
66
SENTRY_PROJECT=ng-demo
7-
VERSION=`sentry-cli releases propose-version`
87
PREFIX=dist
8+
SENTRY_CLI=./node_modules/.bin/sentry-cli
9+
VERSION=`$(SENTRY_CLI) releases propose-version`
910

1011
setup_release: create_release associate_commits upload_sourcemaps
1112

1213
create_release:
13-
sentry-cli releases -o $(SENTRY_ORG) new -p $(SENTRY_PROJECT) $(VERSION)
14+
$(SENTRY_CLI) releases -o $(SENTRY_ORG) new -p $(SENTRY_PROJECT) $(VERSION)
1415

1516
associate_commits:
16-
sentry-cli releases -o $(SENTRY_ORG) -p $(SENTRY_PROJECT) set-commits --auto $(VERSION)
17+
-$(SENTRY_CLI) releases -o $(SENTRY_ORG) -p $(SENTRY_PROJECT) set-commits --local $(VERSION)
1718

1819
upload_sourcemaps:
19-
sentry-cli releases -o $(SENTRY_ORG) -p $(SENTRY_PROJECT) files \
20+
$(SENTRY_CLI) releases -o $(SENTRY_ORG) -p $(SENTRY_PROJECT) files \
2021
$(VERSION) upload-sourcemaps --url-prefix "~/" --rewrite --validate $(PREFIX)
2122

22-
reference_release:
23-
sed -i -e "s/release: .*/\release: \"${VERSION}\"/g" src/app/app.module.ts
23+
create_env:
24+
@echo "version=${VERSION}" >> .env

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ https://docs.sentry.io/platforms/javascript/angular/
1414

1515
The following command is defined in [package.json](https://github.com/sentry-demos/angular/blob/master/package.json#L12-L13) and will build, create release, upload source maps and deploy:
1616

17-
`npm run deploy`
17+
`npm run deploy`
18+
19+
note: predeploy runs as part of deploy where create_env is used
20+
21+
note: a .env file must be made in order to store the relative variable value provided by the Sentry CLI
1822

1923
## GIF
2024
![Alt Text](angular-demo.gif)

angular.json

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular-project": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
17+
"outputPath": "dist",
18+
"index": "src/index.html",
19+
"main": "src/main.ts",
20+
"polyfills": "src/polyfills.ts",
21+
"tsConfig": "tsconfig.app.json",
22+
"aot": true,
23+
"assets": [
24+
"src/favicon.ico",
25+
"src/assets"
26+
],
27+
"styles": [
28+
"src/styles.css"
29+
],
30+
"scripts": []
31+
},
32+
"configurations": {
33+
"production": {
34+
"fileReplacements": [
35+
{
36+
"replace": "src/environments/environment.ts",
37+
"with": "src/environments/environment.prod.ts"
38+
}
39+
],
40+
"optimization": true,
41+
"outputHashing": "all",
42+
"sourceMap": true,
43+
"extractCss": true,
44+
"namedChunks": false,
45+
"extractLicenses": true,
46+
"vendorChunk": false,
47+
"buildOptimizer": true,
48+
"budgets": [
49+
{
50+
"type": "initial",
51+
"maximumWarning": "2mb",
52+
"maximumError": "5mb"
53+
},
54+
{
55+
"type": "anyComponentStyle",
56+
"maximumWarning": "6kb",
57+
"maximumError": "10kb"
58+
}
59+
]
60+
}
61+
}
62+
},
63+
"serve": {
64+
"builder": "@angular-devkit/build-angular:dev-server",
65+
"options": {
66+
"browserTarget": "angular-project:build"
67+
},
68+
"configurations": {
69+
"production": {
70+
"browserTarget": "angular-project:build:production"
71+
}
72+
}
73+
},
74+
"extract-i18n": {
75+
"builder": "@angular-devkit/build-angular:extract-i18n",
76+
"options": {
77+
"browserTarget": "angular-project:build"
78+
}
79+
},
80+
"test": {
81+
"builder": "@angular-devkit/build-angular:karma",
82+
"options": {
83+
"main": "src/test.ts",
84+
"polyfills": "src/polyfills.ts",
85+
"tsConfig": "tsconfig.spec.json",
86+
"karmaConfig": "karma.conf.js",
87+
"assets": [
88+
"src/favicon.ico",
89+
"src/assets"
90+
],
91+
"styles": [
92+
"src/styles.css"
93+
],
94+
"scripts": []
95+
}
96+
},
97+
"lint": {
98+
"builder": "@angular-devkit/build-angular:tslint",
99+
"options": {
100+
"tsConfig": [
101+
"tsconfig.app.json",
102+
"tsconfig.spec.json",
103+
"e2e/tsconfig.json"
104+
],
105+
"exclude": [
106+
"**/node_modules/**"
107+
]
108+
}
109+
},
110+
"e2e": {
111+
"builder": "@angular-devkit/build-angular:protractor",
112+
"options": {
113+
"protractorConfig": "e2e/protractor.conf.js",
114+
"devServerTarget": "angular-project:serve"
115+
},
116+
"configurations": {
117+
"production": {
118+
"devServerTarget": "angular-project:serve:production"
119+
}
120+
}
121+
}
122+
}
123+
}
124+
},
125+
"defaultProject": "angular-project",
126+
"cli": {
127+
"analytics": false
128+
}
129+
}

config-env.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { writeFile } from 'fs';
2+
// Configure Angular `environment.ts` file path
3+
const targetPath = './src/environments/environment.prod.ts';
4+
5+
// Load node modules
6+
const colors = require('colors');
7+
require('dotenv').config();
8+
9+
// `environment.ts` file structure
10+
const envConfigFile = `export const environment = {
11+
release: '${process.env.version}'
12+
};
13+
`;
14+
15+
console.log(colors.magenta('The file `environment.prod.ts` will be written with the following content: \n'));
16+
17+
console.log(colors.grey(envConfigFile));
18+
writeFile(targetPath, envConfigFile, function (err) {
19+
if (err) {
20+
throw console.error(err);
21+
} else {
22+
console.log(colors.magenta(`Angular environment.ts file generated correctly at ${targetPath} \n`));
23+
}
24+
});

e2e/app.e2e-spec.ts

-14
This file was deleted.

e2e/app.po.ts

-11
This file was deleted.

e2e/tsconfig.json

-16
This file was deleted.

karma.conf.js

+14-25
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,32 @@
11
// Karma configuration file, see link for more information
2-
// https://karma-runner.github.io/0.13/config/configuration-file.html
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

44
module.exports = function (config) {
55
config.set({
66
basePath: '',
7-
frameworks: ['jasmine', 'angular-cli'],
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
88
plugins: [
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
11-
require('karma-remap-istanbul'),
12-
require('angular-cli/plugins/karma')
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage-istanbul-reporter'),
13+
require('@angular-devkit/build-angular/plugins/karma')
1314
],
14-
files: [
15-
{ pattern: './src/test.ts', watched: false }
16-
],
17-
preprocessors: {
18-
'./src/test.ts': ['angular-cli']
19-
},
20-
mime: {
21-
'text/x-typescript': ['ts','tsx']
22-
},
23-
remapIstanbulReporter: {
24-
reports: {
25-
html: 'coverage',
26-
lcovonly: './coverage/coverage.lcov'
27-
}
15+
client: {
16+
clearContext: false // leave Jasmine Spec Runner output visible in browser
2817
},
29-
angularCli: {
30-
config: './angular-cli.json',
31-
environment: 'dev'
18+
coverageIstanbulReporter: {
19+
dir: require('path').join(__dirname, './coverage/angular-project'),
20+
reports: ['html', 'lcovonly', 'text-summary'],
21+
fixWebpackSourcePaths: true
3222
},
33-
reporters: config.angularCli && config.angularCli.codeCoverage
34-
? ['progress', 'karma-remap-istanbul']
35-
: ['progress'],
23+
reporters: ['progress', 'kjhtml'],
3624
port: 9876,
3725
colors: true,
3826
logLevel: config.LOG_INFO,
3927
autoWatch: true,
4028
browsers: ['Chrome'],
41-
singleRun: false
29+
singleRun: false,
30+
restartOnFileChange: true
4231
});
4332
};

0 commit comments

Comments
 (0)